Skip to content

Commit

Permalink
feat: add uncheck_modulus_size feature
Browse files Browse the repository at this point in the history
  • Loading branch information
shuai132 committed Oct 9, 2024
1 parent 324c567 commit cadeb55
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ pem = ["pkcs1/pem", "pkcs8/pem"]
pkcs5 = ["pkcs8/encryption"]
u64_digit = ["num-bigint/u64_digit"]
std = ["digest/std", "pkcs1/std", "pkcs8/std", "rand_core/std", "signature/std"]
uncheck_modulus_size = []

[package.metadata.docs.rs]
features = ["std", "pem", "serde", "hazmat", "sha2"]
Expand Down
1 change: 1 addition & 0 deletions src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ pub fn check_public(public_key: &impl PublicKeyParts) -> Result<()> {
/// Check that the public key is well formed and has an exponent within acceptable bounds.
#[inline]
fn check_public_with_max_size(public_key: &impl PublicKeyParts, max_size: usize) -> Result<()> {
#[cfg(not(feature = "uncheck_modulus_size"))]
if public_key.n().bits() > max_size {
return Err(Error::ModulusTooLarge);
}
Expand Down

0 comments on commit cadeb55

Please sign in to comment.