net.rim.device.api.crypto
Class PKCS1SignatureSigner

java.lang.Object
  extended by net.rim.device.api.crypto.PKCS1SignatureSigner
All Implemented Interfaces:
SignatureSigner

public final class PKCS1SignatureSigner
extends Object
implements SignatureSigner

The PKCS1SignatureSigner object can sign messages using the RSA PKCS#1 signature scheme.

We implemented the PKCS1 signing as per the PKCS #1 version 2.1 document.

For a code sample using the PKCS1 signature signer, click here.

For information on cryptographic algorithms, see Crypto Algorithms.

See Also:
PKCS1SignatureVerifier
Category:
Certicom: This element is part of the Certicom Cryptography APIs. The Certicom Cryptography APIs provide the tools you need, including ECC based algorithms, to integrate high performance data security into your applications, such as public key data encryption and decryption, digital signatures, and data authentication. Since the Certicom Cryptography API is already in the JDE, its use will remove the need for you to engage in time and resource intensive security integration so that you have lower development costs and a faster time to market. Use of the Certicom Cryptography API requires a license from Certicom. Please contact Certicom directly for more information on licensing fees and conditions.

Certicom Contact Information

Phone:905-507-4220

Email: sales@certicom.com

Website: http://www.certicom.com/rim

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: Certicom Category: Signed PKCS1SignatureSigner(RSAPrivateKey key)
          Constructs an RSA PKCS1SignatureSigner (version 2.0) object which uses the SHA1 digest.
Category: Certicom Category: Signed PKCS1SignatureSigner(RSAPrivateKey key, boolean useASN1)
          Constructs an RSA PKCS1SignatureSigner object (version 2.0) signing object which uses the given digest.
Category: Certicom Category: Signed PKCS1SignatureSigner(RSAPrivateKey key, Digest digest)
          Constructs an RSA PKCS1SignatureSigner object (version 2.0) signing object which uses the given digest.
Category: Certicom Category: Signed PKCS1SignatureSigner(RSAPrivateKey key, Digest digest, boolean useASN1)
          Constructs an RSA PKCS1SignatureSigner (version 1.5 or 2.0) object that uses the given digest.
 
Method Summary
Category: Certicom Category: Signed  String getAlgorithm()
          Returns a String containing the name of the algorithm (eg "RSA_PKCS1_V15/<DigestAlgorithm>" or "RSA_PKCS1_V20/<DigestAlgorithm>").
Category: Certicom Category: Signed  String getDigestAlgorithm()
          Returns the name of the digest algorithm used, eg "SHA1", etc.
Category: Certicom Category: Signed  int getLength()
          Returns the length of the signature in bytes.
Category: Certicom Category: Signed static boolean isVersion20Supported()
          Returns true if PKCS1 version 2.0 is supported.
Category: Certicom Category: Signed  void reset()
          Reinitializes the signer, preparing it to generate another signature.
Category: Certicom Category: Signed  void sign(byte[] signature, int signatureOffset)
          Signs the formatted signature data that has been generated from the values passed through the update function.
Category: Certicom Category: Signed  void update(byte[] data)
          Adds additional message data to the signature.
Category: Certicom Category: Signed  void update(byte[] data, int offset, int length)
          Adds additional message data to the signature.
Category: Certicom Category: Signed  void update(int data)
          Adds additional message data to the signature.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

PKCS1SignatureSigner

public PKCS1SignatureSigner(RSAPrivateKey key)
                     throws CryptoUnsupportedOperationException
Constructs an RSA PKCS1SignatureSigner (version 2.0) object which uses the SHA1 digest.

Parameters:
key - The private key to use for signing.
Throws:
CryptoUnsupportedOperationException
Category:
Certicom: This element is part of the Certicom Cryptography APIs. The Certicom Cryptography APIs provide the tools you need, including ECC based algorithms, to integrate high performance data security into your applications, such as public key data encryption and decryption, digital signatures, and data authentication. Since the Certicom Cryptography API is already in the JDE, its use will remove the need for you to engage in time and resource intensive security integration so that you have lower development costs and a faster time to market. Use of the Certicom Cryptography API requires a license from Certicom. Please contact Certicom directly for more information on licensing fees and conditions.

