net.rim.device.api.crypto
Class ARC4Key
java.lang.Object
net.rim.device.api.crypto.ARC4Key
- All Implemented Interfaces:
- Key, SymmetricKey, Persistable
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.
- See Also:
ARC4PseudoRandomSource
- 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 |
|
ARC4Key()
Creates a new random ARC4Key object of size 128 bytes. |
|
ARC4Key(byte[] data)
Creates an ARC4Key object given an array of key data. |
|
ARC4Key(byte[] data,
int offset,
int length)
Creates an ARC4Key object. |
|
ARC4Key(int length)
Creates a new random ARC4Key object by specifying the key length. |
Method Summary |
|
boolean |
equals(Object obj)
Returns a boolean that indicates if the specified key and the current key
are equal. |
|
String |
getAlgorithm()
Returns a string containing the name of the algorithm associated with this
key ("ARC4"). |
|
int |
getBitLength()
Returns the number of bits that make up the actual keying material ( for example parity bits
are not counted ). |
|
byte[] |
getData()
Returns the key data. |
|
int |
getLength()
Returns the length of the key in bytes. |
|
SymmetricCryptoToken |
getSymmetricCryptoToken()
Returns the crypto token associated with this key. |
|
int |
hashCode()
Returns the hash code of the key. |
ARC4Key
public ARC4Key()
- Creates a new random
ARC4Key
object of size 128 bytes.
- 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
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.- 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
ARC4Key
public ARC4Key(byte[] data)
- Creates an
ARC4Key
object given an array of key data.
- Parameters:
data
- The byte array containing the key data.- 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
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.- 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 ("ARC4").
This method will always return "ARC4"
- Specified by:
getAlgorithm
in interface Key
- Returns:
- A string representing 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()
- Returns the length of the key in bytes.
- Specified by:
getLength
in interface SymmetricKey
- Returns:
- An integer representing the length of 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
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 ).
- Specified by:
getBitLength
in interface SymmetricKey
- Returns:
- An integer that represents the number of bits in 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
getData
public byte[] getData()
- Returns the key data.
- Specified by:
getData
in interface SymmetricKey
- Returns:
- A byte array representing the key data.
- 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
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
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.
- 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)
- 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.
- 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
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal