1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-16 17:32:06 +01:00

Fix Dearmor command test to check for new CTB use

This commit is contained in:
Paul Schaub 2022-02-13 01:05:39 +01:00
parent 6cfec53f12
commit 2e29fc3026
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -16,6 +16,7 @@ import java.security.InvalidAlgorithmParameterException;
import java.security.NoSuchAlgorithmException;
import com.ginsberg.junit.exit.FailOnSystemExit;
import org.bouncycastle.bcpg.BCPGOutputStream;
import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.openpgp.PGPPublicKeyRing;
import org.bouncycastle.openpgp.PGPSecretKeyRing;
@ -51,7 +52,12 @@ public class DearmorTest {
System.setOut(new PrintStream(out));
PGPainlessCLI.execute("dearmor");
assertArrayEquals(secretKey.getEncoded(), out.toByteArray());
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
BCPGOutputStream bcpgOut = new BCPGOutputStream(byteOut, true);
secretKey.encode(bcpgOut);
bcpgOut.close();
assertArrayEquals(byteOut.toByteArray(), out.toByteArray());
}
@ -68,7 +74,12 @@ public class DearmorTest {
System.setOut(new PrintStream(out));
PGPainlessCLI.execute("dearmor");
assertArrayEquals(certificate.getEncoded(), out.toByteArray());
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
BCPGOutputStream bcpgOut = new BCPGOutputStream(byteOut, true);
certificate.encode(bcpgOut);
bcpgOut.close();
assertArrayEquals(byteOut.toByteArray(), out.toByteArray());
}
@Test