mirror of
https://codeberg.org/PGPainless/sop-java.git
synced 2025-09-09 10:19:47 +02:00
Add more tests
This commit is contained in:
parent
4726362df8
commit
eded55c259
3 changed files with 101 additions and 1 deletions
|
@ -71,4 +71,28 @@ public class ExternalDetachedSignVerifyRoundTripTest extends AbstractExternalSOP
|
|||
|
||||
assertFalse(verificationList.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void signArmorVerifyWithBobKey() throws IOException {
|
||||
byte[] message = "Hello, World!\n".getBytes(StandardCharsets.UTF_8);
|
||||
|
||||
byte[] signature = getSop().detachedSign()
|
||||
.key(TestKeys.BOB_KEY.getBytes(StandardCharsets.UTF_8))
|
||||
.noArmor()
|
||||
.data(message)
|
||||
.toByteArrayAndResult()
|
||||
.getBytes();
|
||||
|
||||
byte[] armored = getSop().armor()
|
||||
.data(signature)
|
||||
.getBytes();
|
||||
|
||||
List<Verification> verificationList = getSop().detachedVerify()
|
||||
.cert(TestKeys.BOB_CERT.getBytes(StandardCharsets.UTF_8))
|
||||
.signatures(armored)
|
||||
.data(message);
|
||||
|
||||
assertFalse(verificationList.isEmpty());
|
||||
assertTrue(verificationList.get(0).toString().contains("D1A66E1A23B182C9980F788CFBFCC82A015E7330 D1A66E1A23B182C9980F788CFBFCC82A015E7330"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue