Skip to content

Commit

Permalink
chore: Apply rustfmt changes
Browse files Browse the repository at this point in the history
  • Loading branch information
emgrav committed Oct 29, 2024
1 parent 0e53cbd commit 80a554a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/jwe/alg/pbes2_hmac_aeskw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,10 @@ impl JweDecrypter for Pbes2HmacAeskwJweDecrypter {
};

if p2c > 1000000 {
bail!("The p2c value is too large. This is a possible DoS attack: {}", p2c);
bail!(
"The p2c value is too large. This is a possible DoS attack: {}",
p2c
);
}

let mut salt = Vec::with_capacity(self.algorithm().name().len() + 1 + p2s.len());
Expand Down Expand Up @@ -510,7 +513,9 @@ mod tests {

let decrypter = alg.decrypter_from_jwk(&jwk)?;

let err = decrypter.decrypt(encrypted_key.as_deref(), &enc, &out_header).unwrap_err();
let err = decrypter
.decrypt(encrypted_key.as_deref(), &enc, &out_header)
.unwrap_err();
assert_eq!(format!("{}", err), "Invalid JWE format: The p2c value is too large. This is a possible DoS attack: 1000001");
}

Expand Down
2 changes: 1 addition & 1 deletion src/jws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ pub use RsassaPssJwsAlgorithm::Ps384 as PS384;
pub use RsassaPssJwsAlgorithm::Ps512 as PS512;

use crate::jws::alg::ecdsa::EcdsaJwsAlgorithm;
pub use EcdsaJwsAlgorithm::BP256R1 as BP256R1;
pub use EcdsaJwsAlgorithm::Es256 as ES256;
pub use EcdsaJwsAlgorithm::Es256k as ES256K;
pub use EcdsaJwsAlgorithm::Es384 as ES384;
pub use EcdsaJwsAlgorithm::Es512 as ES512;
pub use EcdsaJwsAlgorithm::BP256R1;

use crate::jws::alg::eddsa::EddsaJwsAlgorithm;
pub use EddsaJwsAlgorithm::Eddsa as EdDSA;
Expand Down

0 comments on commit 80a554a

Please sign in to comment.