org.logi.crypto.keys
Interface SignatureKey

All Superinterfaces:
Key
All Known Implementing Classes:
DHKey, RSAKey

public interface SignatureKey
extends Key

This interface is implemented by keys that can be used to create and validate signatures on fingerprints of data.

Author:
Logi Ragnarsson (logir@logi.org)

Method Summary
 Signature sign(Fingerprint fp)
          Create a signature for a Fingerprint with a private key.
 int signatureSize()
          Returns the length of a signature in bytes.
 int signBlockSize()
          Returns the maximum size in bytes of the fingerprints that can be signed.
 boolean verify(Signature s, Fingerprint fp)
          Verify a Signature on a Fingerprint.
 
Methods inherited from interface org.logi.crypto.keys.Key
getAlgorithm, getFingerprint, getFingerprint, getSize, hashCode, isPrivate, matches, matchFingerprint, matchFingerprint
 

Method Detail

signBlockSize

public int signBlockSize()
Returns the maximum size in bytes of the fingerprints that can be signed.

signatureSize

public int signatureSize()
Returns the length of a signature in bytes.

sign

public Signature sign(Fingerprint fp)
               throws KeyException
Create a signature for a Fingerprint with a private key.
Throws:
KeyException - if the key modulus is shorter than the signature.
KeyException - if this is not a private key

verify

public boolean verify(Signature s,
                      Fingerprint fp)
               throws KeyException
Verify a Signature on a Fingerprint.

In the case of an asymmetric algorithm, this method can only be called on the public key in a pair and verifies signatures generated with the private key in the pair.

In the case of a symmetric algorithm, this method verifies signatures generated with the same key.

Throws:
KeyException - if this is a private key for an asymmetric algorithm


Copyright 1997-2000 Logi Ragnarsson