mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-09-10 18:59:39 +02:00
parent
8834d8ad10
commit
754fcf72a1
4 changed files with 65 additions and 1 deletions
|
@ -0,0 +1,34 @@
|
|||
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package org.pgpainless.encryption_signing;
|
||||
|
||||
import org.bouncycastle.openpgp.PGPException;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.pgpainless.PGPainless;
|
||||
import org.pgpainless.util.Passphrase;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class HideArmorHeadersTest {
|
||||
|
||||
@Test
|
||||
public void testVersionHeaderIsOmitted() throws PGPException, IOException {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
EncryptionStream encryptionStream = PGPainless.encryptAndOrSign()
|
||||
.onOutputStream(out)
|
||||
.withOptions(ProducerOptions.encrypt(
|
||||
EncryptionOptions.get()
|
||||
.addPassphrase(Passphrase.fromPassword("sw0rdf1sh")))
|
||||
.setHideArmorHeaders(true));
|
||||
|
||||
encryptionStream.write("Hello, World!\n".getBytes());
|
||||
encryptionStream.close();
|
||||
|
||||
assertTrue(out.toString().startsWith("-----BEGIN PGP MESSAGE-----\n\n")); // No "Version: PGPainless"
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue