If PKCS1 parsing of the SSH key fails, try PKCS8

pull/919/head
Justin Santa Barbara 13 years ago
parent 13198eb570
commit 253be30bd1

@ -24,7 +24,12 @@ func (k *SimpleKeychain) AddPEMKey(key string) (err error) {
return errors.New("no block in key")
}
rsakey, err := x509.ParsePKCS1PrivateKey(block.Bytes)
var rsakey interface{}
rsakey, err = x509.ParsePKCS1PrivateKey(block.Bytes)
if err != nil {
rsakey, err = x509.ParsePKCS8PrivateKey(block.Bytes)
}
if err != nil {
return
}

Loading…
Cancel
Save