mirror of
https://codeberg.org/PGPainless/sop-java.git
synced 2024-11-17 13:12:04 +01:00
Add test for dearmoring and armoring certificate
This commit is contained in:
parent
125eefed6e
commit
670aa0f242
1 changed files with 20 additions and 0 deletions
|
@ -19,6 +19,8 @@ public class ExternalArmorDearmorRoundTripTest extends AbstractExternalSOPTest {
|
|||
|
||||
private static final String BEGIN_PGP_PRIVATE_KEY_BLOCK = "-----BEGIN PGP PRIVATE KEY BLOCK-----\n";
|
||||
private static final byte[] BEGIN_PGP_PRIVATE_KEY_BLOCK_BYTES = BEGIN_PGP_PRIVATE_KEY_BLOCK.getBytes(StandardCharsets.UTF_8);
|
||||
private static final String BEGIN_PGP_PUBLIC_KEY_BLOCK = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n";
|
||||
private static final byte[] BEGIN_PGP_PUBLIC_KEY_BLOCK_BYTES = BEGIN_PGP_PUBLIC_KEY_BLOCK.getBytes(StandardCharsets.UTF_8);
|
||||
|
||||
@Test
|
||||
public void dearmorArmorAliceKey() throws IOException {
|
||||
|
@ -36,4 +38,22 @@ public class ExternalArmorDearmorRoundTripTest extends AbstractExternalSOPTest {
|
|||
|
||||
assertArrayStartsWith(armored, BEGIN_PGP_PRIVATE_KEY_BLOCK_BYTES);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void dearmorArmorAliceCert() throws IOException {
|
||||
byte[] aliceCert = TestKeys.ALICE_CERT.getBytes(StandardCharsets.UTF_8);
|
||||
|
||||
byte[] dearmored = getSop().dearmor()
|
||||
.data(aliceCert)
|
||||
.getBytes();
|
||||
|
||||
assertFalse(arrayStartsWith(dearmored, BEGIN_PGP_PUBLIC_KEY_BLOCK_BYTES));
|
||||
|
||||
byte[] armored = getSop().armor()
|
||||
.data(dearmored)
|
||||
.getBytes();
|
||||
|
||||
assertArrayStartsWith(armored, BEGIN_PGP_PUBLIC_KEY_BLOCK_BYTES);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue