1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-09-10 02:39:39 +02:00

SOP: Add convenience methods to deal with byte arrays

This commit is contained in:
Paul Schaub 2021-10-10 16:34:17 +02:00
parent 32f3f0246e
commit 15736586dd
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
25 changed files with 451 additions and 128 deletions

View file

@ -7,7 +7,6 @@ package org.pgpainless.sop;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
@ -76,13 +75,13 @@ public class ExtractCertTest {
assertArrayEquals(
cert.getBytes(StandardCharsets.UTF_8),
sop.extractCert()
.key(new ByteArrayInputStream(key.getBytes(StandardCharsets.UTF_8)))
.key(key.getBytes(StandardCharsets.UTF_8))
.getBytes());
}
@Test
public void emptyKeyDataYieldsBadData() {
assertThrows(SOPGPException.BadData.class, () -> sop.extractCert()
.key(new ByteArrayInputStream(new byte[0])));
.key(new byte[0]));
}
}