SHOW Signed SHOW CryptoExtensionAPI
 

net.rim.device.api.crypto
Class ARC4Key

java.lang.Object
  |
  +--net.rim.device.api.crypto.ARC4Key
All Implemented Interfaces:
Key, Persistable, Persistable, SymmetricKey

public final class ARC4Key
extends Object
implements SymmetricKey, Persistable

Creates an ARC4 key.

ARC4 is a version of the proprietary RC4 algorithm that was supposedly released onto the Internet in 1994. RC4 is a variable key size stream cipher developed in 1987 by Ron Rivest for RSA Data Security Inc. The algorithm is very simple and works in OFB mode where the keystream is independent of the plaintext.

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:
JDE 3.6.0
See Also:
ARC4PseudoRandomSource

Constructor Summary
 Category: Signed ARC4Key()
          Creates a new random ARC4Key object of size 128 bytes.
 Category: Signed ARC4Key(byte[] data)
          Creates an ARC4Key object given an array of key data.
 Category: Signed ARC4Key(byte[] data, int offset, int length)
          Creates an ARC4Key object.
 Category: Signed ARC4Key(int length)
          Creates a new random ARC4Key object by specifying the key length.
 
Method Summary
 Category: Signed  boolean equals(Object obj)
          Returns a boolean that indicates if the specified key and the current key are equal.
 Category: Signed  String getAlgorithm()
          Returns a string containing the name of the algorithm associated with this key ("ARC4").
 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  byte[] getData()
          Returns the key data.
 Category: Signed  int getLength()
          Returns the length of the key in bytes.
 Category: CryptoExtensionAPI Category: Signed  SymmetricCryptoToken getSymmetricCryptoToken()
          Returns the crypto token associated with this key.
 Category: Signed  int hashCode()
          Returns the hash code of the key.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ARC4Key

public ARC4Key()
Creates a new random ARC4Key object of size 128 bytes.
Since:
JDE 3.6.0
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.

ARC4Key

public ARC4Key(byte[] data)
Creates an ARC4Key object given an array of key data.

Parameters:
data - The byte array containing the key data.
Since:
JDE 3.6.0
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.

ARC4Key

public ARC4Key(byte[] data,
               int offset,
               int length)
Creates an ARC4Key object.

Parameters:
data - The byte array containing the key data.
offset - The offset, or first bit position, of the key data in the array.
length - The number of bytes to read from the array (currently ARC4PseudoRandomSource utilizes a maximum of 256 bytes). Hence, the key is generated from the first 256 bytes of the array.
Since:
JDE 3.6.0
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.

ARC4Key

public ARC4Key(int length)
Creates a new random ARC4Key object by specifying the key length.

Parameters:
length - The length in bytes of the key to be created.
Since:
JDE 3.6.0
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.
Method Detail

equals

public boolean equals(Object obj)
Returns a boolean that indicates if the specified key and the current key are equal.

Overrides:
equals in class Object
Parameters:
obj - The ARC4key.
Returns:
True if the keys are equal, False otherwise.
Since:
JDE 3.6.0
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.

getAlgorithm

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

This method will always return "ARC4"

Returns:
A string representing the name of the algorithm.
Since:
JDE 3.6.0
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.

getBitLength

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

Since:
JDE 3.6.0

Following copied from 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.

getData

public byte[] getData()
Returns the key data.

Returns:
A byte array representing the key data.
Since:
JDE 3.6.0
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.

getLength

public int getLength()
Returns the length of the key in bytes.

Returns:
An integer representing the length of the key.
Since:
JDE 3.6.0
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.

getSymmetricCryptoToken

public SymmetricCryptoToken getSymmetricCryptoToken()
Returns the crypto token associated with this key.
Since:
JDE 3.6.0
Category:
CryptoExtensionAPI: This element is part of the Crypto Extension API. These APIs are intended for parties interested in extending the security provider frameworks, such as integrating a new security medium.
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.

hashCode

public int hashCode()
Returns the hash code of the key.

Overrides:
hashCode in class Object
Returns:
An integer representing the hash code of the key.
Since:
JDE 3.6.0
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.



Copyright 1999-2009 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.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.