You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// checkPub sanity checks the public key before we use it.
// We require pub.E to fit into a 32-bit integer so that we
// do not have different behavior depending on whether
// int is 32 or 64 bits. See also
// https://www.imperialviolet.org/2012/03/16/rsae.html.
func checkPub(pub *PublicKey) error {
if pub.N == nil {
return errPublicModulus
}
if pub.E < 2 {
return errPublicExponentSmall
}
if pub.E > 1<<31-1 {
return errPublicExponentLarge
}
return nil
}
Here, the fixed public exponent still fit 32-bits (uint32 instead of int32), so changing
rsa.PublicKey.E unfortunately is an int, not uint, so on 32-bit machines it will only hold values lower than 1<<31, and we want to be consistent across architectures. Such exponents are rare and unnecessary.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I converted an RSA private key to PEM and tried to load it with crypto/x509.
I manually verified the PEM is valid with Python.
https://play.golang.org/p/8lePKysTb-1
What did you expect to see?
To be able to parse the PEM & get the RSA private key contained inside
What did you see instead?
An error: "asn1: structure error: integer too large"
Probably related to #3161
The text was updated successfully, but these errors were encountered: