Class TeeBCPGInputStream
- java.lang.Object
-
- org.pgpainless.decryption_verification.TeeBCPGInputStream
-
public class TeeBCPGInputStream extends java.lang.Object
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 overrideBCPGInputStream.read()
to tee the data out though, sinceBCPGInputStream.readPacket()
inconsistently calls a mix ofBCPGInputStream.read()
andInputStream.read()
of the underlying stream. This would cause the second length byte to get swallowed up. Therefore, this class delegates the teeing to anTeeBCPGInputStream.DelayedTeeInputStream
which wraps the underlying stream. Since callingBCPGInputStream.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 theTeeBCPGInputStream
handle pushing this byte to the output stream usingTeeBCPGInputStream.DelayedTeeInputStream.squeeze()
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TeeBCPGInputStream.DelayedTeeInputStream
-
Field Summary
Fields Modifier and Type Field Description protected TeeBCPGInputStream.DelayedTeeInputStream
delayedTee
protected org.bouncycastle.bcpg.BCPGInputStream
packetInputStream
-
Constructor Summary
Constructors Constructor Description TeeBCPGInputStream(org.bouncycastle.bcpg.BCPGInputStream inputStream, java.io.OutputStream outputStream)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
OpenPgpPacket
nextPacketTag()
org.bouncycastle.openpgp.PGPCompressedData
readCompressedData()
org.bouncycastle.openpgp.PGPEncryptedDataList
readEncryptedDataList()
org.bouncycastle.openpgp.PGPLiteralData
readLiteralData()
org.bouncycastle.bcpg.MarkerPacket
readMarker()
org.bouncycastle.openpgp.PGPOnePassSignature
readOnePassSignature()
org.bouncycastle.bcpg.Packet
readPacket()
org.bouncycastle.openpgp.PGPSignature
readSignature()
-
-
-
Field Detail
-
delayedTee
protected final TeeBCPGInputStream.DelayedTeeInputStream delayedTee
-
packetInputStream
protected final org.bouncycastle.bcpg.BCPGInputStream packetInputStream
-
-
Method Detail
-
nextPacketTag
public OpenPgpPacket nextPacketTag() throws java.io.IOException
- Throws:
java.io.IOException
-
readPacket
public org.bouncycastle.bcpg.Packet readPacket() throws java.io.IOException
- Throws:
java.io.IOException
-
readCompressedData
public org.bouncycastle.openpgp.PGPCompressedData readCompressedData() throws java.io.IOException
- Throws:
java.io.IOException
-
readLiteralData
public org.bouncycastle.openpgp.PGPLiteralData readLiteralData() throws java.io.IOException
- Throws:
java.io.IOException
-
readEncryptedDataList
public org.bouncycastle.openpgp.PGPEncryptedDataList readEncryptedDataList() throws java.io.IOException
- Throws:
java.io.IOException
-
readOnePassSignature
public org.bouncycastle.openpgp.PGPOnePassSignature readOnePassSignature() throws org.bouncycastle.openpgp.PGPException, java.io.IOException
- Throws:
org.bouncycastle.openpgp.PGPException
java.io.IOException
-
readSignature
public org.bouncycastle.openpgp.PGPSignature readSignature() throws org.bouncycastle.openpgp.PGPException, java.io.IOException
- Throws:
org.bouncycastle.openpgp.PGPException
java.io.IOException
-
readMarker
public org.bouncycastle.bcpg.MarkerPacket readMarker() throws java.io.IOException
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Throws:
java.io.IOException
-
-