Signer.java revision e6bf3e8dfa2804891a82075cb469b736321b4827
1package org.bouncycastle.crypto;
2
3/**
4 * Generic signer interface for hash based and message recovery signers.
5 */
6public interface Signer
7{
8    /**
9     * Initialise the signer for signing or verification.
10     *
11     * @param forSigning true if for signing, false otherwise
12     * @param param necessary parameters.
13     */
14    public void init(boolean forSigning, CipherParameters param);
15
16    /**
17     * update the internal digest with the byte b
18     */
19    public void update(byte b);
20
21    /**
22     * update the internal digest with the byte array in
23     */
24    public void update(byte[] in, int off, int len);
25
26    /**
27     * generate a signature for the message we've been loaded with using
28     * the key we were initialised with.
29     */
30    public byte[] generateSignature()
31        throws CryptoException, DataLengthException;
32
33    /**
34     * return true if the internal state represents the signature described
35     * in the passed in array.
36     */
37    public boolean verifySignature(byte[] signature);
38
39    /**
40     * reset the internal state
41     */
42    public void reset();
43}
44