Class ChunkedCipherInputStream

    • Constructor Detail

      • ChunkedCipherInputStream

        public ChunkedCipherInputStream​(java.io.InputStream stream,
                                        long size,
                                        int chunkSize)
                                 throws java.security.GeneralSecurityException
        Throws:
        java.security.GeneralSecurityException
      • ChunkedCipherInputStream

        public ChunkedCipherInputStream​(java.io.InputStream stream,
                                        long size,
                                        int chunkSize,
                                        int initialPos)
                                 throws java.security.GeneralSecurityException
        Throws:
        java.security.GeneralSecurityException
    • Method Detail

      • initCipherForBlock

        public final javax.crypto.Cipher initCipherForBlock​(int block)
                                                     throws java.io.IOException,
                                                            java.security.GeneralSecurityException
        Throws:
        java.io.IOException
        java.security.GeneralSecurityException
      • read

        public int read()
                 throws java.io.IOException
        Overrides:
        read in class java.io.FilterInputStream
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] b,
                        int off,
                        int len)
                 throws java.io.IOException
        Overrides:
        read in class java.io.FilterInputStream
        Throws:
        java.io.IOException
      • skip

        public long skip​(long n)
        Overrides:
        skip in class java.io.FilterInputStream
      • markSupported

        public boolean markSupported()
        Overrides:
        markSupported in class java.io.FilterInputStream
      • mark

        public void mark​(int readlimit)
        Overrides:
        mark in class java.io.FilterInputStream
      • reset

        public void reset()
        Overrides:
        reset in class java.io.FilterInputStream
      • readPlain

        public void readPlain​(byte[] b,
                              int off,
                              int len)
        Used when BIFF header fields (sid, size) are being read. The internal Cipher instance must step even when unencrypted bytes are read
        Specified by:
        readPlain in interface LittleEndianInput
        Overrides:
        readPlain in class LittleEndianInputStream
        Parameters:
        b - the byte array to receive the bytes
        off - the start offset into the byte array
        len - the amount of bytes to fill
      • setNextRecordSize

        public void setNextRecordSize​(int recordSize)
        Some ciphers (actually just XOR) are based on the record size, which needs to be set before decryption
        Parameters:
        recordSize - the size of the next record
      • getPos

        public long getPos()
        Returns:
        the absolute position in the stream