mirror of
https://codeberg.org/PGPainless/sop-java.git
synced 2025-09-08 17:59:43 +02:00
Add test for certifying with revoked key
This commit is contained in:
parent
dea7e905a9
commit
091b5f9a5e
1 changed files with 31 additions and 0 deletions
|
@ -119,4 +119,35 @@ public class CertifyValidateUserIdTest {
|
||||||
.subjects(bobWithPetName),
|
.subjects(bobWithPetName),
|
||||||
"Bob does not accept the pet-name Alice gave him");
|
"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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue