net.rim.device.api.crypto
Class RC2Key

java.lang.Object
  extended by net.rim.device.api.crypto.RC2Key
All Implemented Interfaces:
Key, SymmetricKey, Persistable

public final class RC2Key
extends Object
implements SymmetricKey, Persistable

Creates an RC2 key.

For information on cryptographic algorithms, see Crypto Algorithms.

Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

Constructor Summary
Category: Signed RC2Key()
          Create a new random 128 (actual/effective) bit key.
Category: Signed RC2Key(byte[] data)
          Creates an RC2Key object using existing data.
Category: Signed RC2Key(byte[] data, int effectiveBitLength)
          Creates a key using existing data and the specified effective bit length.
Category: Signed RC2Key(byte[] data, int offset, int bitLength)
          Creates an RC2Key object using existing data.
Category: Signed RC2Key(byte[] data, int offset, int bitLength, int effectiveBitLength)
          Creates an RC2Key object using existing data and the specified effective bit length.
Category: Signed RC2Key(int bitLength)
          Creates a new random RC2Key object of the specified actual/effective bit length.
Category: Signed RC2Key(int bitLength, int effectiveBitLength)
          Creates a new random RC2Key object based on the specified actual and effective bit lengths.
Category: Signed RC2Key(RC2CryptoToken cryptoToken, byte[] data, int offset, int bitLength, int effectiveBitLength)
          Creates an RC2Key object using existing data and the specified effective bit length.
Category: Signed RC2Key(RC2CryptoToken cryptoToken, int bitLength, int effectiveBitLength)
          Creates a new random RC2Key object based on the specified actual and effective bit lengths.
Category: Signed RC2Key(RC2CryptoToken cryptoToken, CryptoTokenSymmetricKeyData cryptoTokenData)
          Creates an RC2Key object.
 
Method Summary
Category: Signed static int decodeEffectiveBitLength(int encodedEffectiveBitLength)
          Decodes an encoded effective bit length as specified in RFC 2268.
Category: Signed static int encodeEffectiveBitLength(int effectiveBitLength)
          Encodes an effective bit length as specified in RFC 2268.
Category: Signed  boolean equals(Object obj)
          Indicates whether some other object is "equal to" this one.
Category: Signed  String getAlgorithm()
          Returns a string containing the name of the algorithm associated with this key ("RC2").
Category: Signed  int getBitLength()
          Returns the number of bits that make up the actual keying material ( for example parity bits are not counted ).
Category: Signed  CryptoTokenSymmetricKeyData getCryptoTokenData()
          Returns the data associated with the crypto token.
Category: Signed  byte[] getData()
          Returns a copy of the byte array representing the key.
Category: Signed  int getEffectiveBitLength()
          Returns the effective bit length.
Category: Signed  int getLength()
          Returns the length of the key in bytes.
Category: Signed  RC2CryptoToken getRC2CryptoToken()
          Returns the crypto token used to create the key.
Category: Signed  SymmetricCryptoToken getSymmetricCryptoToken()
          Returns the crypto token associated with this key.
Category: Signed  int hashCode()
          Returns a hash code value for the object.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

RC2Key

public RC2Key()
Create a new random 128 (actual/effective) bit key.

Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

RC2Key

public RC2Key(int bitLength)
Creates a new random RC2Key object of the specified actual/effective bit length.

Parameters:
bitLength - The length of the key in bits (must be between 8 and 1024, and a multiple of 8).
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

RC2Key

public RC2Key(int bitLength,
              int effectiveBitLength)
Creates a new random RC2Key object based on the specified actual and effective bit lengths.

Parameters:
bitLength - The length of the key in bits (must be between 8 and 1024, and a multiple of 8).
effectiveBitLength - The effective length of the key in bits (must be between 1 and 1024).
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

RC2Key

public RC2Key(RC2CryptoToken cryptoToken,
              int bitLength,
              int effectiveBitLength)
       throws CryptoTokenException,
              CryptoUnsupportedOperationException
Creates a new random RC2Key object based on the specified actual and effective bit lengths.

Parameters:
cryptoToken - The token that protects the key.
bitLength - The length of the key in bits (must be between 8 and 1024, and a multiple of 8).
effectiveBitLength - The effective length of the key in bits (must be between 1 and 1024).
Throws:
CryptoTokenException - Thrown when an error occurs with a crypto token or the crypto token is invalid.
CryptoUnsupportedOperationException - Thrown when a call is made to an unsupported operation.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

RC2Key

public RC2Key(byte[] data)
Creates an RC2Key object using existing data. The effective bit length will match the actual bit length.

Parameters:
data - A byte array containing the bytes to use as the key (data.length must be between 1 and 128).
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

RC2Key

public RC2Key(byte[] data,
              int effectiveBitLength)
Creates a key using existing data and the specified effective bit length.

Parameters:
data - A byte array containing the bytes to use as the key (data.length must be between 1 and 128).
effectiveBitLength - The effective length of the key in bits (must be between 1 and 1024).
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

RC2Key

public RC2Key(byte[] data,
              int offset,
              int bitLength)
Creates an RC2Key object using existing data. The effective bit length will match the actual bit length.

Parameters:
data - A byte array containing the bytes to use as the key.
offset - The starting offset, or initial position, of the key data within the array.
bitLength - The length of the key in bits (must be between 8 and 1024, and a multiple of 8).
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

RC2Key

