Skip navigation links

Oracle Fusion Middleware Crypto Java API Reference for Oracle Security Developer Tools
11g Release 1 (11.1.1)

E10668-04


oracle.security.crypto.core
Class RC2

java.lang.Object
  extended by oracle.security.crypto.core.Coder
      extended by oracle.security.crypto.core.Cipher
          extended by oracle.security.crypto.core.BlockCipher
              extended by oracle.security.crypto.core.RC2


public final class RC2
extends BlockCipher

An implementation of the RC2 cipher, as specified in RFC 2268.

Note that keys can be anywhere from 1 to 128 bytes long.

There is an additional parameter for this algorithm, the effective key length, which can be specified with the appropriate initialize method. By default, it is equal to the number of bits in the user-specified key.


Field Summary

 

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

 

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

 

Constructor Summary
RC2()
          Creates an uninitialized RC2 instance.

 

Method Summary
 java.lang.String algName()
          Returns the name of the algorithm.
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.
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 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.
 int getEffectiveKeyLength()
          Returns the effective key length.
 void initialize(AlgorithmIdentifier algID, SymmetricKey key, Padding.ID paddingID, RandomBitsSource rbs)
          This method verifies the AlgorithmIdentifier's Object ID and configures the RC2 instance appropriately with the params of the AlgorithmIdentifier in addition to the SymmetricKey and padding identifier.
 java.lang.String toString()
          Returns a description of this RC2 cipher.

 

Methods inherited from class oracle.security.crypto.core.BlockCipher
decrypt, decrypt, encrypt, encrypt, getBlockSize, getIV, getPaddingID, initialize, setIV, unwrapPrivateKey, unwrapSymmetricKey, wrapKey, wrapKey

 

Methods inherited from class oracle.security.crypto.core.Cipher
assertDecryption, assertEncryption, assertKeyUnwrap, assertKeyWrap, cloneKey, decodeOp, decrypt, decrypt, decrypt, encodeOp, encrypt, encrypt, encrypt, finalize, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getMode, initialize, initialize, releaseOp

 

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

 

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

 

Constructor Detail

RC2

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

Method Detail

initialize

public void initialize(AlgorithmIdentifier algID,
                       SymmetricKey key,
                       Padding.ID paddingID,
                       RandomBitsSource rbs)
                throws AlgorithmIdentifierException,
                       InvalidKeyException,
                       CipherException
This method verifies the AlgorithmIdentifier's Object ID and configures the RC2 instance appropriately with the params of the AlgorithmIdentifier in addition to the SymmetricKey and padding identifier.
Overrides:
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 used by the cipher internally.
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.
rbs - is the RandomBitsSourfce to use in this cipher.
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 - 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 - 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 the algorithm.
Specified by:
algName in class Coder
Returns:
"RC2"

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.

getEffectiveKeyLength

public int getEffectiveKeyLength()
Returns the effective key length.
Returns:
the effective key length in bits.

toString

public java.lang.String toString()
Returns a description of this RC2 cipher.
Overrides:
toString in class java.lang.Object

Skip navigation links

Oracle Fusion Middleware Crypto Java API Reference for Oracle Security Developer Tools
11g Release 1 (11.1.1)

E10668-04


Copyright © 2005, 2011 , Oracle. All rights reserved.