Class OpenPgpMessageInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.pgpainless.decryption_verification.DecryptionStream
-
- org.pgpainless.decryption_verification.OpenPgpMessageInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class OpenPgpMessageInputStream extends DecryptionStream
-
-
Field Summary
Fields Modifier and Type Field Description protected java.io.InputStream
nestedInputStream
protected ConsumerOptions
options
protected TeeBCPGInputStream
packetInputStream
protected PDA
syntaxVerifier
-
Constructor Summary
Constructors Modifier Constructor Description protected
OpenPgpMessageInputStream(java.io.InputStream inputStream, ConsumerOptions options, MessageMetadata.Layer metadata, Policy policy)
protected
OpenPgpMessageInputStream(org.pgpainless.decryption_verification.OpenPgpMessageInputStream.Type type, java.io.InputStream inputStream, ConsumerOptions options, MessageMetadata.Layer metadata, Policy policy)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
static OpenPgpMessageInputStream
create(java.io.InputStream inputStream, ConsumerOptions options)
Create anOpenPgpMessageInputStream
suitable for decryption and verification of OpenPGP messages and signatures.protected static OpenPgpMessageInputStream
create(java.io.InputStream inputStream, ConsumerOptions options, MessageMetadata.Layer metadata, Policy policy)
static OpenPgpMessageInputStream
create(java.io.InputStream inputStream, ConsumerOptions options, Policy policy)
Create anOpenPgpMessageInputStream
suitable for decryption and verification of OpenPGP messages and signatures.MessageMetadata
getMetadata()
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
-
-
-
-
Field Detail
-
options
protected final ConsumerOptions options
-
syntaxVerifier
protected final PDA syntaxVerifier
-
packetInputStream
protected TeeBCPGInputStream packetInputStream
-
nestedInputStream
protected java.io.InputStream nestedInputStream
-
-
Constructor Detail
-
OpenPgpMessageInputStream
protected OpenPgpMessageInputStream(@Nonnull java.io.InputStream inputStream, @Nonnull ConsumerOptions options, @Nonnull MessageMetadata.Layer metadata, @Nonnull Policy policy) throws org.bouncycastle.openpgp.PGPException, java.io.IOException
- Throws:
org.bouncycastle.openpgp.PGPException
java.io.IOException
-
OpenPgpMessageInputStream
protected OpenPgpMessageInputStream(@Nonnull org.pgpainless.decryption_verification.OpenPgpMessageInputStream.Type type, @Nonnull java.io.InputStream inputStream, @Nonnull ConsumerOptions options, @Nonnull MessageMetadata.Layer metadata, @Nonnull Policy policy) throws org.bouncycastle.openpgp.PGPException, java.io.IOException
- Throws:
org.bouncycastle.openpgp.PGPException
java.io.IOException
-
-
Method Detail
-
create
public static OpenPgpMessageInputStream create(@Nonnull java.io.InputStream inputStream, @Nonnull ConsumerOptions options) throws java.io.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:
java.io.IOException
- in case of an IO errororg.bouncycastle.openpgp.PGPException
- in case of an OpenPGP error
-
create
public static OpenPgpMessageInputStream create(@Nonnull java.io.InputStream inputStream, @Nonnull ConsumerOptions options, @Nonnull Policy policy) throws org.bouncycastle.openpgp.PGPException, java.io.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 errorjava.io.IOException
- in case of an IO error
-
create
protected static OpenPgpMessageInputStream create(@Nonnull java.io.InputStream inputStream, @Nonnull ConsumerOptions options, @Nonnull MessageMetadata.Layer metadata, @Nonnull Policy policy) throws java.io.IOException, org.bouncycastle.openpgp.PGPException
- Throws:
java.io.IOException
org.bouncycastle.openpgp.PGPException
-
read
public int read() throws java.io.IOException
- Specified by:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read(@Nonnull byte[] b, int off, int len) throws java.io.IOException
- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.InputStream
- Throws:
java.io.IOException
-
getMetadata
public MessageMetadata 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
-
-