1 /*
2 * GordianKnot: Security Suite
3 * Copyright 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
18 package io.github.tonywasher.joceanus.gordianknot.api.cipher;
19
20 import io.github.tonywasher.joceanus.gordianknot.api.base.GordianKeySpec;
21 import io.github.tonywasher.joceanus.gordianknot.api.cipher.spec.GordianPBESpec;
22 import io.github.tonywasher.joceanus.gordianknot.api.key.GordianKey;
23
24 /**
25 * Cipher Parameters.
26 */
27 public interface GordianCipherParams {
28 /**
29 * Key Parameters.
30 *
31 * @param <T> the keyType
32 */
33 interface GordianKeyCipherParameters<T extends GordianKeySpec>
34 extends GordianCipherParams {
35 /**
36 * Obtain the key.
37 *
38 * @return the key
39 */
40 GordianKey<T> getKey();
41 }
42
43 /**
44 * Nonce Parameters.
45 */
46 interface GordianNewNonceParameters {
47 /**
48 * Was a random Nonce requested?.
49 *
50 * @return true/false
51 */
52 boolean randomNonce();
53
54 /**
55 * Obtain the nonce.
56 *
57 * @return the nonce
58 */
59 byte[] getNonce();
60 }
61
62 /**
63 * KeyAndNonce Parameters.
64 *
65 * @param <T> the keyType
66 */
67 interface GordianKeyAndNonceCipherParameters<T extends GordianKeySpec>
68 extends GordianKeyCipherParameters<T>, GordianNewNonceParameters {
69 }
70
71 /**
72 * AEAD Parameters.
73 *
74 * @param <T> the keyType
75 */
76 interface GordianAEADCipherParameters<T extends GordianKeySpec>
77 extends GordianKeyAndNonceCipherParameters<T> {
78 /**
79 * Obtain the initialAEAD.
80 *
81 * @return the initialAEAD
82 */
83 byte[] getInitialAEAD();
84 }
85
86 /**
87 * PBE Parameters.
88 */
89 interface GordianPBECipherParameters
90 extends GordianCipherParams, GordianNewNonceParameters {
91 /**
92 * Obtain the PBESpec.
93 *
94 * @return the PBESpec
95 */
96 GordianPBESpec getPBESpec();
97
98 /**
99 * Obtain the password.
100 *
101 * @return the password
102 */
103 char[] getPassword();
104 }
105 }