For example, if the Cipher is initialized for decryption, the CipherInputStream will attempt to read in data and decrypt them, before returning the decrypted data.
| Modifier and Type | Field and Description |
|---|---|
| private AEADBlockCipher | |
| private byte[] | |
| private BufferedBlockCipher | |
| private int | |
| private boolean | |
| private byte[] | |
| private static final int | |
| private byte[] | |
| private int | |
| private long | |
| private int | |
| private SkippingCipher | |
| private StreamCipher |
| Access | Constructor and Description |
|---|---|
| public | CipherInputStream(InputStream is, BufferedBlockCipher cipher)
Constructs a CipherInputStream from an InputStream and a BufferedBlockCipher. |
| public | CipherInputStream(InputStream is, StreamCipher cipher)
Constructs a CipherInputStream from an InputStream and a StreamCipher. |
| public | CipherInputStream(InputStream is, AEADBlockCipher cipher)
Constructs a CipherInputStream from an InputStream and an AEADBlockCipher. |
| public | CipherInputStream(InputStream is, BufferedBlockCipher cipher, int bufSize)
Constructs a CipherInputStream from an InputStream, a BufferedBlockCipher, and a specified internal buffer size. |
| public | CipherInputStream(InputStream is, StreamCipher cipher, int bufSize)
Constructs a CipherInputStream from an InputStream, a StreamCipher, and a specified internal buffer size. |
| public | CipherInputStream(InputStream is, AEADBlockCipher cipher, int bufSize)
Constructs a CipherInputStream from an InputStream, an AEADBlockCipher, and a specified internal buffer size. |
| Modifier and Type | Method and Description |
|---|---|
| public int | available()
Overrides java. Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream. |
| public void | close()
Overrides java. Implements java. Closes the underlying input stream and finalises the processing of the data by the cipher. |
| private void | ensureCapacity(int
the size of the pending update. updateSize, boolean true iff this the cipher is to be finalised.Ensure the cipher text buffer has space sufficient to accept an upcoming output. |
| private void | |
| public void | mark(int
the maximum read ahead required before a reset() may be called. readlimit)Overrides java. Mark the current position. |
| public boolean | Returns: true if mark(readlimit) supported, false otherwise.Overrides java. Return true if mark(readlimit) is supported. |
| private int | Returns: -1 to indicate end of stream, or the number of bytes (> 0) available.Read data from underlying stream and process with cipher until end of stream or some data is available after cipher processing. |
| public int | read()
Overrides java. Reads data from the underlying stream and processes it with the cipher until the cipher outputs data, and returns the next available byte. |
| public int | Returns: the total number of bytes read into the buffer, or-1 if there is no
more data because the end of the stream has been reached.the buffer into which the data is read. b)Overrides java. Reads data from the underlying stream and processes it with the cipher until the cipher
outputs data, and then returns up to |
| public int | Returns: the total number of bytes read into the buffer, or-1 if there is no
more data because the end of the stream has been reached.the buffer into which the data is read. b, int the start offset in the destination array off, int bthe maximum number of bytes read. len)Overrides java. Reads data from the underlying stream and processes it with the cipher until the cipher
outputs data, and then returns up to |
| public void | |
| public long | skip(long
the number of bytes to be skipped. n)Overrides java. Skips over and discards |
| aeadBlockCipher | back to summary |
|---|---|
| private AEADBlockCipher aeadBlockCipher | |
| buf | back to summary |
|---|---|
| private byte[] buf | |
| bufferedBlockCipher | back to summary |
|---|---|
| private BufferedBlockCipher bufferedBlockCipher | |
| bufOff | back to summary |
|---|---|
| private int bufOff | |
| finalized | back to summary |
|---|---|
| private boolean finalized | |
| inBuf | back to summary |
|---|---|
| private byte[] inBuf | |
| INPUT_BUF_SIZE | back to summary |
|---|---|
| private static final int INPUT_BUF_SIZE | |
| markBuf | back to summary |
|---|---|
| private byte[] markBuf | |
| markBufOff | back to summary |
|---|---|
| private int markBufOff | |
| markPosition | back to summary |
|---|---|
| private long markPosition | |
| maxBuf | back to summary |
|---|---|
| private int maxBuf | |
| skippingCipher | back to summary |
|---|---|
| private SkippingCipher skippingCipher | |
| streamCipher | back to summary |
|---|---|
| private StreamCipher streamCipher | |
| CipherInputStream | back to summary |
|---|---|
| public CipherInputStream(InputStream is, BufferedBlockCipher cipher) Constructs a CipherInputStream from an InputStream and a BufferedBlockCipher. | |
| CipherInputStream | back to summary |
|---|---|
| public CipherInputStream(InputStream is, StreamCipher cipher) Constructs a CipherInputStream from an InputStream and a StreamCipher. | |
| CipherInputStream | back to summary |
|---|---|
| public CipherInputStream(InputStream is, AEADBlockCipher cipher) Constructs a CipherInputStream from an InputStream and an AEADBlockCipher. | |
| CipherInputStream | back to summary |
|---|---|
| public CipherInputStream(InputStream is, BufferedBlockCipher cipher, int bufSize) Constructs a CipherInputStream from an InputStream, a BufferedBlockCipher, and a specified internal buffer size. | |
| CipherInputStream | back to summary |
|---|---|
| public CipherInputStream(InputStream is, StreamCipher cipher, int bufSize) Constructs a CipherInputStream from an InputStream, a StreamCipher, and a specified internal buffer size. | |
| CipherInputStream | back to summary |
|---|---|
| public CipherInputStream(InputStream is, AEADBlockCipher cipher, int bufSize) Constructs a CipherInputStream from an InputStream, an AEADBlockCipher, and a specified internal buffer size. | |
| available | back to summary |
|---|---|
| public int available() throws IOException Overrides java. Doc from java. Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream. The next caller might be the same thread or another thread. A single read or skip of this many bytes will not block, but may read or skip fewer bytes.
| |
| close | back to summary |
|---|---|
| public void close() throws IOException Overrides java. Implements java. Closes the underlying input stream and finalises the processing of the data by the cipher.
| |
| ensureCapacity | back to summary |
|---|---|
| private void ensureCapacity(int updateSize, boolean finalOutput) Ensure the cipher text buffer has space sufficient to accept an upcoming output.
| |
| finaliseCipher | back to summary |
|---|---|
| private void finaliseCipher() throws IOException | |
| mark | back to summary |
|---|---|
| public void mark(int readlimit) Overrides java. Mark the current position. This method only works if markSupported() returns true - which means the underlying stream supports marking, and the cipher passed in to this stream's constructor is a SkippingCipher (so capable of being reset to an arbitrary point easily).
| |
| markSupported | back to summary |
|---|---|
| public boolean markSupported() Overrides java. Return true if mark(readlimit) is supported. This will be true if the underlying stream supports marking and the cipher used is a SkippingCipher,
| |
| nextChunk | back to summary |
|---|---|
| private int nextChunk() throws IOException Read data from underlying stream and process with cipher until end of stream or some data is available after cipher processing.
| |
| read | back to summary |
|---|---|
| public int read() throws IOException Overrides java. Reads data from the underlying stream and processes it with the cipher until the cipher outputs data, and returns the next available byte. If the underlying stream is exhausted by this call, the cipher will be finalised.
| |
| read | back to summary |
|---|---|
| public int read(byte[] b) throws IOException Overrides java. Reads data from the underlying stream and processes it with the cipher until the cipher
outputs data, and then returns up to If the underlying stream is exhausted by this call, the cipher will be finalised.
| |
| read | back to summary |
|---|---|
| public int read(byte[] b, int off, int len) throws IOException Overrides java. Reads data from the underlying stream and processes it with the cipher until the cipher
outputs data, and then returns up to If the underlying stream is exhausted by this call, the cipher will be finalised.
| |
| reset | back to summary |
|---|---|
| public void reset() throws IOException Overrides java. Reset to the last marked position, if supported.
| |
| skip | back to summary |
|---|---|
| public long skip(long n) throws IOException Overrides java. Doc from java. Skips over and discards
| |