1 /*
2 * GordianKnot: Security Suite
3 * Copyright 2012-2026. Tony Washer
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy
7 * 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, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17 package io.github.tonywasher.joceanus.gordianknot.api.sign;
18
19 import io.github.tonywasher.joceanus.gordianknot.api.base.GordianConsumer;
20 import io.github.tonywasher.joceanus.gordianknot.api.base.GordianException;
21
22 /**
23 * GordianKnot base for signature.
24 */
25 public interface GordianSignature
26 extends GordianConsumer {
27 /**
28 * Obtain the signatureSpec.
29 *
30 * @return the Spec
31 */
32 GordianSignatureSpec getSignatureSpec();
33
34 /**
35 * Initialise for signature.
36 *
37 * @param pParams the parameters
38 * @throws GordianException on error
39 */
40 void initForSigning(GordianSignParams pParams) throws GordianException;
41
42 /**
43 * Initialise for verify.
44 *
45 * @param pParams the parameters
46 * @throws GordianException on error
47 */
48 void initForVerify(GordianSignParams pParams) throws GordianException;
49
50 /**
51 * Complete the signature operation and return the signature bytes.
52 *
53 * @return the signature
54 * @throws GordianException on error
55 */
56 byte[] sign() throws GordianException;
57
58 /**
59 * Verify the signature against the supplied signature bytes.
60 *
61 * @param pSignature the supplied signature
62 * @return the signature
63 * @throws GordianException on error
64 */
65 boolean verify(byte[] pSignature) throws GordianException;
66 }