tribble.crypto
Class NullCipherSpi

java.lang.Object
  extended byjavax.crypto.CipherSpi
      extended bytribble.crypto.CipherSpi
          extended bytribble.crypto.BlockCipherSpi
              extended bytribble.crypto.NullCipherSpi

public final class NullCipherSpi
extends BlockCipherSpi

Null block cipher. Implements a null cryptographic cipher which does not do any actual encrypting of data.

Since:
2005-04-25
Version:
API 2, $Revision: 1.2 $ $Date: 2005/09/11 04:08:24 $
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.BlockCipherSpi
SERIES
 
Fields inherited from class tribble.crypto.CipherSpi
DECRYPT_MODE, ENCRYPT_MODE, MODE_BC, MODE_CBC, MODE_CFB, MODE_CFB8, MODE_CTR, MODE_CTR8, MODE_ECB, MODE_OFB, MODE_OFB8, MODE_PBC, MODE_PCBC, MODE_PFB, MODE_PFB8, PADDING_CTS, PADDING_NONE, PADDING_PKCS5, PADDING_ZEROS
 
Constructor Summary
NullCipherSpi()
          Default constructor.
 
Method Summary
protected  void blockDecrypt(byte[] in, int inOff, byte[] out, int outOff)
          Decrypt exactly one block of plaintext.
protected  void blockEncrypt(byte[] in, int inOff, byte[] out, int outOff)
          Encrypt exactly one block of plaintext.
protected  void initialize(byte[] key, boolean decrypt)
          Initialize this cipher.
static void main(java.lang.String[] args)
          Test driver.
 
Methods inherited from class tribble.crypto.BlockCipherSpi
engineClear, engineDoFinal, engineGetKeySize, engineGetOutputSize, engineGetParameters, engineInit, engineInit, engineInit, engineSetMode, engineSetPadding, engineUnwrap, engineUpdate, engineWrap
 
Methods inherited from class tribble.crypto.CipherSpi
engineDoFinal, engineGetBlockSize, engineGetIV, engineGetKeySize, engineSetIV, engineUpdate, finalize
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NullCipherSpi

public NullCipherSpi()
              throws java.security.NoSuchAlgorithmException,
                     javax.crypto.NoSuchPaddingException
Default constructor.

Throws:
java.security.NoSuchAlgorithmException - Never thrown.
javax.crypto.NoSuchPaddingException - Never thrown.
Since:
1.1, 2005-04-25
Method Detail

main

public static final void main(java.lang.String[] args)
                       throws java.lang.Exception
Test driver.

Parameters:
args - Command line arguments.
Throws:
java.lang.Exception - Thrown if an error occurs in the encryption engine.
Since:
1.1, 2005-04-25

initialize

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

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-04-25

blockEncrypt

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

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-04-25
See Also:
blockDecrypt(), initialize()

blockDecrypt

protected void blockDecrypt(byte[] in,
                            int inOff,
                            byte[] out,
                            int outOff)
Decrypt exactly one block of plaintext.

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-04-25
See Also:
blockEncrypt(), initialize()