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

Quick Search    Search Deep

cryptix.jce.provider.cipher
Class Padding  view Padding download Padding.java

java.lang.Object
  extended bycryptix.jce.provider.cipher.Padding
Direct Known Subclasses:
PaddingNone, PaddingPKCS5

abstract class Padding
extends java.lang.Object

A fully constructed Cipher instance looks like this:

 +------------------------------------------+
 | CipherSpi (API methods)                  |
 |                                          |
 | +--------------------------------------+ |
 | | Padding                              | |
 | |                                      | |
 | | +----------------------------------+ | |
 | | | Mode                             | | |
 | | |                                  | | |
 | | | +------------------------------+ | | |
 | | | | CipherSpi                    | | | |
 | | | | (blockcipher implementation) | | | |
 | | | |                              | | | |
 | | | +------------------------------+ | | |
 | | |                                  | | |
 | | +----------------------------------+ | |
 | |                                      | |
 | +--------------------------------------+ |
 |                                          |
 +------------------------------------------+
 

Version:
$Revision: 1.20 $

Field Summary
private  int blSize
           
protected  boolean decrypt
           
private  boolean isBuffered
           
private  Mode mode
          Cipher/Mode delegate
private  byte[] scratchBuf
           
 
Constructor Summary
(package private) Padding(Mode mode)
           
 
Method Summary
(package private) abstract  byte[] corePad(byte[] input, int inputLen)
           
(package private) abstract  int coreUnPad(byte[] input, int inputLen)
           
(package private)  int doFinal(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset)
           
(package private)  int getBlockSize()
          This method delegates to the wrapped Mode instance.
protected  int getBufSize()
           
(package private) static Padding getInstance(java.lang.String padding, Mode mode)
          Factory method for obtaining different padding type objects.
(package private)  byte[] getIV()
          This method delegates to the wrapped Mode instance.
(package private)  int getOutputSize(int inputLen)
           
(package private) abstract  int getPadSize(int inputLen)
           
(package private)  java.security.spec.AlgorithmParameterSpec getParamSpec()
          This method delegates to the wrapped Mode instance.
(package private)  void init(boolean decrypt, java.security.Key key, java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random)
          This method delegates to the wrapped Mode instance.
(package private)  int update(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset)
          This method delegates to the wrapped Mode instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mode

private final Mode mode
Cipher/Mode delegate


scratchBuf

private byte[] scratchBuf

blSize

private int blSize

isBuffered

private boolean isBuffered

decrypt

protected boolean decrypt
Constructor Detail

Padding

Padding(Mode mode)
Method Detail

getInstance

static Padding getInstance(java.lang.String padding,
                           Mode mode)
                    throws javax.crypto.NoSuchPaddingException
Factory method for obtaining different padding type objects. This method accept a padding name and a Mode instance and returns a Padding instance that wraps the given Mode instance. This class is package protected therefore the various padding types can be (and are) hardcoded here.


getBlockSize

final int getBlockSize()
This method delegates to the wrapped Mode instance.


getOutputSize

final int getOutputSize(int inputLen)

getParamSpec

final java.security.spec.AlgorithmParameterSpec getParamSpec()
This method delegates to the wrapped Mode instance.


getIV

final byte[] getIV()
This method delegates to the wrapped Mode instance.


init

final void init(boolean decrypt,
                java.security.Key key,
                java.security.spec.AlgorithmParameterSpec params,
                java.security.SecureRandom random)
         throws java.security.InvalidKeyException,
                java.security.InvalidAlgorithmParameterException
This method delegates to the wrapped Mode instance.


update

final int update(byte[] input,
                 int inputOffset,
                 int inputLen,
                 byte[] output,
                 int outputOffset)
          throws javax.crypto.ShortBufferException
This method delegates to the wrapped Mode instance.


doFinal

final int doFinal(byte[] input,
                  int inputOffset,
                  int inputLen,
                  byte[] output,
                  int outputOffset)
           throws javax.crypto.ShortBufferException,
                  javax.crypto.IllegalBlockSizeException,
                  javax.crypto.BadPaddingException

getBufSize

protected int getBufSize()

corePad

abstract byte[] corePad(byte[] input,
                        int inputLen)
                 throws javax.crypto.IllegalBlockSizeException

coreUnPad

abstract int coreUnPad(byte[] input,
                       int inputLen)
                throws javax.crypto.BadPaddingException

getPadSize

abstract int getPadSize(int inputLen)