Class 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 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().
    • Constructor Detail

      • TeeBCPGInputStream

        public TeeBCPGInputStream​(org.bouncycastle.bcpg.BCPGInputStream inputStream,
                                  java.io.OutputStream outputStream)
    • 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