We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 52128cf commit 4a1d33eCopy full SHA for 4a1d33e
src/rsa/mod.rs
@@ -141,6 +141,12 @@ impl PublicKey {
141
let n = BigUint::from_bytes_be(&bytes[0..256]);
142
let e = BigUint::from_bytes_be(&bytes[256..264]);
143
144
+ // Whilst the RSA algorithm permits different exponents, every modern
145
+ // system only ever uses 65537 and most also enforce this. Might as
146
+ // well do the same.
147
+ if e != BigUint::from(65537u32) {
148
+ return Err(rsa::Error::InvalidExponent);
149
+ }
150
let key = RsaPublicKey::new(n, e)?;
151
let inner = rsa::pkcs1v15::VerifyingKey::<Sha256>::new(key);
152
Ok(Self { inner })
0 commit comments