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.InputStreamnestedInputStreamprotected ConsumerOptionsoptionsprotected TeeBCPGInputStreampacketInputStreamprotected PDAsyntaxVerifier
-
Constructor Summary
Constructors Modifier Constructor Description protectedOpenPgpMessageInputStream(java.io.InputStream inputStream, ConsumerOptions options, MessageMetadata.Layer metadata, Policy policy)protectedOpenPgpMessageInputStream(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 voidclose()static OpenPgpMessageInputStreamcreate(java.io.InputStream inputStream, ConsumerOptions options)Create anOpenPgpMessageInputStreamsuitable for decryption and verification of OpenPGP messages and signatures.protected static OpenPgpMessageInputStreamcreate(java.io.InputStream inputStream, ConsumerOptions options, MessageMetadata.Layer metadata, Policy policy)static OpenPgpMessageInputStreamcreate(java.io.InputStream inputStream, ConsumerOptions options, Policy policy)Create anOpenPgpMessageInputStreamsuitable for decryption and verification of OpenPGP messages and signatures.MessageMetadatagetMetadata()Returnmetadataabout the decrypted / verified message.intread()intread(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.PGPExceptionjava.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.PGPExceptionjava.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 anOpenPgpMessageInputStreamsuitable 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 anOpenPgpMessageInputStreamsuitable for decryption and verification of OpenPGP messages and signatures. This factory method takes a customPolicyinstead 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.IOExceptionorg.bouncycastle.openpgp.PGPException
-
read
public int read() throws java.io.IOException- Specified by:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(@Nonnull byte[] b, int off, int len) throws java.io.IOException- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream- Throws:
java.io.IOException
-
getMetadata
public MessageMetadata getMetadata()
Description copied from class:DecryptionStreamReturnmetadataabout the decrypted / verified message. TheDecryptionStreamMUST be closed viaInputStream.close()before the metadata object can be accessed.- Specified by:
getMetadatain classDecryptionStream- Returns:
- message metadata
-
-