public RC2Key(byte[] data,
              int offset,
              int bitLength,
              int effectiveBitLength)
Creates an RC2Key object using existing data and the specified effective bit length.

Parameters:
data - A byte array containing the bytes to use as the key.
offset - The starting offset, or initial position, of the key data within the array.
bitLength - The length of the key in bits (must be between 8 and 1024, and a multiple of 8).
effectiveBitLength - The effective length of the key in bits (must be between 1 and 1024).
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

RC2Key

public RC2Key(RC2CryptoToken cryptoToken,
              byte[] data,
              int offset,
              int bitLength,
              int effectiveBitLength)
       throws CryptoTokenException,
              CryptoUnsupportedOperationException
Creates an RC2Key object using existing data and the specified effective bit length.

Parameters:
cryptoToken - The token that protects the key.
data - A byte array containing the bytes to use as the key.
offset - The starting offset, or initial position, of the key data within the array.
bitLength - The length of the key in bits (must be between 8 and 1024, and a multiple of 8).
effectiveBitLength - The effective length of the key in bits (must be between 1 and 1024).
Throws:
CryptoTokenException - Thrown when an error occurs with a crypto token or the crypto token is invalid.
CryptoUnsupportedOperationException - Thrown when a call is made to an unsupported operation.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

RC2Key

public RC2Key(RC2CryptoToken cryptoToken,
              CryptoTokenSymmetricKeyData cryptoTokenData)
Creates an RC2Key object.

Parameters:
cryptoToken - The crypto token that protects the key.
cryptoTokenData - The data associated with the crypto token.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0


Method Detail

getSymmetricCryptoToken

public SymmetricCryptoToken getSymmetricCryptoToken()
Returns the crypto token associated with this key.

Specified by:
getSymmetricCryptoToken in interface SymmetricKey
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getRC2CryptoToken

public RC2CryptoToken getRC2CryptoToken()
Returns the crypto token used to create the key.

Returns:
The crypto token used to create the key.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getCryptoTokenData

public CryptoTokenSymmetricKeyData getCryptoTokenData()
Returns the data associated with the crypto token.

Returns:
The symmetric key data associated with the crypto token.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getAlgorithm

public String getAlgorithm()
Returns a string containing the name of the algorithm associated with this key ("RC2").

This method will always return the String "RC2".

Specified by:
getAlgorithm in interface Key
Returns:
A String that represents the name of the algorithm.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getLength

public int getLength()
              throws CryptoTokenException,
                     CryptoUnsupportedOperationException
Description copied from interface: SymmetricKey
Returns the length of the key in bytes.

Specified by:
getLength in interface SymmetricKey
Returns:
An integer that represents the number of bytes.
Throws:
CryptoTokenException - Thrown when a problem occurs with a crypto token or the crypto token is invalid.
CryptoUnsupportedOperationException - Thrown when a call is made to an unsupported operation.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getBitLength

public int getBitLength()
                 throws CryptoTokenException,
                        CryptoUnsupportedOperationException
Description copied from interface: SymmetricKey
Returns the number of bits that make up the actual keying material ( for example parity bits are not counted ).

Specified by:
getBitLength in interface SymmetricKey
Returns:
An integer that represents the number of bits in the key.
Throws:
CryptoTokenException - Thrown when a problem occurs with a crypto token or the crypto token is invalid.
CryptoUnsupportedOperationException - Thrown when a call is made to an unsupported operation.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getData

public byte[] getData()
               throws CryptoTokenException,
                      CryptoUnsupportedOperationException
Description copied from interface: SymmetricKey
Returns a copy of the byte array representing the key.

Specified by:
getData in interface SymmetricKey
Returns:
A byte array containing the key.
Throws:
CryptoTokenException - Thrown when a problem occurs with a crypto token or the crypto token is invalid.
CryptoUnsupportedOperationException - Thrown when a call is made to an unsupported operation.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getEffectiveBitLength

public int getEffectiveBitLength()
                          throws CryptoTokenException,
                                 CryptoUnsupportedOperationException
Returns the effective bit length.

Returns:
An integer that represents the effective bit length of the key.
Throws:
CryptoTokenException - Thrown when an error occurs with a crypto token or the crypto token is invalid.
CryptoUnsupportedOperationException - Thrown when a call is made to an unsupported operation.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

hashCode

public int hashCode()
Description copied from class: Object
Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.

The general contract of hashCode is:

As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)

Overrides:
hashCode in class Object
Returns:
a hash code value for this object.
See Also:
Object.equals(java.lang.Object), Hashtable
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

equals

public boolean equals(Object obj)
Description copied from class: Object
Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation:

The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any reference values x and y, this method returns true if and only if x and y refer to the same object (x==y has the value true).

Overrides:
equals in class Object
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.
See Also:
Boolean.hashCode(), Hashtable
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

decodeEffectiveBitLength

public static int decodeEffectiveBitLength(int encodedEffectiveBitLength)
Decodes an encoded effective bit length as specified in RFC 2268.

Parameters:
encodedEffectiveBitLength - The encoded effective bit length to be decoded.
Returns:
The effective bit length.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

encodeEffectiveBitLength

public static int encodeEffectiveBitLength(int effectiveBitLength)
Encodes an effective bit length as specified in RFC 2268.

Parameters:
effectiveBitLength - The effective bit length to be encoded.
Returns:
The encoded effective bit length.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0





Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.