The ISignature Interface
diagrams/sig_class_diag.png
Figure 14: Signature class diagram
All digital signature schemes implement the
ISignature interface,
and support the following methods:
java.lang.String SIGNER_KEY
Variable
A property name in the attributes map that is passed to instances being
prepared for signing. The value mapped by this key must be a
java.security.PrivateKey that is appropriate for the instance's
algorithm (e.g. an instance of DSS would require a subclass of
java.security.interfaces.DSAPrivateKey).
java.lang.String VERIFIER_KEY
Variable
A property name in the attributes map that is passed to instances being
prepared for verifying a signature. The value mapped by this key must be
a java.security.PublicKey that is appropriate for the instance's
algorithm, just as is the case with the signing key.
java.lang.String SOURCE_OF_RANDOMNESS
Variable
A property name in the attributes map that is passed to instances being
prepared for use as either signers or verifiers. The value mapped must
be an already-initialized instance of gnu.crypto.prng.IRandom.
void setupSign(java.util.Map attributes) throws java.lang.IllegalArgumentException
Function
Initializes this instance for signing. The attributes parameter
must be a java.util.Map that has, at least, a mapping between the
SIGNER_KEY property and the appropriate private key.
void setupVerify(java.util.Map attributes) throws java.lang.IllegalArgumentException
Function
Initializes this instance for verifying a signature. The
attributes parameter must be a java.util.Map that has, at
least, a mapping between the VERIFIER_KEY property and the
appropriate public key.
void update(byte b) throws java.lang.IllegalStateException
Function
Update either the signing or verifying operation with the next byte in
the message. This method will throw a java.lang.IllegalStateException if
this instance has not been initialized for either signing or verifying.
void update(byte[]buf, int off, int len) throws java.lang.IllegalStateException
Function
Update either the signing or verifying operation with the next len
bytes of buf, starting at offset. This method will throw a
java.lang.IllegalStateException if this instance has not been
initialized for either signing or verifying.
java.lang.Object sign() throws java.lang.IllegalStateException
Function
Finishes a signing operation and returns the final signature. This method
will throw a java.lang.IllegalStateException if this instance has not
been initialized for signing.
boolean verify(java.lang.Object signature) throws java.lang.IllegalStateException
Function
Finishes a verifying operation by checking if the argument, a native signature
object, matches the expected signature. This methods returns true if
the signature is valid, false otherwise. This method will throw a
java.lang.IllegalStateException if this instance has not been
initialized for verifying.
java.lang.String name()
Function
Returns the canonical name of this instance's signature algorithm.
java.lang.Object clone()
Function
Returns a copy of this signature object.