Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

gnu.javax.crypto.jce.cipher
Class Cast5Spi  view Cast5Spi download Cast5Spi.java

java.lang.Object
  extended byjavax.crypto.CipherSpi
      extended bygnu.javax.crypto.jce.cipher.CipherAdapter
          extended bygnu.javax.crypto.jce.cipher.Cast5Spi

public class Cast5Spi
extends CipherAdapter

The implementation of the CAST5 (a.k.a. CAST-128) Service Provider Interface (SPI) Adapter.

Version:
Revision: $

Field Summary
protected  java.util.Map attributes
          Our attributes map.
protected  int blockLen
          The length of blocks we are processing.
protected  gnu.javax.crypto.cipher.IBlockCipher cipher
          Our cipher instance.
protected  int keyLen
          The current key size.
protected  gnu.javax.crypto.mode.IMode mode
          Our mode instance.
protected  gnu.javax.crypto.pad.IPad pad
          Our padding instance.
protected  byte[] partBlock
          An incomplete block.
protected  int partLen
          The number of bytes in CipherAdapter.partBlock 55 .
 
Constructor Summary
Cast5Spi()
           
 
Method Summary
protected  byte[] engineDoFinal(byte[] input, int off, int len)
          Finishes a multi-part transformation or transforms a portion of a byte array, and returns the transformed bytes.
protected  int engineDoFinal(byte[] in, int inOff, int inLen, byte[] out, int outOff)
          Finishes a multi-part transformation or transforms a portion of a byte array, and stores the transformed bytes in the supplied array.
protected  int engineGetBlockSize()
          Returns the block size of the underlying cipher.
protected  byte[] engineGetIV()
          Returns the initializaiton vector this cipher was initialized with, if any.
protected  int engineGetOutputSize(int inputLen)
          Returns the size, in bytes, an output buffer must be for a call to CipherAdapter.engineUpdate(byte[],int,int,byte[],int) 55 or CipherAdapter.engineDoFinal(byte[],int,int,byte[],int) 55 to succeed.
protected  java.security.AlgorithmParameters engineGetParameters()
          Returns the parameters that this cipher is using.
protected  void engineInit(int opmode, java.security.Key key, java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random)
          Initializes this cipher with an operation mode, key, parameters, and source of randomness.
protected  void engineInit(int opmode, java.security.Key key, java.security.AlgorithmParameters params, java.security.SecureRandom random)
          Initializes this cipher with an operation mode, key, parameters, and source of randomness.
protected  void engineInit(int opmode, java.security.Key key, java.security.SecureRandom random)
          Initializes this cipher with an operation mode, key, and source of randomness.
protected  void engineSetMode(java.lang.String modeName)
          Set the mode in which this cipher is to run.
protected  void engineSetPadding(java.lang.String padName)
          Set the method with which the input is to be padded.
protected  byte[] engineUpdate(byte[] input, int off, int len)
          Continue with a multi-part transformation, returning a new array of the transformed bytes.
protected  int engineUpdate(byte[] in, int inOff, int inLen, byte[] out, int outOff)
          Continue with a multi-part transformation, storing the transformed bytes into the specified array.
 
Methods inherited from class javax.crypto.CipherSpi
engineDoFinal, engineGetKeySize, engineUnwrap, engineUpdate, engineWrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cipher

protected gnu.javax.crypto.cipher.IBlockCipher cipher
Our cipher instance.


mode

protected gnu.javax.crypto.mode.IMode mode
Our mode instance.


pad

protected gnu.javax.crypto.pad.IPad pad
Our padding instance.


keyLen

protected int keyLen
The current key size.


attributes

protected java.util.Map attributes
Our attributes map.


partBlock

protected byte[] partBlock
An incomplete block.


partLen

protected int partLen
The number of bytes in CipherAdapter.partBlock 55 .


blockLen

protected int blockLen
The length of blocks we are processing.

Constructor Detail

Cast5Spi

public Cast5Spi()
Method Detail

engineSetMode

protected void engineSetMode(java.lang.String modeName)
                      throws java.security.NoSuchAlgorithmException
Description copied from class: javax.crypto.CipherSpi
Set the mode in which this cipher is to run.


engineSetPadding

protected void engineSetPadding(java.lang.String padName)
                         throws javax.crypto.NoSuchPaddingException
Description copied from class: javax.crypto.CipherSpi
Set the method with which the input is to be padded.


engineGetBlockSize

protected int engineGetBlockSize()
Description copied from class: javax.crypto.CipherSpi
Returns the block size of the underlying cipher.


engineGetOutputSize

protected int engineGetOutputSize(int inputLen)
Description copied from class: javax.crypto.CipherSpi

Returns the size, in bytes, an output buffer must be for a call to CipherSpi.engineUpdate(byte[],int,int,byte[],int)>CipherSpi.engineUpdate(byte[],int,int,byte[],int) 55 or CipherSpi.engineDoFinal(byte[],int,int,byte[],int)>CipherSpi.engineDoFinal(byte[],int,int,byte[],int) 55 to succeed.

The actual output length may be smaller than the value returned by this method, as it considers the padding length as well. The length considered is the argument plus the length of any buffered, unprocessed bytes.


engineGetIV

protected byte[] engineGetIV()
Description copied from class: javax.crypto.CipherSpi
Returns the initializaiton vector this cipher was initialized with, if any.


engineGetParameters

protected java.security.AlgorithmParameters engineGetParameters()
Description copied from class: javax.crypto.CipherSpi
Returns the parameters that this cipher is using. This may be the parameters used to initialize this cipher, or it may be parameters that have been initialized with random values.


engineInit

protected void engineInit(int opmode,
                          java.security.Key key,
                          java.security.SecureRandom random)
                   throws java.security.InvalidKeyException
Description copied from class: javax.crypto.CipherSpi
Initializes this cipher with an operation mode, key, and source of randomness. If this cipher requires any other initializing data, for example an initialization vector, then it should generate it from the provided source of randomness.


engineInit

protected void engineInit(int opmode,
                          java.security.Key key,
                          java.security.spec.AlgorithmParameterSpec params,
                          java.security.SecureRandom random)
                   throws java.security.InvalidKeyException,
                          java.security.InvalidAlgorithmParameterException
Description copied from class: javax.crypto.CipherSpi
Initializes this cipher with an operation mode, key, parameters, and source of randomness. If this cipher requires any other initializing data, for example an initialization vector, then it should generate it from the provided source of randomness.


engineInit

protected void engineInit(int opmode,
                          java.security.Key key,
                          java.security.AlgorithmParameters params,
                          java.security.SecureRandom random)
                   throws java.security.InvalidKeyException,
                          java.security.InvalidAlgorithmParameterException
Description copied from class: javax.crypto.CipherSpi
Initializes this cipher with an operation mode, key, parameters, and source of randomness. If this cipher requires any other initializing data, for example an initialization vector, then it should generate it from the provided source of randomness.


engineUpdate

protected byte[] engineUpdate(byte[] input,
                              int off,
                              int len)
Description copied from class: javax.crypto.CipherSpi
Continue with a multi-part transformation, returning a new array of the transformed bytes.


engineUpdate

protected int engineUpdate(byte[] in,
                           int inOff,
                           int inLen,
                           byte[] out,
                           int outOff)
                    throws javax.crypto.ShortBufferException
Description copied from class: javax.crypto.CipherSpi
Continue with a multi-part transformation, storing the transformed bytes into the specified array.


engineDoFinal

protected byte[] engineDoFinal(byte[] input,
                               int off,
                               int len)
                        throws javax.crypto.IllegalBlockSizeException,
                               javax.crypto.BadPaddingException
Description copied from class: javax.crypto.CipherSpi
Finishes a multi-part transformation or transforms a portion of a byte array, and returns the transformed bytes.


engineDoFinal

protected int engineDoFinal(byte[] in,
                            int inOff,
                            int inLen,
                            byte[] out,
                            int outOff)
                     throws javax.crypto.BadPaddingException,
                            javax.crypto.IllegalBlockSizeException,
                            javax.crypto.ShortBufferException
Description copied from class: javax.crypto.CipherSpi
Finishes a multi-part transformation or transforms a portion of a byte array, and stores the transformed bytes in the supplied array.