1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-26 22:32:07 +01:00

Fix malformed signature packets

This commit is contained in:
Paul Schaub 2022-03-27 16:35:20 +02:00
parent 8ff405d6ad
commit 80d97b1bc0

View file

@ -47,6 +47,8 @@ public final class EncryptionStream extends OutputStream {
private static final int BUFFER_SIZE = 1 << 9; private static final int BUFFER_SIZE = 1 << 9;
OutputStream outermostStream; OutputStream outermostStream;
OutputStream signatureLayerStream;
private ArmoredOutputStream armorOutputStream = null; private ArmoredOutputStream armorOutputStream = null;
private OutputStream publicKeyEncryptedStream = null; private OutputStream publicKeyEncryptedStream = null;
private PGPCompressedDataGenerator compressedDataGenerator; private PGPCompressedDataGenerator compressedDataGenerator;
@ -130,6 +132,7 @@ public final class EncryptionStream extends OutputStream {
} }
private void prepareOnePassSignatures() throws IOException, PGPException { private void prepareOnePassSignatures() throws IOException, PGPException {
signatureLayerStream = outermostStream;
SigningOptions signingOptions = options.getSigningOptions(); SigningOptions signingOptions = options.getSigningOptions();
if (signingOptions == null || signingOptions.getSigningMethods().isEmpty()) { if (signingOptions == null || signingOptions.getSigningMethods().isEmpty()) {
// No singing options/methods -> no signing // No singing options/methods -> no signing
@ -274,7 +277,7 @@ public final class EncryptionStream extends OutputStream {
resultBuilder.addDetachedSignature(signingKey, signature); resultBuilder.addDetachedSignature(signingKey, signature);
} }
if (!signingMethod.isDetached() || options.isCleartextSigned()) { if (!signingMethod.isDetached() || options.isCleartextSigned()) {
signature.encode(outermostStream); signature.encode(signatureLayerStream);
} }
} }
} }