Next: , Previous: Signatures, Up: Signatures


9.1 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:

— Variable: java.lang.String SIGNER_KEY

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).

— Variable: java.lang.String VERIFIER_KEY

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.

— Variable: java.lang.String SOURCE_OF_RANDOMNESS

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.

— Function: void setupSign (java.util.Map attributes) throws java.lang.IllegalArgumentException

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.

— Function: void setupVerify (java.util.Map attributes) throws java.lang.IllegalArgumentException

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.

— Function: void update (byte b) throws java.lang.IllegalStateException

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.

— Function: void update (byte[] buf, int off, int len) throws java.lang.IllegalStateException

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.

— Function: java.lang.Object sign () throws java.lang.IllegalStateException

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.

— Function: boolean verify (java.lang.Object signature) throws java.lang.IllegalStateException

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.

— Function: java.lang.String name ()

Returns the canonical name of this instance's signature algorithm.

— Function: java.lang.Object clone ()

Returns a copy of this signature object.