-
Notifications
You must be signed in to change notification settings - Fork 18k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/crypto/ssh: ParsePrivateKey fails to parse BER encoded key #14145
Comments
@rickard-von-essen the failure in your example seems to be related to the private key. Also seeing a difference in the output of what openssl parses and the example. This would indicate a discrepancy in the encoding of the private key.
|
@musgravejw Sorry I should have add that detail, I knew that. The point of the bug report is that applying Postel's law and seeing OpenSSL as a reference implementation I think also |
To be very precise, the "issue" is that Go, by way of its asn1 package, only supports the stricter/subset "DER"/"Distinguished Encoding Rules" and not the superset "BER"/"Basic Encoding Rules", impeding interoperability as both are valid asn1 encodings. Quoted from the latest version of the asn1 package (see Lines 5 to 6 in 7f96e26
I have tried to address this on the Paramiko side (see paramiko/paramiko#572), but was led to believe the problem would be shortly addressed in a different manner, which I will re-engage based on this new/renewed interest. Regardless of Paramiko, it would improve Go's general crypto interoperability to support BER (ie Postel's Law). |
See #12267, it's unlikely that encoding/asn1 will ever support BER.
|
We don't wish to support BER I'm afraid. |
A key created with Parmiko (OpenStack/Nova) which is valid according to OpenSSL can't be parsed by
ssh.ParsePrivateKey
.Trying to parse the example key with
ssh.ParsePrivateKey
gives:Verifying the PEM
Verifying the
example.pem
(see the key at the bottom):Example Go Code
Environment
example.pem
The text was updated successfully, but these errors were encountered: