Merge pull request #376 from justinsb/try_parse_pkcs8
communicator/ssh: If PKCS1 parsing of the SSH key fails, try PKCS8
This commit is contained in:
commit
81e15a8133
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue