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

Quick Search    Search Deep

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

java.lang.Object
  extended bycryptix.jce.provider.cipher.Padding
      extended bycryptix.jce.provider.cipher.PaddingPKCS5

final class PaddingPKCS5
extends Padding

This class implements generalized PKCS#5 padding.

PKCS#5 padding is described in RSA Labs' PKCS#5 document. Their version is defined for 8 byte (64 bit) blocksizes only. This implementation handles blocksizes up to 255 bytes, hence 'Generalized PKCS#5'. This generalization is completely compatible with the original 8-byte-only PKCS#5.

http://www.rsasecurity.com/rsalabs/pkcs/pkcs-5/index.html

Version:
$Revision: 1.10 $

Field Summary
protected  boolean decrypt
           
 
Constructor Summary
(package private) PaddingPKCS5(Mode mode)
           
 
Method Summary
(package private)  byte[] corePad(byte[] input, int inputLen)
           
(package private)  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)  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

decrypt

protected boolean decrypt
Constructor Detail

PaddingPKCS5

PaddingPKCS5(Mode mode)
Method Detail

corePad

final byte[] corePad(byte[] input,
                     int inputLen)
              throws javax.crypto.IllegalBlockSizeException
Specified by:
corePad in class Padding

coreUnPad

final int coreUnPad(byte[] input,
                    int inputLen)
             throws javax.crypto.BadPaddingException
Specified by:
coreUnPad in class Padding

getPadSize

final int getPadSize(int inputLen)
Specified by:
getPadSize in class Padding

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()