Skip to content

Commit

Permalink
Include expected length in exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Rubin committed Aug 14, 2023
1 parent a007ba3 commit 9defe72
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/com/amazon/corretto/crypto/provider/EvpSignatureBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,9 @@ protected void sniffTest(final byte[] signature, final int offset, final int len
// Right now we only check RSA signatures to ensure they are the proper length
if (key_ instanceof RSAKey) {
final RSAKey rsaKey = (RSAKey) key_;
if (length != (rsaKey.getModulus().bitLength() + 7) / 8) {
throw new SignatureException("RSA Signature of invalid length.");
final int expectedLength = (rsaKey.getModulus().bitLength() + 7) / 8;
if (length != expectedLength) {
throw new SignatureException("RSA Signature of invalid length. Expected " + expectedLength);
}
}
}
Expand Down

0 comments on commit 9defe72

Please sign in to comment.