Skip to content

Commit

Permalink
Fix EvpSignatureTest and EvpSignatureSpecificTest
Browse files Browse the repository at this point in the history
  • Loading branch information
WillChilds-Klein committed Dec 13, 2023
1 parent 0c5a7b8 commit 92f612b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -770,14 +770,14 @@ private static void simpleCorrectnessSignVerify(
}

@Test
public void ecdsaAcceptsNullParams() throws Exception {
public void ecdsaRejectsNullParams() throws Exception {
final Signature signer = Signature.getInstance("SHA384withECDSA", NATIVE_PROVIDER);
signer.initSign(ECDSA_PAIR.getPrivate());
signer.setParameter(null);
assertThrows(InvalidAlgorithmParameterException.class, () -> signer.setParameter(null));
signer.update(MESSAGE);
final byte[] signature = signer.sign();
signer.initVerify(ECDSA_PAIR.getPublic());
signer.setParameter(null);
assertThrows(InvalidAlgorithmParameterException.class, () -> signer.setParameter(null));
signer.update(MESSAGE);
assertTrue(signer.verify(signature));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,14 @@ public TestParams(
this.paramSpec = paramSpec;

signer = getNativeSigner();
signer.setParameter(paramSpec);
if (paramSpec != null) {
signer.setParameter(paramSpec);
}
signer.initSign(keyPair.getPrivate());
verifier = getNativeSigner();
verifier.setParameter(paramSpec);
if (paramSpec != null) {
verifier.setParameter(paramSpec);
}
verifier.initVerify(keyPair.getPublic());

jceVerifier = getJceSigner();
Expand Down

0 comments on commit 92f612b

Please sign in to comment.