org.logi.crypto.padding
Class PadNone

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

public class PadNone
extends java.lang.Object
implements Padding

This class implements non-padding. If it is asked to add padding to a block of plaintext it will throw an exception, but if the last block is a complete block, then it is simply passed through.

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

Constructor Summary
PadNone()
           
 
Method Summary
 byte[] pad(byte[] plaintext, int off, int len, EncryptionKey key)
          Pass whole blocks of plaintext through, but throw exception on partial blocks.
 byte[] unPad(byte[] padded, int off, int len, DecryptionKey key)
          Pass whole blocks of plaintext through, but throw exception on partial blocks.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PadNone

public PadNone()
Method Detail

pad

public byte[] pad(byte[] plaintext,
                  int off,
                  int len,
                  EncryptionKey key)
           throws PaddingException
Pass whole blocks of plaintext through, but throw exception on partial blocks.
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
Pass whole blocks of plaintext through, but throw exception on partial blocks.
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