mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-09-10 18:59:39 +02:00
Improve API for signatures in results
This commit is contained in:
parent
049f7422c0
commit
335cf8d162
9 changed files with 91 additions and 50 deletions
|
@ -15,8 +15,8 @@ import java.nio.charset.StandardCharsets;
|
|||
|
||||
import org.bouncycastle.bcpg.ArmoredOutputStream;
|
||||
import org.bouncycastle.openpgp.PGPException;
|
||||
import org.bouncycastle.openpgp.PGPSecretKeyRing;
|
||||
import org.bouncycastle.openpgp.PGPSignature;
|
||||
import org.bouncycastle.openpgp.api.OpenPGPKey;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.pgpainless.PGPainless;
|
||||
import org.pgpainless.algorithm.CompressionAlgorithm;
|
||||
|
@ -350,12 +350,13 @@ public class RoundTripInlineSignInlineVerifyCmdTest extends CLITest {
|
|||
|
||||
@Test
|
||||
public void createMalformedMessage() throws IOException, PGPException {
|
||||
PGPainless api = PGPainless.getInstance();
|
||||
String msg = "Hello, World!\n";
|
||||
PGPSecretKeyRing key = PGPainless.readKeyRing().secretKeyRing(KEY_2);
|
||||
OpenPGPKey key = api.readKey().parseKey(KEY_2);
|
||||
ByteArrayOutputStream ciphertext = new ByteArrayOutputStream();
|
||||
EncryptionStream encryptionStream = PGPainless.encryptAndOrSign()
|
||||
EncryptionStream encryptionStream = api.generateMessage()
|
||||
.onOutputStream(ciphertext)
|
||||
.withOptions(ProducerOptions.sign(SigningOptions.get()
|
||||
.withOptions(ProducerOptions.sign(SigningOptions.get(api)
|
||||
.addDetachedSignature(SecretKeyRingProtector.unprotectedKeys(), key)
|
||||
).overrideCompressionAlgorithm(CompressionAlgorithm.UNCOMPRESSED)
|
||||
.setAsciiArmor(false));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue