|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.motorola.iden.security.Signature
This Signature class is used to provide applications the functionality of a digital signature algorithm. Digital signatures are used for authentication and integrity assurance of digital data.
The signature algorithm can be, among others, ECDSA, using ECDSA and SHA-1. The DSA algorithm using the SHA-1 message digest algorithm can be specified as ECDSA. In the case of RSA, there are multiple choices for the message digest algorithm, so the signing algorithm could be specified as, for example, MD5withRSA, or SHA1withRSA. The algorithm name must be specified, as there is no default.
MOTOROLA and the Stylized M Logo are registered trademarks of Motorola, Inc. Reg. U.S. Pat. & Tm. Off.
Field Summary | |
protected static int |
SIGN
Possible state value, signifying that this signature has been initialized for signing. |
protected int |
state
Current state of this signature object. |
protected static int |
UNINITIALIZED
Possible state value, signifying that this signature has not yet been initialized. |
protected static int |
VERIFY
Possible state value, signifying that this signature has been initialized for verifying. |
Constructor Summary | |
protected |
Signature(SignatureSpi signaturespi)
Creates a Signature object. |
Method Summary | |
static Signature |
getInstance(java.lang.String algorithm)
Generates a Signature object that implements the signature algorithm. |
AlgorithmParameterSpec |
getParameter()
The returned parameters may be the same that were used to initialize this signature engine, or may contain a combination of default and randomly generated parameter values used by the underlying signature implementation if this signature engine requires algorithm parameters but was not initialized with any. |
void |
initSign(PrivateKey privateKey)
Initialize this object for signing. |
void |
initVerify(PublicKey publicKey)
Initializes this object for verification. |
void |
setParameter(AlgorithmParameterSpec params)
Setup the parameters for signing or verifying. |
byte[] |
sign()
Returns the signature bytes of the input data. |
void |
update(byte[] data,
int offset,
int len)
Updates the data to be signed or verified, using the specified array of bytes, starting at the specified offset. |
boolean |
verify(byte[] signature)
Verifies the passed-in signature in the specified array of bytes, starting at the specified offset. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final int UNINITIALIZED
protected static final int SIGN
protected static final int VERIFY
protected int state
Constructor Detail |
protected Signature(SignatureSpi signaturespi)
signaturespi
- the instance of an algorithm which implements SignatureSpiMethod Detail |
public static Signature getInstance(java.lang.String algorithm) throws NoSuchAlgorithmException
algorithm
- name of the algorithm. ECDSA, MD5withRSA and
SHA1withRSA are available in current implementation.public final void initSign(PrivateKey privateKey) throws InvalidKeyException
privateKey
- the private key of the identity whose signature
is going to be generated.
InvalidKeyException
- if the key is invalid.public final void initVerify(PublicKey publicKey) throws InvalidKeyException
publicKey
- the public key of the identity whose signature is
going to be verified.
InvalidKeyException
- if the key is invalid.public final void update(byte[] data, int offset, int len) throws SignatureException
data
- the array of bytes.offset
- the offset to start from in the array of bytes.len
- the number of bytes to use, starting at offset.SignatureException
- if this signature object is not
initialized properly.public final byte[] sign() throws SignatureException
initSign(PrivateKey)
.
SignatureException
- if this signature object is not
initialized properly or input is null.public final boolean verify(byte[] signature) throws SignatureException
A call to this method resets this signature object to the state
it was in when previously initialized for verification via a
call to initVerify(PublicKey)
.
signature
- the signature bytes to be verified.
SignatureException
- if this signature object is not
initialized properly or the input signature is null.public void setParameter(AlgorithmParameterSpec params) throws InvalidAlgorithmParameterException
params
- the parameters
InvalidAlgorithmParameterException
- if this method is
overridden by a provider and the the given parameters
are inappropriate for this signature enginepublic AlgorithmParameterSpec getParameter()
The returned parameters may be the same that were used to initialize this signature engine, or may contain a combination of default and randomly generated parameter values used by the underlying signature implementation if this signature engine requires algorithm parameters but was not initialized with any.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |