tribble.crypto
Class NullCipher

java.lang.Object
  extended bytribble.crypto.AbstractCipher
      extended bytribble.crypto.SymmetricCipher
          extended bytribble.crypto.NullCipher

public final class NullCipher
extends SymmetricCipher

Null block cipher. Implements a symmetric block cipher that does not actually perform any encrypting or decrypting (i.e., it simply copies each input block to its output).

Since:
2005-04-25
Version:
$Revision: 1.2 $ $Date: 2005/07/06 03:09:00 $
Author:
David R. Tribble (david@tribble.com).

Copyright ©2005 by David R. Tribble, all rights reserved.
Permission is granted to freely use and distribute this source code provided that the original copyright and authorship notices remain intact.


Field Summary
 
Fields inherited from class tribble.crypto.SymmetricCipher
m_blockLen
 
Fields inherited from class tribble.crypto.AbstractCipher
m_alg, m_decrypt, m_init, m_keyLen
 
Constructor Summary
NullCipher()
          Default constructor.
 
Method Summary
protected  void blockDecrypt(byte[] in, int inOff, byte[] out, int outOff)
          Decrypt a block of ciphertext.
protected  void blockEncrypt(byte[] in, int inOff, byte[] out, int outOff)
          Encrypt a block of plaintext.
protected  void clear()
          Reset this cipher, wiping all sensitive information.
protected  void initialize(byte[] key, boolean decrypt)
          Initialize this cipher.
 
Methods inherited from class tribble.crypto.SymmetricCipher
getBlockSize, test, test
 
Methods inherited from class tribble.crypto.AbstractCipher
finalize, getAlgorithm, getKeySize, getKeySizes
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NullCipher

public NullCipher()
Default constructor.

Since:
1.1, 2005-07-05
Method Detail

initialize

protected void initialize(byte[] key,
                          boolean decrypt)
                   throws java.security.InvalidKeyException
Initialize this cipher.

Specified by:
initialize in class AbstractCipher
Parameters:
key - The symmetric (secret) key for this cipher.
decrypt - If true, this indicates that this cipher is to be initialized for decrypting, otherwise it is to be initialized for encrypting.
Throws:
java.security.InvalidKeyException
Since:
1.1, 2005-07-05
See Also:
clear()

clear

protected void clear()
Reset this cipher, wiping all sensitive information.

This method will be called after this cipher object is no longer needed. It should overwrite any sensitive data contained within this object (e.g., encryption key schedules). This cipher object can no longer be used after this method has been called.

Specified by:
clear in class AbstractCipher
Since:
1.1, 2005-07-05
See Also:
initialize()

blockEncrypt

protected void blockEncrypt(byte[] in,
                            int inOff,
                            byte[] out,
                            int outOff)
Encrypt a block of plaintext.

Specified by:
blockEncrypt in class SymmetricCipher
Parameters:
in - Array containing a single block of plaintext bytes to encrypt. The length of the block is exactly equal to the cipher block size.
inOff - Index of the first byte of the plaintext block within array in to encrypt.
out - Array that will be filled with the encrypted ciphertext block. The length of the block is exactly equal to the cipher block size.
outOff - Index of the first byte of array out to fill with the encrypted ciphertext block.
Since:
1.1, 2005-07-05
See Also:
blockDecrypt(byte[], int, byte[], int)

blockDecrypt

protected void blockDecrypt(byte[] in,
                            int inOff,
                            byte[] out,
                            int outOff)
Decrypt a block of ciphertext.

Specified by:
blockDecrypt in class SymmetricCipher
Parameters:
in - Array containing a single block of ciphertext bytes to decrypt. The length of the block is exactly equal to the cipher block size.
inOff - Index of the first byte of the ciphertext block within array in to decrypt.
out - Array that will be filled with the decrypted plaintext block. The length of the block is exactly equal to the cipher block size.
outOff - Index of the first byte of array out to fill with the decrypted plaintext block.
Since:
1.1, 2005-07-05
See Also:
blockEncrypt(byte[], int, byte[], int)