Add test ckecking that BadData is thrown if KEYS is passed for CERTS

This commit is contained in:
Paul Schaub 2024-03-17 15:43:39 +01:00
parent 7325cad696
commit cd208c8942
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -327,4 +327,15 @@ public class EncryptDecryptTest extends AbstractSOPTest {
.toByteArrayAndResult()
.getBytes());
}
@ParameterizedTest
@MethodSource("provideInstances")
public void passingSecretKeysForPublicKeysFails(SOP sop) {
assertThrows(SOPGPException.BadData.class, () ->
sop.encrypt()
.withCert(TestData.ALICE_KEY.getBytes(StandardCharsets.UTF_8))
.plaintext(TestData.PLAINTEXT.getBytes(StandardCharsets.UTF_8))
.toByteArrayAndResult()
.getBytes());
}
}