net.rim.device.api.crypto
Class RSACryptoSystem

java.lang.Object
  extended by net.rim.device.api.crypto.RSACryptoSystem
All Implemented Interfaces:
CryptoSystem, Persistable

public final class RSACryptoSystem
extends Object
implements CryptoSystem, Persistable

RSACryptoSystem represents the system of asymmetric cryptography created by Rivest, Shamir and Adleman based on the Integer Factorization Problem.

A description of the RSA algorithm can be found in PKCS #1 version 2.1. We support this definition of RSA.

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 RSACryptoSystem()
          Constructs an RSA system which uses keys of bit length 1024.
Category: Signed RSACryptoSystem(int modulusBitLength)
          Constructs an RSACryptoSystem object which uses keys of a given bit length.
Category: Signed RSACryptoSystem(RSACryptoToken cryptoToken, int modulusBitLength)
          Constructs an RSACryptoSystem which uses keys of a given bit length.
 
Method Summary
Category: Signed  KeyPair createKeyPair()
          Creates a new key pair using this crypto system.
Category: Signed  RSAKeyPair createRSAKeyPair()
           
Category: Signed  RSAKeyPair createRSAKeyPair(byte[] e)
           
Category: Signed  boolean equals(Object obj)
          Indicates whether some other object is "equal to" this one.
Category: Signed  String getAlgorithm()
          Returns a String that indicates the algorithm, ie "RSA".
Category: Signed  AsymmetricCryptoToken getAsymmetricCryptoToken()
          Returns the crypto token used to create the crypto system.
Category: Signed  int getBitLength()
          Returns the number of bits (aka the "strength") of the crypto system, eg 1024 (for RSA), 163 (for EC).
Category: Signed  int getModulusLength()
          Returns the number of bytes that comprise the public modulus for the system.
Category: Signed  String getName()
          Returns a String that indicates the name of the crypto system, ie "RSA1024".
Category: Signed  int hashCode()
          Returns a hash code value for the object.
Category: Signed  boolean isStrong()
          Returns whether or not the CryptoSystem is cryptographically strong as of the release date of the code.
Category: Signed  void verify()
          Performs certain integrity checks on the crypto system parameters.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

RSACryptoSystem

public RSACryptoSystem()
                throws UnsupportedCryptoSystemException
Constructs an RSA system which uses keys of bit length 1024.

Throws:
UnsupportedCryptoSystemException - Thrown if the specified crypto system is invalid.
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

RSACryptoSystem

public RSACryptoSystem(int modulusBitLength)
                throws UnsupportedCryptoSystemException
Constructs an RSACryptoSystem object which uses keys of a given bit length.

Parameters:
modulusBitLength - The length of the key, or the number of bits, when created under this system.
Throws:
UnsupportedCryptoSystemException - Thrown if the specified crypto system is invalid.
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

RSACryptoSystem

public RSACryptoSystem(RSACryptoToken cryptoToken,
                       int modulusBitLength)
                throws CryptoTokenException,
                       UnsupportedCryptoSystemException,
                       CryptoUnsupportedOperationException
Constructs an RSACryptoSystem which uses keys of a given bit length.

Parameters:
cryptoToken - The token associated with the crypto system.
modulusBitLength - The number of bits a key should be when created under this system.
Throws:
CryptoTokenException - Thrown when an error occurs with a crypto token or the crypto token is invalid.
UnsupportedCryptoSystemException - Thrown when the specified crypto system 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


Method Detail

verify

public void verify()
            throws InvalidCryptoSystemException
Description copied from interface: CryptoSystem
Performs certain integrity checks on the crypto system parameters.

These checks are useful to prevent certain types of attacks that involve modifying the parameters and then using a signed message to calculate the private key parameters.

Specified by:
verify in interface CryptoSystem
Throws:
InvalidCryptoSystemException - Thrown if the specified cryptosystem is invalid.
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 that indicates the algorithm, ie "RSA".

This method will always return the String "RSA".

Specified by:
getAlgorithm in interface CryptoSystem
Returns:
A String that represents 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

getName

public String getName()
Returns a String that indicates the name of the crypto system, ie "RSA1024".

Specified by:
getName in interface CryptoSystem
Returns:
A String that represents the name of the crypto system.
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

getAsymmetricCryptoToken

public AsymmetricCryptoToken getAsymmetricCryptoToken()
Returns the crypto token used to create the crypto system.

Specified by:
getAsymmetricCryptoToken in interface CryptoSystem
Returns:
The RSACryptoToken object.
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: CryptoSystem
Returns the number of bits (aka the "strength") of the crypto system, eg 1024 (for RSA), 163 (for EC).

Note: the strength of a CryptoSystem is a combination of the algorithm and the bit length. For example, a 1024 bit RSA CryptoSystem is estimated to have the same cryptographic strength as 160 bit EC CryptoSystem.

Specified by:
getBitLength in interface CryptoSystem
Returns:
An integer that represents the number of bits.
See Also:
CryptoSystem.isStrong()
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

isStrong

public boolean isStrong()
                 throws CryptoTokenException,
                        CryptoUnsupportedOperationException
Returns whether or not the CryptoSystem is cryptographically strong as of the release date of the code.

Note: Due to the nature of cryptography, things that are presently strong may be insecure in the future.

Specified by:
isStrong in interface CryptoSystem
Returns:
true if the crypto system is strong as of the release date of this code.
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

getModulusLength

public int getModulusLength()
Returns the number of bytes that comprise the public modulus for the system.

Returns:
An integer that specifies the number of 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

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

createKeyPair

public KeyPair createKeyPair()
                      throws CryptoTokenException,
                             CryptoUnsupportedOperationException
Description copied from interface: CryptoSystem
Creates a new key pair using this crypto system.

Specified by:
createKeyPair in interface CryptoSystem
Throws:
CryptoTokenException - Thrown if an error occurs with the crypto token or the crypto token is invalid.
CryptoUnsupportedOperationException - Thrown if 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

createRSAKeyPair

public RSAKeyPair createRSAKeyPair()
                            throws CryptoTokenException,
                                   CryptoUnsupportedOperationException
Throws:
CryptoTokenException
CryptoUnsupportedOperationException
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

createRSAKeyPair

public RSAKeyPair createRSAKeyPair(byte[] e)
                            throws InvalidKeyException,
                                   CryptoTokenException,
                                   CryptoUnsupportedOperationException
Throws:
InvalidKeyException
CryptoTokenException
CryptoUnsupportedOperationException
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