gnu.crypto.sig

Class BaseSignature

public abstract class BaseSignature extends Object implements ISignature

A base abstract class to facilitate implementations of concrete Signatures.

Version: $Revision: 1.8 $

Field Summary
protected IMessageDigestmd
The underlying message digest instance for this signature scheme.
protected PrivateKeyprivateKey
The private key to use when generating signatures (signing).
protected PublicKeypublicKey
The public key to use when verifying signatures.
protected StringschemeName
The canonical name of this signature scheme.
Constructor Summary
protected BaseSignature(String schemeName, IMessageDigest md)

Trivial constructor.

Method Summary
abstract Objectclone()
protected abstract ObjectgenerateSignature()
protected voidinit()
Initialises the internal fields of this instance.
Stringname()
protected voidnextRandomBytes(byte[] buffer)

Fills the designated byte array with random data.

protected abstract voidsetupForSigning(PrivateKey key)
protected abstract voidsetupForVerification(PublicKey key)
voidsetupSign(Map attributes)
voidsetupVerify(Map attributes)
Objectsign()
voidupdate(byte b)
voidupdate(byte[] b, int off, int len)
booleanverify(Object sig)
protected abstract booleanverifySignature(Object signature)

Field Detail

md

protected IMessageDigest md
The underlying message digest instance for this signature scheme.

privateKey

protected PrivateKey privateKey
The private key to use when generating signatures (signing).

publicKey

protected PublicKey publicKey
The public key to use when verifying signatures.

schemeName

protected String schemeName
The canonical name of this signature scheme.

Constructor Detail

BaseSignature

protected BaseSignature(String schemeName, IMessageDigest md)

Trivial constructor.

Parameters: schemeName the name of this signature scheme. md the underlying instance of the message digest algorithm.

Method Detail

clone

public abstract Object clone()

generateSignature

protected abstract Object generateSignature()

init

protected void init()
Initialises the internal fields of this instance.

name

public String name()

nextRandomBytes

protected void nextRandomBytes(byte[] buffer)

Fills the designated byte array with random data.

Parameters: buffer the byte array to fill with random data.

setupForSigning

protected abstract void setupForSigning(PrivateKey key)

setupForVerification

protected abstract void setupForVerification(PublicKey key)

setupSign

public void setupSign(Map attributes)

setupVerify

public void setupVerify(Map attributes)

sign

public Object sign()

update

public void update(byte b)

update

public void update(byte[] b, int off, int len)

verify

public boolean verify(Object sig)

verifySignature

protected abstract boolean verifySignature(Object signature)
Copyright © 2001, 2002, 2003 Free Software Foundation, Inc. All Rights Reserved.