Certicom Contact Information

Phone:905-507-4220

Email: sales@certicom.com

Website: http://www.certicom.com/rim

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

PKCS1SignatureSigner

public PKCS1SignatureSigner(RSAPrivateKey key,
                            boolean useASN1)
                     throws CryptoUnsupportedOperationException
Constructs an RSA PKCS1SignatureSigner object (version 2.0) signing object which uses the given digest.

Parameters:
key - The private key to use for signing.
useASN1 - A boolean that determines whether or not to ASN1-encode the digest before it is signed. Set this to false for version 1.5 (which does not use ASN1) or true for version 2.0 (which does use ASN1).
Throws:
CryptoUnsupportedOperationException - Thrown if the OID for the given digest is unknown.
Category:
Certicom: This element is part of the Certicom Cryptography APIs. The Certicom Cryptography APIs provide the tools you need, including ECC based algorithms, to integrate high performance data security into your applications, such as public key data encryption and decryption, digital signatures, and data authentication. Since the Certicom Cryptography API is already in the JDE, its use will remove the need for you to engage in time and resource intensive security integration so that you have lower development costs and a faster time to market. Use of the Certicom Cryptography API requires a license from Certicom. Please contact Certicom directly for more information on licensing fees and conditions.

Certicom Contact Information

Phone:905-507-4220

Email: sales@certicom.com

Website: http://www.certicom.com/rim

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

PKCS1SignatureSigner

public PKCS1SignatureSigner(RSAPrivateKey key,
                            Digest digest)
                     throws CryptoUnsupportedOperationException
Constructs an RSA PKCS1SignatureSigner object (version 2.0) signing object which uses the given digest.

Parameters:
key - The private key to use for signing.
digest - The digest to use to process the message.
Throws:
CryptoUnsupportedOperationException - Thrown if the OID for the given digest is unknown.
Category:
Certicom: This element is part of the Certicom Cryptography APIs. The Certicom Cryptography APIs provide the tools you need, including ECC based algorithms, to integrate high performance data security into your applications, such as public key data encryption and decryption, digital signatures, and data authentication. Since the Certicom Cryptography API is already in the JDE, its use will remove the need for you to engage in time and resource intensive security integration so that you have lower development costs and a faster time to market. Use of the Certicom Cryptography API requires a license from Certicom. Please contact Certicom directly for more information on licensing fees and conditions.

Certicom Contact Information

Phone:905-507-4220

Email: sales@certicom.com

Website: http://www.certicom.com/rim

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

PKCS1SignatureSigner

public PKCS1SignatureSigner(RSAPrivateKey key,
                            Digest digest,
                            boolean useASN1)
                     throws CryptoUnsupportedOperationException
Constructs an RSA PKCS1SignatureSigner (version 1.5 or 2.0) object that uses the given digest.

Parameters:
key - The private key to use for signing
digest - The digest to use to process the message. If digest is null, then if useASN1 is set to true then a SHA1Digest is created, else a MD5Digest is created.
useASN1 - A boolean that determines whether or not to ASN1-encode the digest before it is signed. Set this to false for version 1.5 (which does not use ASN1) or true for version 2.0 (which does use ASN1).
Throws:
CryptoUnsupportedOperationException - Thrown if the OID for the given digest is unknown.
Category:
Certicom: This element is part of the Certicom Cryptography APIs. The Certicom Cryptography APIs provide the tools you need, including ECC based algorithms, to integrate high performance data security into your applications, such as public key data encryption and decryption, digital signatures, and data authentication. Since the Certicom Cryptography API is already in the JDE, its use will remove the need for you to engage in time and resource intensive security integration so that you have lower development costs and a faster time to market. Use of the Certicom Cryptography API requires a license from Certicom. Please contact Certicom directly for more information on licensing fees and conditions.

Certicom Contact Information

Phone:905-507-4220

Email: sales@certicom.com

Website: http://www.certicom.com/rim

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

isVersion20Supported

public static boolean isVersion20Supported()
Returns true if PKCS1 version 2.0 is supported. Note: The code file net_rim_crypto2.cod must be present on the device to support version 2.0.

Category:
Certicom: This element is part of the Certicom Cryptography APIs. The Certicom Cryptography APIs provide the tools you need, including ECC based algorithms, to integrate high performance data security into your applications, such as public key data encryption and decryption, digital signatures, and data authentication. Since the Certicom Cryptography API is already in the JDE, its use will remove the need for you to engage in time and resource intensive security integration so that you have lower development costs and a faster time to market. Use of the Certicom Cryptography API requires a license from Certicom. Please contact Certicom directly for more information on licensing fees and conditions.

Certicom Contact Information

Phone:905-507-4220

Email: sales@certicom.com

Website: http://www.certicom.com/rim

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 (eg "RSA_PKCS1_V15/<DigestAlgorithm>" or "RSA_PKCS1_V20/<DigestAlgorithm>").

Specified by:
getAlgorithm in interface SignatureSigner
Returns:
A String that represents the name of the algorithm and the digest used.
Category:
Certicom: This element is part of the Certicom Cryptography APIs. The Certicom Cryptography APIs provide the tools you need, including ECC based algorithms, to integrate high performance data security into your applications, such as public key data encryption and decryption, digital signatures, and data authentication. Since the Certicom Cryptography API is already in the JDE, its use will remove the need for you to engage in time and resource intensive security integration so that you have lower development costs and a faster time to market. Use of the Certicom Cryptography API requires a license from Certicom. Please contact Certicom directly for more information on licensing fees and conditions.

Certicom Contact Information

Phone:905-507-4220

Email: sales@certicom.com

Website: http://www.certicom.com/rim

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

getDigestAlgorithm

public String getDigestAlgorithm()
Returns the name of the digest algorithm used, eg "SHA1", etc.

Specified by:
getDigestAlgorithm in interface SignatureSigner
Returns:
A String that represents the name of the digest algorithm.
Category:
Certicom: This element is part of the Certicom Cryptography APIs. The Certicom Cryptography APIs provide the tools you need, including ECC based algorithms, to integrate high performance data security into your applications, such as public key data encryption and decryption, digital signatures, and data authentication. Since the Certicom Cryptography API is already in the JDE, its use will remove the need for you to engage in time and resource intensive security integration so that you have lower development costs and a faster time to market. Use of the Certicom Cryptography API requires a license from Certicom. Please contact Certicom directly for more information on licensing fees and conditions.

Certicom Contact Information

Phone:905-507-4220

Email: sales@certicom.com

Website: http://www.certicom.com/rim

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

reset

public void reset()
Description copied from interface: SignatureSigner
Reinitializes the signer, preparing it to generate another signature.

Specified by:
reset in interface SignatureSigner
Category:
Certicom: This element is part of the Certicom Cryptography APIs. The Certicom Cryptography APIs provide the tools you need, including ECC based algorithms, to integrate high performance data security into your applications, such as public key data encryption and decryption, digital signatures, and data authentication. Since the Certicom Cryptography API is already in the JDE, its use will remove the need for you to engage in time and resource intensive security integration so that you have lower development costs and a faster time to market. Use of the Certicom Cryptography API requires a license from Certicom. Please contact Certicom directly for more information on licensing fees and conditions.

Certicom Contact Information

Phone:905-507-4220

Email: sales@certicom.com

Website: http://www.certicom.com/rim

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

update

public void update(int data)
Description copied from interface: SignatureSigner
Adds additional message data to the signature.

Specified by:
update in interface SignatureSigner
Parameters:
data - The byte to be hashed.
Category:
Certicom: This element is part of the Certicom Cryptography APIs. The Certicom Cryptography APIs provide the tools you need, including ECC based algorithms, to integrate high performance data security into your applications, such as public key data encryption and decryption, digital signatures, and data authentication. Since the Certicom Cryptography API is already in the JDE, its use will remove the need for you to engage in time and resource intensive security integration so that you have lower development costs and a faster time to market. Use of the Certicom Cryptography API requires a license from Certicom. Please contact Certicom directly for more information on licensing fees and conditions.

Certicom Contact Information

Phone:905-507-4220

Email: sales@certicom.com

Website: http://www.certicom.com/rim

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

update

public void update(byte[] data)
Description copied from interface: SignatureSigner
Adds additional message data to the signature.

Specified by:
update in interface SignatureSigner
Parameters:
data - The message data to hash.
Category:
Certicom: This element is part of the Certicom Cryptography APIs. The Certicom Cryptography APIs provide the tools you need, including ECC based algorithms, to integrate high performance data security into your applications, such as public key data encryption and decryption, digital signatures, and data authentication. Since the Certicom Cryptography API is already in the JDE, its use will remove the need for you to engage in time and resource intensive security integration so that you have lower development costs and a faster time to market. Use of the Certicom Cryptography API requires a license from Certicom. Please contact Certicom directly for more information on licensing fees and conditions.

Certicom Contact Information

Phone:905-507-4220

Email: sales@certicom.com

Website: http://www.certicom.com/rim

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

update

public void update(byte[] data,
                   int offset,
                   int length)
Description copied from interface: SignatureSigner
Adds additional message data to the signature.

Specified by:
update in interface SignatureSigner
Parameters:
data - The message data to hash.
offset - The offset, or the initial position to start reading in the data.
length - How much data to read.
Category:
Certicom: This element is part of the Certicom Cryptography APIs. The Certicom Cryptography APIs provide the tools you need, including ECC based algorithms, to integrate high performance data security into your applications, such as public key data encryption and decryption, digital signatures, and data authentication. Since the Certicom Cryptography API is already in the JDE, its use will remove the need for you to engage in time and resource intensive security integration so that you have lower development costs and a faster time to market. Use of the Certicom Cryptography API requires a license from Certicom. Please contact Certicom directly for more information on licensing fees and conditions.

Certicom Contact Information

Phone:905-507-4220

Email: sales@certicom.com

Website: http://www.certicom.com/rim

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 signature in bytes.

Returns:
An integer that represents the length of the signature.
Category:
Certicom: This element is part of the Certicom Cryptography APIs. The Certicom Cryptography APIs provide the tools you need, including ECC based algorithms, to integrate high performance data security into your applications, such as public key data encryption and decryption, digital signatures, and data authentication. Since the Certicom Cryptography API is already in the JDE, its use will remove the need for you to engage in time and resource intensive security integration so that you have lower development costs and a faster time to market. Use of the Certicom Cryptography API requires a license from Certicom. Please contact Certicom directly for more information on licensing fees and conditions.

Certicom Contact Information

Phone:905-507-4220

Email: sales@certicom.com

Website: http://www.certicom.com/rim

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

sign

public void sign(byte[] signature,
                 int signatureOffset)
          throws CryptoTokenException,
                 CryptoUnsupportedOperationException
Signs the formatted signature data that has been generated from the values passed through the update function.

Parameters:
signature - A byte array to contain the signature.
signatureOffset - The offset, or starting position, of the signature within the array.
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:
Certicom: This element is part of the Certicom Cryptography APIs. The Certicom Cryptography APIs provide the tools you need, including ECC based algorithms, to integrate high performance data security into your applications, such as public key data encryption and decryption, digital signatures, and data authentication. Since the Certicom Cryptography API is already in the JDE, its use will remove the need for you to engage in time and resource intensive security integration so that you have lower development costs and a faster time to market. Use of the Certicom Cryptography API requires a license from Certicom. Please contact Certicom directly for more information on licensing fees and conditions.

Certicom Contact Information

Phone:905-507-4220

Email: sales@certicom.com

Website: http://www.certicom.com/rim

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.