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
1 changed files with 13 additions and 2 deletions

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