Commit 81e15a81 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

Merge pull request #376 from justinsb/try_parse_pkcs8

communicator/ssh: If PKCS1 parsing of the SSH key fails, try PKCS8
parents 07ba3db2 253be30b
......@@ -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
}
......
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