1 /** 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package org.apache.geronimo.util.crypto; 19 20 import java.math.BigInteger; 21 22 /** 23 * interface for classes implementing algorithms modeled similar to the Digital Signature Alorithm. 24 */ 25 public interface DSA 26 { 27 /** 28 * initialise the signer for signature generation or signature 29 * verification. 30 * 31 * @param forSigning true if we are generating a signature, false 32 * otherwise. 33 * @param param key parameters for signature generation. 34 */ 35 public void init(boolean forSigning, CipherParameters param); 36 37 /** 38 * sign the passed in message (usually the output of a hash function). 39 * 40 * @param message the message to be signed. 41 * @return two big integers representing the r and s values respectively. 42 */ 43 public BigInteger[] generateSignature(byte[] message); 44 45 /** 46 * verify the message message against the signature values r and s. 47 * 48 * @param message the message that was supposed to have been signed. 49 * @param r the r signature value. 50 * @param s the s signature value. 51 */ 52 public boolean verifySignature(byte[] message, BigInteger r, BigInteger s); 53 } 54