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