Class TeeBCPGInputStream
java.lang.Object
org.pgpainless.decryption_verification.TeeBCPGInputStream
Since we need to update signatures with data from the underlying stream, this class is used to tee out the data.
Unfortunately we cannot simply override
BCPGInputStream.read()
to tee the data out though, since
BCPGInputStream.readPacket()
inconsistently calls a mix of BCPGInputStream.read()
and
InputStream.read()
of the underlying stream. This would cause the second length byte to get swallowed up.
Therefore, this class delegates the teeing to an TeeBCPGInputStream.DelayedTeeInputStream
which wraps the underlying
stream. Since calling BCPGInputStream.nextPacketTag()
reads up to and including the next packets tag,
we need to delay teeing out that byte to signature verifiers.
Hence, the reading methods of the TeeBCPGInputStream
handle pushing this byte to the output stream using
TeeBCPGInputStream.DelayedTeeInputStream.squeeze()
.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final TeeBCPGInputStream.DelayedTeeInputStream
protected final org.bouncycastle.bcpg.BCPGInputStream
-
Constructor Summary
ConstructorsConstructorDescriptionTeeBCPGInputStream
(org.bouncycastle.bcpg.BCPGInputStream inputStream, OutputStream outputStream) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
org.bouncycastle.openpgp.PGPCompressedData
org.bouncycastle.openpgp.PGPEncryptedDataList
org.bouncycastle.openpgp.PGPLiteralData
org.bouncycastle.bcpg.MarkerPacket
org.bouncycastle.openpgp.PGPOnePassSignature
org.bouncycastle.bcpg.Packet
org.bouncycastle.openpgp.PGPSignature
-
Field Details
-
delayedTee
-
packetInputStream
protected final org.bouncycastle.bcpg.BCPGInputStream packetInputStream
-
-
Constructor Details
-
TeeBCPGInputStream
public TeeBCPGInputStream(org.bouncycastle.bcpg.BCPGInputStream inputStream, OutputStream outputStream)
-
-
Method Details
-
nextPacketTag
- Throws:
IOException
-
readPacket
- Throws:
IOException
-
readCompressedData
- Throws:
IOException
-
readLiteralData
- Throws:
IOException
-
readEncryptedDataList
- Throws:
IOException
-
readOnePassSignature
public org.bouncycastle.openpgp.PGPOnePassSignature readOnePassSignature() throws org.bouncycastle.openpgp.PGPException, IOException- Throws:
org.bouncycastle.openpgp.PGPException
IOException
-
readSignature
public org.bouncycastle.openpgp.PGPSignature readSignature() throws org.bouncycastle.openpgp.PGPException, IOException- Throws:
org.bouncycastle.openpgp.PGPException
IOException
-
readMarker
- Throws:
IOException
-
close
- Throws:
IOException
-