use of io.nem.symbol.core.crypto.Signature in project nem2-sdk-java by nemtech.
the class Ed25519DsaSignerTest method signThrowsIfGeneratedSignatureIsNotCanonical.
@Test
public void signThrowsIfGeneratedSignatureIsNotCanonical() {
// Arrange:
final CryptoEngine engine = this.getCryptoEngine();
final KeyPair keyPair = KeyPair.random(engine);
final Ed25519DsaSigner dsaSigner = new Ed25519DsaSigner(keyPair) {
@Override
public boolean isCanonicalSignature(Signature signature) {
return false;
}
};
final byte[] input = RandomUtils.generateRandomBytes();
// Act:
Assertions.assertEquals("Generated signature is not canonical", Assertions.assertThrows(CryptoException.class, () -> dsaSigner.sign(input)).getMessage());
}
Aggregations