mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-22 20:32:05 +01:00
SOP: Respect signature type
This commit is contained in:
parent
6f48a1a261
commit
e07998f99d
1 changed files with 10 additions and 7 deletions
|
@ -10,6 +10,7 @@ import org.bouncycastle.openpgp.PGPSecretKeyRing;
|
|||
import org.bouncycastle.openpgp.PGPSignature;
|
||||
import org.bouncycastle.util.io.Streams;
|
||||
import org.pgpainless.PGPainless;
|
||||
import org.pgpainless.encryption_signing.EncryptionBuilderInterface;
|
||||
import org.pgpainless.encryption_signing.EncryptionStream;
|
||||
import org.pgpainless.key.protection.UnprotectedKeysProtector;
|
||||
import org.pgpainless.sop.Print;
|
||||
|
@ -49,12 +50,14 @@ public class Sign implements Runnable {
|
|||
}
|
||||
try {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
EncryptionStream encryptionStream = PGPainless.createEncryptor()
|
||||
EncryptionBuilderInterface.DocumentType documentType = PGPainless.encryptAndOrSign()
|
||||
.onOutputStream(out)
|
||||
.doNotEncrypt()
|
||||
.createDetachedSignature()
|
||||
.signWith(new UnprotectedKeysProtector(), secretKeys)
|
||||
.noArmor();
|
||||
.signWith(new UnprotectedKeysProtector(), secretKeys);
|
||||
|
||||
EncryptionBuilderInterface.Armor armor = type == Type.text ? documentType.signCanonicalText() : documentType.signBinaryDocument();
|
||||
EncryptionStream encryptionStream = noArmor ? armor.noArmor() : armor.asciiArmor();
|
||||
|
||||
Streams.pipeAll(System.in, encryptionStream);
|
||||
encryptionStream.close();
|
||||
|
|
Loading…
Reference in a new issue