Commit 253be30b authored by Justin Santa Barbara's avatar Justin Santa Barbara

If PKCS1 parsing of the SSH key fails, try PKCS8

parent 13198eb5
...@@ -24,7 +24,12 @@ func (k *SimpleKeychain) AddPEMKey(key string) (err error) { ...@@ -24,7 +24,12 @@ func (k *SimpleKeychain) AddPEMKey(key string) (err error) {
return errors.New("no block in key") 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 { if err != nil {
return return
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment