All digital signature schemes implement the ISignature
interface,
and support the following methods:
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 ofjava.security.interfaces.DSAPrivateKey
).
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.
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 signing. The attributes parameter must be a
java.util.Map
that has, at least, a mapping between theSIGNER_KEY
property and the appropriate private key.
Initializes this instance for verifying a signature. The attributes parameter must be a
java.util.Map
that has, at least, a mapping between theVERIFIER_KEY
property and the appropriate public key.
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.
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 ajava.lang.IllegalStateException
if this instance has not been initialized for verifying.