|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.crypto.ECDSASignatureSigner
public final class ECDSASignatureSigner
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.
ECDSASignatureVerifier
Constructor Summary | ||
---|---|---|
|
ECDSASignatureSigner(ECPrivateKey key)
Construct an ECDSASignaterSigner object which uses SHA-1 to compute the signature. |
|
|
ECDSASignatureSigner(ECPrivateKey key,
Digest digest)
Construct an ECDSASignatureSigner object which uses a specified digest to compute the signature. |
Method Summary | ||
---|---|---|
|
String |
getAlgorithm()
Returns the name of this signing algorithm "ECDSA/" + digest.getAlgorithm(). |
|
String |
getDigestAlgorithm()
Returns the name of the digest algorithm used, eg "SHA1", etc. |
|
int |
getRLength()
Returns the largest possible value for the size of r, which is the size of the field. |
|
int |
getSLength()
Returns the largest possible value for the size of s, which is the size of the field. |
|
void |
reset()
Reinitializes the signer, preparing it to generate another signature. |
|
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. |
|
void |
update(byte[] data)
Adds additional message data to the signature. |
|
void |
update(byte[] data,
int offset,
int length)
Adds additional message data to the signature. |
|
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 |
---|
public ECDSASignatureSigner(ECPrivateKey key) throws CryptoTokenException, CryptoUnsupportedOperationException
ECDSASignaterSigner
object which uses SHA-1 to compute the signature.
key
- The private key to use.
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.public ECDSASignatureSigner(ECPrivateKey key, Digest digest) throws CryptoTokenException, CryptoUnsupportedOperationException
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.
key
- The private key to use.digest
- An instance of the digest algorithm to use.
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.Method Detail |
---|
public String getAlgorithm()
getAlgorithm
in interface SignatureSigner
public String getDigestAlgorithm()
getDigestAlgorithm
in interface SignatureSigner
public void reset()
SignatureSigner
reset
in interface SignatureSigner
public void update(int data)
SignatureSigner
update
in interface SignatureSigner
data
- The byte to be hashed.public void update(byte[] data)
SignatureSigner
update
in interface SignatureSigner
data
- The message data to hash.public void update(byte[] data, int offset, int length)
SignatureSigner
update
in interface SignatureSigner
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.public int getRLength()
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.
public int getSLength()
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.
public void sign(byte[] r, int rOffset, byte[] s, int sOffset) throws CryptoTokenException, CryptoUnsupportedOperationException
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.
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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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