Class OpenPgpMessageInputStream
java.lang.Object
java.io.InputStream
org.pgpainless.decryption_verification.DecryptionStream
org.pgpainless.decryption_verification.OpenPgpMessageInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected InputStream
protected final ConsumerOptions
protected TeeBCPGInputStream
protected final PDA
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
OpenPgpMessageInputStream
(InputStream inputStream, ConsumerOptions options, MessageMetadata.Layer metadata, Policy policy) protected
OpenPgpMessageInputStream
(org.pgpainless.decryption_verification.OpenPgpMessageInputStream.Type type, InputStream inputStream, ConsumerOptions options, MessageMetadata.Layer metadata, Policy policy) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
static OpenPgpMessageInputStream
create
(InputStream inputStream, ConsumerOptions options) Create anOpenPgpMessageInputStream
suitable for decryption and verification of OpenPGP messages and signatures.protected static OpenPgpMessageInputStream
create
(InputStream inputStream, ConsumerOptions options, MessageMetadata.Layer metadata, Policy policy) static OpenPgpMessageInputStream
create
(InputStream inputStream, ConsumerOptions options, Policy policy) Create anOpenPgpMessageInputStream
suitable for decryption and verification of OpenPGP messages and signatures.Returnmetadata
about the decrypted / verified message.int
read()
int
read
(byte[] b, int off, int len) Methods inherited from class org.pgpainless.decryption_verification.DecryptionStream
getResult
Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Field Details
-
options
-
syntaxVerifier
-
packetInputStream
-
nestedInputStream
-
-
Constructor Details
-
OpenPgpMessageInputStream
protected OpenPgpMessageInputStream(@Nonnull InputStream inputStream, @Nonnull ConsumerOptions options, @Nonnull MessageMetadata.Layer metadata, @Nonnull Policy policy) throws org.bouncycastle.openpgp.PGPException, IOException - Throws:
org.bouncycastle.openpgp.PGPException
IOException
-
OpenPgpMessageInputStream
protected OpenPgpMessageInputStream(@Nonnull org.pgpainless.decryption_verification.OpenPgpMessageInputStream.Type type, @Nonnull InputStream inputStream, @Nonnull ConsumerOptions options, @Nonnull MessageMetadata.Layer metadata, @Nonnull Policy policy) throws org.bouncycastle.openpgp.PGPException, IOException - Throws:
org.bouncycastle.openpgp.PGPException
IOException
-
-
Method Details
-
create
public static OpenPgpMessageInputStream create(@Nonnull InputStream inputStream, @Nonnull ConsumerOptions options) throws IOException, org.bouncycastle.openpgp.PGPException Create anOpenPgpMessageInputStream
suitable for decryption and verification of OpenPGP messages and signatures. This constructor will use the global PGPainlessPolicy
.- Parameters:
inputStream
- underlying input streamoptions
- options for consuming the stream- Returns:
- input stream that consumes OpenPGP messages
- Throws:
IOException
- in case of an IO errororg.bouncycastle.openpgp.PGPException
- in case of an OpenPGP error
-
create
public static OpenPgpMessageInputStream create(@Nonnull InputStream inputStream, @Nonnull ConsumerOptions options, @Nonnull Policy policy) throws org.bouncycastle.openpgp.PGPException, IOException Create anOpenPgpMessageInputStream
suitable for decryption and verification of OpenPGP messages and signatures. This factory method takes a customPolicy
instead of using the global policy object.- Parameters:
inputStream
- underlying input stream containing the OpenPGP messageoptions
- options for consuming the messagepolicy
- policy for acceptable algorithms etc.- Returns:
- input stream that consumes OpenPGP messages
- Throws:
org.bouncycastle.openpgp.PGPException
- in case of an OpenPGP errorIOException
- in case of an IO error
-
create
protected static OpenPgpMessageInputStream create(@Nonnull InputStream inputStream, @Nonnull ConsumerOptions options, @Nonnull MessageMetadata.Layer metadata, @Nonnull Policy policy) throws IOException, org.bouncycastle.openpgp.PGPException - Throws:
IOException
org.bouncycastle.openpgp.PGPException
-
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
getMetadata
Description copied from class:DecryptionStream
Returnmetadata
about the decrypted / verified message. TheDecryptionStream
MUST be closed viaInputStream.close()
before the metadata object can be accessed.- Specified by:
getMetadata
in classDecryptionStream
- Returns:
- message metadata
-