|
SATSA - JSR177 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.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, the NIST standard DSA, using DSA and SHA-1. The DSA algorithm using the SHA-1 message digest algorithm can be specified as SHA1withDSA. In the case of RSA, there are multiple choices for the message digest algorithm, so the signing algorithm could be specified as, for example, MD2withRSA, MD5withRSA, or SHA1withRSA. The algorithm name must be specified, as there is no default. When an algorithm name is specified, the system will determine if there is an implementation of the algorithm requested available in the environment, and if there is more than one, if there is a preferred one.
A Signature
object can be used to generate and
verify digital signatures.
There are three phases to the use of a Signature
object for verifying a signature:
Depending on the type of initialization, this will update the bytes to be verified.
Method Summary | |
static Signature |
getInstance(String algorithm)
Generates a Signature object that implements
the specified digest
algorithm. |
void |
initVerify(PublicKey publicKey)
Initializes this object for verification. |
void |
update(byte[] data,
int off,
int len)
Updates the data to be verified, using the specified array of bytes, starting at the specified offset. |
boolean |
verify(byte[] signature)
Verifies the passed-in signature. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static Signature getInstance(String algorithm) throws NoSuchAlgorithmException
Signature
object that implements
the specified digest
algorithm.
algorithm
- the standard name of the algorithm requested.
See Appendix A in the
Java Cryptography Architecture API Specification & Reference
for information about standard algorithm names.
Signature
object.
NoSuchAlgorithmException
- if the algorithm is
not available in the environment.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 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)
. That is, the object is
reset and available to verify another signature from the identity
whose public key was specified in the call to initVerify
.
signature
- the signature bytes to be verified.
SignatureException
- if this signature object is not
initialized properly, or the passed-in signature is improperly
encoded or of the wrong type, etc.public final void update(byte[] data, int off, int len) throws SignatureException
data
- the array of bytes.off
- 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.
|
SATSA - JSR177 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |