Add test for certifying with revoked key

This commit is contained in:
Paul Schaub 2025-04-10 15:26:00 +02:00
parent dea7e905a9
commit 091b5f9a5e
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -119,4 +119,35 @@ public class CertifyValidateUserIdTest {
.subjects(bobWithPetName),
"Bob does not accept the pet-name Alice gave him");
}
@ParameterizedTest
@MethodSource("provideInstances")
public void certifyWithRevokedKey(SOP sop) throws IOException {
byte[] aliceKey = sop.generateKey()
.userId("Alice <alice@pgpainless.org>")
.generate()
.getBytes();
byte[] aliceRevokedCert = sop.revokeKey()
.keys(aliceKey)
.getBytes();
byte[] aliceRevokedKey = sop.updateKey()
.mergeCerts(aliceRevokedCert)
.key(aliceKey)
.getBytes();
byte[] bobKey = sop.generateKey()
.userId("Bob <bob@pgpainless.org>")
.generate()
.getBytes();
byte[] bobCert = sop.extractCert()
.key(bobKey)
.getBytes();
assertThrows(SOPGPException.KeyCannotCertify.class, () ->
sop.certifyUserId()
.userId("Bob <bob@pgpainless.org>")
.keys(aliceRevokedKey)
.certs(bobCert)
.getBytes());
}
}