|
For the latest news and information visit The GNU Crypto project |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--gnu.crypto.sig.BaseSignature
A base abstract class to facilitate implementations of concrete Signatures.
| Field Summary | |
|---|---|
protected IMessageDigest |
md
The underlying message digest instance for this signature scheme. |
protected java.security.PrivateKey |
privateKey
The private key to use when generating signatures (signing). |
protected java.security.PublicKey |
publicKey
The public key to use when verifying signatures. |
protected java.lang.String |
schemeName
The canonical name of this signature scheme. |
| Fields inherited from interface gnu.crypto.sig.ISignature |
|---|
SIGNER_KEY, SOURCE_OF_RANDOMNESS, VERIFIER_KEY |
| Constructor Summary | |
|---|---|
protected |
BaseSignature(java.lang.String schemeName,
IMessageDigest md)
Trivial constructor. |
| Method Summary | |
|---|---|
abstract java.lang.Object |
clone()
Returns a clone copy of this instance. |
protected abstract java.lang.Object |
generateSignature()
|
protected void |
init()
Initialises the internal fields of this instance. |
java.lang.String |
name()
Returns the canonical name of this signature scheme. |
protected void |
nextRandomBytes(byte[] buffer)
Fills the designated byte array with random data. |
protected abstract void |
setupForSigning(java.security.PrivateKey key)
|
protected abstract void |
setupForVerification(java.security.PublicKey key)
|
void |
setupSign(java.util.Map attributes)
Initialises this instance for signature generation. |
void |
setupVerify(java.util.Map attributes)
Initialises this instance for signature verification. |
java.lang.Object |
sign()
Terminates a signature generation phase by digesting and processing the context of the underlying message digest algorithm instance. |
void |
update(byte b)
Digests one byte of a message for signing or verification purposes. |
void |
update(byte[] b,
int off,
int len)
Digests a sequence of bytes from a message for signing or verification purposes. |
boolean |
verify(java.lang.Object sig)
Terminates a signature verification phase by digesting and processing the context of the underlying message digest algorithm instance. |
protected abstract boolean |
verifySignature(java.lang.Object signature)
|
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.lang.String schemeName
protected IMessageDigest md
protected java.security.PublicKey publicKey
protected java.security.PrivateKey privateKey
| Constructor Detail |
protected BaseSignature(java.lang.String schemeName,
IMessageDigest md)
Trivial constructor.
schemeName - the name of this signature scheme.md - the underlying instance of the message digest algorithm.| Method Detail |
public java.lang.String name()
ISignatureReturns the canonical name of this signature scheme.
name in interface ISignature
public void setupVerify(java.util.Map attributes)
throws java.lang.IllegalArgumentException
ISignatureInitialises this instance for signature verification.
setupVerify in interface ISignatureattributes - the attributes to use for setting up this instance.
java.lang.IllegalArgumentException - if the designated public key is not
appropriate for this signature scheme.ISignature.SOURCE_OF_RANDOMNESS,
ISignature.VERIFIER_KEY
public void setupSign(java.util.Map attributes)
throws java.lang.IllegalArgumentException
ISignatureInitialises this instance for signature generation.
setupSign in interface ISignatureattributes - the attributes to use for setting up this instance.
java.lang.IllegalArgumentException - if the designated private key is not
appropriate for this signature scheme.ISignature.SOURCE_OF_RANDOMNESS,
ISignature.SIGNER_KEYpublic void update(byte b)
ISignatureDigests one byte of a message for signing or verification purposes.
update in interface ISignatureb - the message byte to digest.
public void update(byte[] b,
int off,
int len)
ISignatureDigests a sequence of bytes from a message for signing or verification purposes.
update in interface ISignatureb - the byte sequence to consider.off - the byte poisition in buffer of the first byte
to consider.len - the number of bytes in buffer starting from the
byte at index offset to digest.public java.lang.Object sign()
ISignatureTerminates a signature generation phase by digesting and processing the context of the underlying message digest algorithm instance.
sign in interface ISignatureObject representing the native output of the signature
scheme implementation.public boolean verify(java.lang.Object sig)
ISignatureTerminates a signature verification phase by digesting and processing the context of the underlying message digest algorithm instance.
verify in interface ISignaturesig - a native signature object previously generated by an
invocation of the sign() method.
true iff the outpout of the verification phase
confirms that the designated signature object has been generated using the
corresponding public key of the recepient.public abstract java.lang.Object clone()
ISignatureReturns a clone copy of this instance.
clone in interface ISignatureclone in class java.lang.Object
protected abstract void setupForVerification(java.security.PublicKey key)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
protected abstract void setupForSigning(java.security.PrivateKey key)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
protected abstract java.lang.Object generateSignature()
throws java.lang.IllegalStateException
java.lang.IllegalStateException
protected abstract boolean verifySignature(java.lang.Object signature)
throws java.lang.IllegalStateException
java.lang.IllegalStateExceptionprotected void init()
protected void nextRandomBytes(byte[] buffer)
Fills the designated byte array with random data.
buffer - the byte array to fill with random data.
|
For the latest news and information visit The GNU Crypto project |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||