org.logi.crypto.padding
Class PadZero

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

public class PadZero
extends java.lang.Object
implements Padding

This class implements padding with zero-bytes. This means that the plaintext is padded with zero bytes until it is a whole multiple of plaintext blocks in length. There is no information included which allows proper un-padding so the pad-bytes will be returned along with the actual plaintext data in unPad.

Author:
Logi Ragnarsson (logir@logi.org)
See Also:
Crypto.fromString(String)

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

Constructor Detail

PadZero

public PadZero()
Method Detail

pad

public byte[] pad(byte[] plaintext,
                  int off,
                  int len,
                  EncryptionKey key)
           throws PaddingException
Pad the last, perhaps partial, block of plaintext by appending a string of zeroes.
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[] padded,
                    int off,
                    int len,
                    DecryptionKey key)
             throws PaddingException
Pad the last, perhaps partial, 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