net.rim.device.api.crypto
Class ECDSASignatureSigner

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

public final class ECDSASignatureSigner
extends Object
implements SignatureSigner

Signs messages using the Elliptic Curve analogue of the DSA signature scheme.

Elliptic Curve cryptography is defined in various standards including P1363 and ANSI X9.62. ECDSA is specifically defined in ANSI X9.62.

For information on cryptographic algorithms, see Crypto Algorithms.

See Also:
ECDSASignatureVerifier
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 ECDSASignatureSigner(ECPrivateKey key)
          Construct an ECDSASignaterSigner object which uses SHA-1 to compute the signature.
Category: Signed ECDSASignatureSigner(ECPrivateKey key, Digest digest)
          Construct an ECDSASignatureSigner object which uses a specified digest to compute the signature.
 
Method Summary
Category: Signed  String getAlgorithm()
          Returns the name of this signing algorithm "ECDSA/" + digest.getAlgorithm().
Category: Signed  String getDigestAlgorithm()
          Returns the name of the digest algorithm used, eg "SHA1", etc.
Category: Signed  int getRLength()
          Returns the largest possible value for the size of r, which is the size of the field.
Category: Signed  int getSLength()
          Returns the largest possible value for the size of s, which is the size of the field.
Category: Signed  void reset()
          Reinitializes the signer, preparing it to generate another signature.
Category: Signed  void sign(byte[] r, int rOffset, byte[] s, int sOffset)
          Signs the information that has been hashed up to this point using the values of r and s.
Category: Signed  void update(byte[] data)
          Adds additional message data to the signature.
Category: Signed  void update(byte[] data, int offset, int length)
          Adds additional message data to the signature.
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

ECDSASignatureSigner

public ECDSASignatureSigner(ECPrivateKey key)
                     throws CryptoTokenException,
                            CryptoUnsupportedOperationException
Construct an ECDSASignaterSigner object which uses SHA-1 to compute the signature.

Parameters:
key - The private key to use.
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

ECDSASignatureSigner

public ECDSASignatureSigner(ECPrivateKey key,
                            Digest digest)
                     throws CryptoTokenException,
                            CryptoUnsupportedOperationException
Construct an ECDSASignatureSigner object which uses a specified digest to compute the signature.

NOTE: If the digest has any state information in it when it is given to the signature signer, this information will be incorparated into the signature. If you don't want this information included, call the reset method for the signature signer to delete it. A newly created digest, which no update calls have been made too, contains no state information in it by default.

Parameters:
key - The private key to use.
digest - An instance of the digest algorithm to use.
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


Method Detail

getAlgorithm

public String getAlgorithm()
Returns the name of this signing algorithm "ECDSA/" + digest.getAlgorithm().

Specified by:
getAlgorithm in interface SignatureSigner
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

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 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

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:
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:
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:
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:
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

getRLength

public int getRLength()
Returns the largest possible value for the size of r, which is the size of the field. Notice that the "field" refers to the finite field that the elliptic curve is defined over and the size refers to either the size of the prime or the degree of the irreducible polynomial that helps define the field.

The reason we return the maximum size is because r is always in the field and hence can have size less than or equal to the size of the field so we return the maximum to ensure that there is enough room to hold r. If r turns out to be smaller than the maximum it will be padded with zeroes to accomodate this fact.

Returns:
An integer that represents the length of r.
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

getSLength

public int getSLength()
Returns the largest possible value for the size of s, which is the size of the field. Notice that the "field" refers to the finite field that the elliptic curve is defined over and the size refers to either the size of the prime or the degree of the irreducible polynomial that helps define the field.

The reason we return the maximum size is because s is always in the field and hence can have size less than or equal to the size of the field so we return the maximum to ensure that there is enough room to hold s. If s turns out to be smaller than the maximum it will be padded with zeroes to accomodate this fact.

Returns:
An integer that represents the length of r.
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

sign

public void sign(byte[] r,
                 int rOffset,
                 byte[] s,
                 int sOffset)
          throws CryptoTokenException,
                 CryptoUnsupportedOperationException
Signs the information that has been hashed up to this point using the values of r and s.

Parameters:
r - Represents the r parameter for the ECDSA algorithm. Note that r is an element of the finite field that the elliptic curve is defined over.
rOffset - The offset, or starting position, of the signature data within the byte array r.
s - Represents the s parameter for the ECDSA algorithm. Note that s is an element of the finite field that the elliptic curve is defined over.
sOffset - The offset, or starting position, of the signature data within the byte array s.
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





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