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

B15565-01


oracle.security.crypto.core
Class DES

java.lang.Object
  extended byoracle.security.crypto.core.Coder
      extended byoracle.security.crypto.core.Cipher
          extended byoracle.security.crypto.core.BlockCipher
              extended byoracle.security.crypto.core.DES


public final class DES
extends BlockCipher

The DES (Digital Encryption Standard) cipher. The DES algorithm uses a 56-bit key for encryption and decryption.

See Also:
DES_EDE

Field Summary

Fields inherited from class oracle.security.crypto.core.BlockCipher
blockSize, iv, paddingID

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

Constructor Summary
DES()
Creates an uninitialized DES instance.
DES(int mode)
Deprecated. Use the no-argument constructor and an initialize method instead

Method Summary
java.lang.String algName()
Returns the name of this algorithm: DES
protected void decryptBlock(byte[] input, int inOff, byte[] output, int outOff)
Performs the block cipher's basic decryption operation on one block of ciphertext placing the result in the output buffer.
void decryptOp(byte[] in, int inOff, byte[] out, int outOff)
Deprecated. Use a decrypt method instead.
protected void encryptBlock(byte[] input, int inOff, byte[] output, int outOff)
Performs the block cipher's basic encryption operation on one block of plaintext placing the result in the output buffer.
void encryptOp(byte[] in, int inOff, byte[] out, int outOff)
Deprecated. Use an encrypt method instead.
void erase()
Erases any sensitive information stored in this BlockCipher object.
AlgorithmIdentifier getAlgID()
Builds an AlgorithmIdentifier that is a "snapshot" of the Cipher's current configuration.
void initialize(AlgorithmIdentifier algID, Key key)
This method verifies the AlgorithmIdentifier's Object ID and configures the DES instance appropriately with the params of the AlgorithmIdentifier in addition to the Key.
void initialize(AlgorithmIdentifier algID, SymmetricKey key, Padding.ID paddingID)
This method verifies the AlgorithmIdentifier's Object ID and configures the DES instance appropriately with the params of the AlgorithmIdentifier in addition to the SymmetricKey and padding identifier.
void setAlgID(AlgorithmIdentifier algID)
Deprecated. Use an initialize method.
void setDecryptionKey(Key key)
Deprecated. Use an initialize method instead.
void setEncryptionKey(Key key)
Deprecated. Use an initialize method instead.
void setKey(SymmetricKey key)
Deprecated. Use an initialize method instead.
void setMode(int mode)
Deprecated. Modes should only be set when a BlockCipher is initialized. Use one of the initialize(...) methods instead.
java.lang.String toString()

Methods inherited from class oracle.security.crypto.core.BlockCipher
blockSize, decrypt, decrypt, encrypt, encrypt, getBlockSize, getIV, getPadding, getPaddingID, setIV, setPadding

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, getKey, getMode, pad, releaseOp, 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, wait, wait, wait

Constructor Detail

DES

public DES()
Creates an uninitialized DES instance. To use the Cipher, it must be initialized with a Key and algorithm parameters, usually in the form of an AlgorithmIdentifier.

DES

public DES(int mode)
Deprecated. Use the no-argument constructor and an initialize method instead
Create a DES object with a given mode. Supported modes are ECB (default) and CBC.
Parameters:
mode - Cipher.ECB or Cipher.CBC

Method Detail

initialize

public void initialize(AlgorithmIdentifier algID,
                       Key key)
                throws AlgorithmIdentifierException,
                       InvalidKeyException
This method verifies the AlgorithmIdentifier's Object ID and configures the DES instance appropriately with the params of the AlgorithmIdentifier in addition to the Key. Padding is set to Padding.NONE.
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 thrown if there is a problem with the Key instance the Cipher is being initialized with.

initialize

public void initialize(AlgorithmIdentifier algID,
                       SymmetricKey key,
                       Padding.ID paddingID)
                throws AlgorithmIdentifierException,
                       InvalidKeyException,
                       CipherException
This method verifies the AlgorithmIdentifier's Object ID and configures the DES instance appropriately with the params of the AlgorithmIdentifier in addition to the SymmetricKey and padding identifier.
Specified by:
initialize in class BlockCipher
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.
paddingID - is used to indicate the type of padding that the Cipher should use. Options are Padding.NONE or Padding.PKCS5. A Cipher must be re-initialized before being used with the other Padding type.
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 thrown if there is a problem with the Key instance the Cipher is being initialized with.
CipherException - is thrown if there's a problem initializing the Cipher with the given parameters.

decryptBlock

protected void decryptBlock(byte[] input,
                            int inOff,
                            byte[] output,
                            int outOff)
                     throws CipherException
Description copied from class: BlockCipher
Performs the block cipher's basic decryption operation on one block of ciphertext placing the result in the output buffer. Mode and padding operations are not applied.
Specified by:
decryptBlock in class BlockCipher
Parameters:
input - buffer in which data to be decrypted is stored.
inOff - offset within input buffer of the start of data.
output - 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.

encryptBlock

protected void encryptBlock(byte[] input,
                            int inOff,
                            byte[] output,
                            int outOff)
                     throws CipherException
Description copied from class: BlockCipher
Performs the block cipher's basic encryption operation on one block of plaintext placing the result in the output buffer. Mode and padding operations are not applied.
Specified by:
encryptBlock in class BlockCipher
Parameters:
input - buffer in which data to be encrypted is stored
inOff - offset within input buffer of the start of data
output - 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.

algName

public java.lang.String algName()
Returns the name of this algorithm: DES
Specified by:
algName in class Coder

erase

public void erase()
Description copied from class: BlockCipher
Erases any sensitive information stored in this BlockCipher object.
Overrides:
erase in class BlockCipher

getAlgID

public AlgorithmIdentifier getAlgID()
Description copied from class: Cipher
Builds an AlgorithmIdentifier that is a "snapshot" of the Cipher's current configuration.

Altering this AlgorithmIdentifier will have no effect on the state of the Cipher.

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

toString

public java.lang.String toString()

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.

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.

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

setKey

public void setKey(SymmetricKey key)
            throws InvalidKeyException
Deprecated. Use an initialize method instead.
Sets the encryption/decryption key and initializes the cipher.
Overrides:
setKey in class Cipher
Parameters:
key - the encryption/decryption key
Throws:
InvalidKeyException - is thrown if the the key is not valid for the Cipher instance

setEncryptionKey

public void setEncryptionKey(Key key)
                      throws InvalidKeyException
Deprecated. Use an initialize method instead.
Sets the encryption key and initializes the cipher.
Overrides:
setEncryptionKey in class Cipher
Parameters:
key - the encryption key
Throws:
InvalidKeyException - is thrown if the the key is not valid for the Cipher instance

setDecryptionKey

public void setDecryptionKey(Key key)
                      throws InvalidKeyException
Deprecated. Use an initialize method instead.
Sets the decryption key and initializes the cipher.
Overrides:
setDecryptionKey in class Cipher
Parameters:
key - the decryption key
Throws:
InvalidKeyException - is thrown if the the key is not valid for the Cipher instance

setMode

public void setMode(int mode)
Deprecated. Modes should only be set when a BlockCipher is initialized. Use one of the initialize(...) methods instead.
Sets the mode.
Overrides:
setMode 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.