Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.1.0

E22843-01


com.tangosol.net.security
Class BlockCipherInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by com.tangosol.net.security.BlockCipherInputStream

All Implemented Interfaces:
java.io.Closeable

public class BlockCipherInputStream
extends java.io.FilterInputStream

InputStream which supports block ciphers, and data sizes which exceed the Cipher's block size.

Author:
mf 2006.08.08

Field Summary
static byte[] EMPTY_BYTE_ARRAY
          Initial value for m_abBlockClear
protected  byte[] m_abBlockClear
          The current block of unencrypted data
protected  byte[] m_abBlockEncrypted
          The current block of encrypted data
protected  javax.crypto.Cipher m_cipher
          The Cipher to use to decrypt data
protected  boolean m_fEof
          Marker indicating if the end of the wrapped stream has been reached
protected  int m_nBlockIndex
          The index into the next unread byte of unencrypted data
protected  int m_nBlockSize
          The Cipher's block size

 

Fields inherited from class java.io.FilterInputStream
in

 

Constructor Summary
BlockCipherInputStream(java.io.InputStream stream, javax.crypto.Cipher cipher)
          Construct a BlockCipherInputStream around the supplied stream and decrypt output data with the supplied cipher.
BlockCipherInputStream(java.io.InputStream stream, javax.crypto.Cipher cipher, int cbBlock)
          Construct a BlockCipherInputStream around the supplied stream and decrypt output data with the supplied cipher.

 

Method Summary
 int available()
          
protected  int ensureData()
          Ensure that there is some data available for read, blocking on the wrapped stream if necessary.
 boolean markSupported()
          
 int read()
          
 int read(byte[] abData)
          
 int read(byte[] abData, int nOffset, int nLength)
          
 long skip(long lBytes)
          

 

Methods inherited from class java.io.FilterInputStream
close, mark, reset

 

Field Detail

m_cipher

protected javax.crypto.Cipher m_cipher
The Cipher to use to decrypt data

m_nBlockSize

protected int m_nBlockSize
The Cipher's block size

m_abBlockEncrypted

protected byte[] m_abBlockEncrypted
The current block of encrypted data

m_abBlockClear

protected byte[] m_abBlockClear
The current block of unencrypted data

m_nBlockIndex

protected int m_nBlockIndex
The index into the next unread byte of unencrypted data

m_fEof

protected boolean m_fEof
Marker indicating if the end of the wrapped stream has been reached

EMPTY_BYTE_ARRAY

public static final byte[] EMPTY_BYTE_ARRAY
Initial value for m_abBlockClear

Constructor Detail

BlockCipherInputStream

public BlockCipherInputStream(java.io.InputStream stream,
                              javax.crypto.Cipher cipher)
Construct a BlockCipherInputStream around the supplied stream and decrypt output data with the supplied cipher.
Parameters:
stream - the stream to read encrypted data to
cipher - the cipher to use to decrypt data

BlockCipherInputStream

public BlockCipherInputStream(java.io.InputStream stream,
                              javax.crypto.Cipher cipher,
                              int cbBlock)
Construct a BlockCipherInputStream around the supplied stream and decrypt output data with the supplied cipher.
Parameters:
stream - the stream to read encrypted data to
cipher - the cipher to use to decrypt data
cbBlock - the size of an encrypted block required by the cipher

Method Detail

read

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

read

public int read(byte[] abData)
         throws java.io.IOException
Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException

read

public int read(byte[] abData,
                int nOffset,
                int nLength)
         throws java.io.IOException
Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException

skip

public long skip(long lBytes)
          throws java.io.IOException
Overrides:
skip in class java.io.FilterInputStream
Throws:
java.io.IOException

available

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

markSupported

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

ensureData

protected int ensureData()
                  throws java.io.IOException
Ensure that there is some data available for read, blocking on the wrapped stream if necessary. As a side effect a call to this method may change m_abBlockClear and m_nBlockIndex.
Returns:
the number of bytes now available
Throws:
java.io.IOException

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.1.0

E22843-01


Copyright © 2000, 2011, Oracle and/or its affiliates. All rights reserved.