mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-12-23 11:27:57 +01:00
parent
8abd8e8708
commit
9cf15e3d7c
2 changed files with 19 additions and 3 deletions
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
package org.pgpainless.sop;
|
package org.pgpainless.sop;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
@ -92,10 +91,10 @@ public class DetachedSignImpl implements DetachedSign {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
OutputStream sink = new NullOutputStream();
|
||||||
try {
|
try {
|
||||||
EncryptionStream signingStream = PGPainless.encryptAndOrSign()
|
EncryptionStream signingStream = PGPainless.encryptAndOrSign()
|
||||||
.onOutputStream(buffer)
|
.onOutputStream(sink)
|
||||||
.withOptions(ProducerOptions.sign(signingOptions)
|
.withOptions(ProducerOptions.sign(signingOptions)
|
||||||
.setAsciiArmor(armor));
|
.setAsciiArmor(armor));
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
// SPDX-FileCopyrightText: 2024 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
package org.pgpainless.sop;
|
||||||
|
|
||||||
|
import java.io.OutputStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link OutputStream} that simply discards bytes written to it.
|
||||||
|
*/
|
||||||
|
public class NullOutputStream extends OutputStream {
|
||||||
|
@Override
|
||||||
|
public void write(int b) {
|
||||||
|
// NOP
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue