Oracle Security Developer Tools Crypto Java API Reference
10g Release 2 (10.1.2.0.2)

B15565-01


oracle.security.crypto.core
Class NullCipher

java.lang.Object
  extended byoracle.security.crypto.core.Coder
      extended byoracle.security.crypto.core.Cipher
          extended byoracle.security.crypto.core.NullCipher


public final class NullCipher
extends Cipher

A stream cipher that does not do any encoding.


Field Summary

Fields inherited from class oracle.security.crypto.core.Cipher
CBC, decryptionKey, ECB, encryptionKey, key, mode, NULL_PADDING, PKCS5_PADDING, rbs

Constructor Summary
NullCipher()

Method Summary
java.lang.String algName()
Returns "NullCipher".
int blockSize()
Deprecated. Use getBlockSize() instead.
byte[] decrypt(byte[] bytes, int offset, int length, boolean unpad)
A literal copy of bytes with no encryption/decryption.
void decrypt(byte[] bytes, int offset, int length, byte[] output, int outOff)
A literal copy of bytes with no encryption/decryption.
void decryptOp(byte[] in, int inOff, byte[] out, int outOff)
Deprecated. Use a decrypt method instead.
byte[] encrypt(byte[] bytes, int offset, int length, boolean pad)
A literal copy of bytes with no encryption/decryption.
void encrypt(byte[] bytes, int offset, int length, byte[] output, int outOff)
A literal copy of bytes with no encryption/decryption.
void encryptOp(byte[] in, int inOff, byte[] out, int outOff)
Deprecated. Use an encrypt method instead.
void erase()
Erases any sensitive information (such as buffers and subkey tables) stored in this cipher object.
AlgorithmIdentifier getAlgID()
Always returns null.
int getBlockSize()
Returns the block size of the cipher, or 0 if the cipher is not a BlockCipher.
void initialize(AlgorithmIdentifier algID, Key key)
Does nothing
void setAlgID(AlgorithmIdentifier algID)
Deprecated. Use an initialize method.

Methods inherited from class oracle.security.crypto.core.Cipher
assertDecryption, assertEncryption, cloneKey, decodeOp, decrypt, decrypt, decrypt, decryptOp, encodeOp, encrypt, encrypt, encrypt, encryptOp, getDecryptionKey, getEncryptionKey, getInstance, getInstance, getInstance, getInstance, getInstance, getIV, getKey, getMode, getPadding, getPaddingID, initialize, pad, releaseOp, setDecryptionKey, setEncryptionKey, setIV, setKey, setMode, setPadding, setRandomBitsSource, unpad

Methods inherited from class oracle.security.crypto.core.Coder
decode, decode, encode, encode, initialize

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

NullCipher

public NullCipher()

Method Detail

initialize

public void initialize(AlgorithmIdentifier algID,
                       Key key)
                throws AlgorithmIdentifierException,
                       InvalidKeyException,
                       CipherException
Does nothing
Specified by:
initialize in class Cipher
Parameters:
algID - is the AlgorithmIdentifier whose params will be used to configure the cipher.
key - is the SymmetricKey instance that will be cloned and used by the cipher internally. The internal instance will be erased when Cipher.erase() is called.
Throws:
AlgorithmIdentifierException - is thrown if the algID's OID isn't valid for the Cipher instance being initialized or if the params are not valid for the algID's OID.
InvalidKeyException - is never thrown because the key is never used.
CipherException - is thrown if there is a problem initializing the Cipher.

algName

public java.lang.String algName()
Returns "NullCipher".
Specified by:
algName in class Coder

setAlgID

public void setAlgID(AlgorithmIdentifier algID)
              throws AlgorithmIdentifierException
Deprecated. Use an initialize method.
Sets the algorithm identifier for the cipher.
Specified by:
setAlgID in class Cipher
Throws:
AlgorithmIdentifierException

getAlgID

public AlgorithmIdentifier getAlgID()
Always returns null.
Specified by:
getAlgID in class Cipher
Returns:
A newly constructed AlgorithmIdentifier that is a "snapshot" of the Cipher's current configuration.

encrypt

public byte[] encrypt(byte[] bytes,
                      int offset,
                      int length,
                      boolean pad)
               throws CipherException
A literal copy of bytes with no encryption/decryption.
Specified by:
encrypt in class Cipher
Parameters:
bytes - buffer in which data to be encrypted is stored.
offset - offset within buffer of the start of the data.
length - the length of the data.
pad - true if padding is to be used, false otherwise.
Returns:
the ciphertext bytes
Throws:
CipherException - is thrown if the Cipher was not initialized, if the Cipher was used for decryption without being re-initialized, if the data is not a multiple of the block size and no padding is specified, or if an error occurred during the encryption process.

encrypt

public void encrypt(byte[] bytes,
                    int offset,
                    int length,
                    byte[] output,
                    int outOff)
             throws CipherException
A literal copy of bytes with no encryption/decryption.
Specified by:
encrypt in class Cipher
Parameters:
bytes - array of bytes to encrypt
offset - offset of the start of data to encrypt
length - the length of the data to encrypt
output - array to place the encrypted bytes
outOff - offset of the start of the encrypted bytes
Throws:
CipherException - is thrown if the Cipher was not initialized, if the Cipher was used for decryption without being re-initialized, if the data is not a multiple of the block size, or if an error occurred during the encryption process.

encryptOp

public void encryptOp(byte[] in,
                      int inOff,
                      byte[] out,
                      int outOff)
               throws CipherException
Deprecated. Use an encrypt method instead.
Encrypts a sequence of bytes of length exactly equal to the block size. This is implemented by a subclass to do the actual encryption operation.

Implementors must ensure that this method works correctly even if the 'in' and 'out' buffers coincide.

Specified by:
encryptOp in class Cipher
Parameters:
in - buffer in which data to be encrypted is stored
inOff - offset within input buffer of the start of data
out - buffer to place the encrypted bytes in
outOff - offset within output buffer where the encrypted bytes will be stored
Throws:
CipherException - is thrown if the Cipher is not initialized, length of data is not equal to the block size, etc.

decrypt

public byte[] decrypt(byte[] bytes,
                      int offset,
                      int length,
                      boolean unpad)
               throws CipherException
A literal copy of bytes with no encryption/decryption.
Specified by:
decrypt in class Cipher
Parameters:
bytes - Buffer in which data to be decrypted is stored.
offset - Offset within buffer of the start of data.
length - The length of the data
unpad - specifies whether the plaintext should have padding removed.
Returns:
the plaintext bytes
Throws:
CipherException - is thrown if the Cipher was not initialized, if the Cipher was used for encryption without being re-initialized, if the data is not a multiple of the block size and no padding is specified, or if an error occurred during the decryption process.

decrypt

public void decrypt(byte[] bytes,
                    int offset,
                    int length,
                    byte[] output,
                    int outOff)
             throws CipherException
A literal copy of bytes with no encryption/decryption.
Specified by:
decrypt in class Cipher
Parameters:
bytes - array of bytes to decrypt
offset - offset of the start of the data to decrypt
length - the length of the data to decrypt
output - array to place the decrypted bytes
outOff - offset of the start of the decrypted bytes
Throws:
CipherException - is thrown if the Cipher was not initialized, if the Cipher was used for encryption without being re-initialized, if the data is not a multiple of the block size, or if an error occurred during the decryption process.

decryptOp

public void decryptOp(byte[] in,
                      int inOff,
                      byte[] out,
                      int outOff)
               throws CipherException
Deprecated. Use a decrypt method instead.
Decrypts a sequence of bytes of length exactly equal to the block size. This implements the actual decryption operation for block ciphers.

Implementors must ensure that this method works correctly even if the 'in' and 'out' buffers coincide.

Specified by:
decryptOp in class Cipher
Parameters:
in - buffer in which data to be decrypted is stored.
inOff - offset within input buffer of the start of data.
out - buffer to place the decrypted bytes in
outOff - offset within output buffer where the encrypted bytes will be stored.
Throws:
CipherException - is thrown if the Cipher is not initialized, length of data is not equal to the block size, etc.

erase

public void erase()
Description copied from class: Cipher
Erases any sensitive information (such as buffers and subkey tables) stored in this cipher object. Additionally, this will erase the Cipher's internal copies of any keys it holds.
Overrides:
erase in class Cipher

blockSize

public int blockSize()
Deprecated. Use getBlockSize() instead.
Returns the block size of the cipher, or 0 if the cipher is not a block cipher.
Specified by:
blockSize in class Cipher

getBlockSize

public int getBlockSize()
Description copied from class: Cipher
Returns the block size of the cipher, or 0 if the cipher is not a BlockCipher.
Specified by:
getBlockSize in class Cipher

Oracle Security Developer Tools Crypto Java API Reference
10g Release 2 (10.1.2.0.2)

B15565-01


Copyright © 2005 , Oracle. All rights reserved.