de.flexiprovider.common.padding
Class NoPadding

java.lang.Object
  |
  +--de.flexiprovider.api.PaddingScheme
        |
        +--de.flexiprovider.common.padding.NoPadding

public class NoPadding
extends PaddingScheme

NoPadding leaves the input unchanged in case of a suitable blocksize. Otherwise, it will throw a BadPaddingException.

Author:
Andre Maric, Witold Wegner

Fields inherited from class de.flexiprovider.api.PaddingScheme
blockSize
 
Constructor Summary
NoPadding()
           
 
Method Summary
protected  void pad(byte[] input, int inOff, int inLen)
          Pad the input to make its length divisible by the the block length.
protected  int padLength(int inLen)
          Return the number of bytes which will be appended to the the plaintext during padding.
protected  int unpad(byte[] input, int inOff, int inLen)
          Given the plaintext that includes the padding bytes, unpad the plaintext and return the index indicating where the padding bytes start.
 
Methods inherited from class de.flexiprovider.api.PaddingScheme
setBlockSize
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NoPadding

public NoPadding()
Method Detail

padLength

protected int padLength(int inLen)
Description copied from class: PaddingScheme
Return the number of bytes which will be appended to the the plaintext during padding.
Overrides:
padLength in class PaddingScheme
Following copied from class: de.flexiprovider.api.PaddingScheme
Parameters:
inLen - the length of the plaintext to be padded
Returns:
the number of padding bytes (may be 0)

pad

protected void pad(byte[] input,
                   int inOff,
                   int inLen)
            throws BadPaddingException
Description copied from class: PaddingScheme
Pad the input to make its length divisible by the the block length. The padding is written to the same buffer which is used for input. The caller has to ensure that the input array is large enough to hold the padding bytes.
Overrides:
pad in class PaddingScheme
Following copied from class: de.flexiprovider.api.PaddingScheme
Parameters:
input - byte array containing the plaintext to be padded
inOff - index where the plaintext starts
inLen - length of the plaintext
Throws:
BadPaddingException - if the input buffer is too small to hold the padding bytes.

unpad

protected int unpad(byte[] input,
                    int inOff,
                    int inLen)
Description copied from class: PaddingScheme
Given the plaintext that includes the padding bytes, unpad the plaintext and return the index indicating where the padding bytes start.
Overrides:
unpad in class PaddingScheme
Following copied from class: de.flexiprovider.api.PaddingScheme
Parameters:
input - byte array containing the padded plaintext
inOff - index where the plaintext starts
inLen - size of the plaintext
Returns:
index in the array where the padding bytes start
Throws:
BadPaddingException - if unpadding fails.