org.logi.crypto.padding
Class PadPKCS5

java.lang.Object
  |
  +--org.logi.crypto.padding.PadPKCS5
All Implemented Interfaces:
Padding

public class PadPKCS5
extends java.lang.Object
implements Padding

This class implements PKCS#5 padding. See RFC 1423, section 1.1.

Author:
Logi Ragnarsson (logi@logi.org)

Constructor Summary
PadPKCS5()
           
 
Method Summary
 byte[] pad(byte[] plaintext, int off, int len, EncryptionKey key)
          Pad the last, perhaps partial, block of plaintext.
 byte[] unPad(byte[] plaintext, int off, int len, DecryptionKey key)
          Un-pad the last block of plaintext.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PadPKCS5

public PadPKCS5()
Method Detail

pad

public byte[] pad(byte[] plaintext,
                  int off,
                  int len,
                  EncryptionKey key)
           throws PaddingException
Pad the last, perhaps partial, block of plaintext.
Specified by:
pad in interface Padding
Parameters:
plaintext - The array holding plaintext data to pad.
off - The offset of data within plaintext array.
len - The length of data within plaintext array. This much be less than a single plaintext block.
key - The key which will be used to encrypt the block.

unPad

public byte[] unPad(byte[] plaintext,
                    int off,
                    int len,
                    DecryptionKey key)
             throws PaddingException
Un-pad the last block of plaintext.
Specified by:
unPad in interface Padding
Parameters:
padded - The array holding padded plaintext data.
off - The offset of data within padded array.
len - The length of data within padded array.
key - The key which will be used to decrypt the block.


Copyright (c) 1997-2001 Logi Ragnarsson - Distributed under the GPL