The ISignature Interface

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.

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.

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.

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.