1 package org.bouncycastle.crypto; 2 3 import java.math.BigInteger; 4 5 /** 6 * interface for classes implementing algorithms modeled similar to the Digital Signature Alorithm. 7 */ 8 public interface DSA 9 { 10 /** 11 * initialise the signer for signature generation or signature 12 * verification. 13 * 14 * @param forSigning true if we are generating a signature, false 15 * otherwise. 16 * @param param key parameters for signature generation. 17 */ init(boolean forSigning, CipherParameters param)18 public void init(boolean forSigning, CipherParameters param); 19 20 /** 21 * sign the passed in message (usually the output of a hash function). 22 * 23 * @param message the message to be signed. 24 * @return two big integers representing the r and s values respectively. 25 */ generateSignature(byte[] message)26 public BigInteger[] generateSignature(byte[] message); 27 28 /** 29 * verify the message message against the signature values r and s. 30 * 31 * @param message the message that was supposed to have been signed. 32 * @param r the r signature value. 33 * @param s the s signature value. 34 */ verifySignature(byte[] message, BigInteger r, BigInteger s)35 public boolean verifySignature(byte[] message, BigInteger r, BigInteger s); 36 } 37