1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package io.github.tonywasher.joceanus.gordianknot.api.cipher.spec;
19
20 import io.github.tonywasher.joceanus.gordianknot.api.base.GordianLength;
21 import io.github.tonywasher.joceanus.gordianknot.api.cipher.spec.GordianStreamKeySubType.GordianChaCha20Key;
22 import io.github.tonywasher.joceanus.gordianknot.api.cipher.spec.GordianStreamKeySubType.GordianElephantKey;
23 import io.github.tonywasher.joceanus.gordianknot.api.cipher.spec.GordianStreamKeySubType.GordianISAPKey;
24 import io.github.tonywasher.joceanus.gordianknot.api.cipher.spec.GordianStreamKeySubType.GordianRomulusKey;
25 import io.github.tonywasher.joceanus.gordianknot.api.cipher.spec.GordianStreamKeySubType.GordianSalsa20Key;
26 import io.github.tonywasher.joceanus.gordianknot.api.cipher.spec.GordianStreamKeySubType.GordianSkeinXofKey;
27 import io.github.tonywasher.joceanus.gordianknot.api.cipher.spec.GordianStreamKeySubType.GordianSparkleKey;
28 import io.github.tonywasher.joceanus.gordianknot.api.cipher.spec.GordianStreamKeySubType.GordianVMPCKey;
29
30
31
32
33 public interface GordianStreamKeySpecBuilder {
34
35
36
37
38
39
40 GordianStreamKeySpecBuilder withType(GordianStreamKeyType pType);
41
42
43
44
45
46
47
48 GordianStreamKeySpecBuilder withSubType(GordianStreamKeySubType pSubType);
49
50
51
52
53
54
55
56 GordianStreamKeySpecBuilder withKeyLength(GordianLength pKeyLength);
57
58
59
60
61
62
63 GordianStreamKeySpec build();
64
65
66
67
68
69
70
71
72
73 default GordianStreamKeySpec streamKey(final GordianStreamKeyType pKeyType,
74 final GordianLength pKeyLength,
75 final GordianStreamKeySubType pSubType) {
76 return withType(pKeyType).withKeyLength(pKeyLength).withSubType(pSubType).build();
77 }
78
79
80
81
82
83
84
85 default GordianStreamKeySpec hc(final GordianLength pKeyLength) {
86 return withType(GordianStreamKeyType.HC).withKeyLength(pKeyLength).build();
87 }
88
89
90
91
92
93
94
95 default GordianStreamKeySpec chacha(final GordianLength pKeyLength) {
96 return withType(GordianStreamKeyType.CHACHA20).withKeyLength(pKeyLength).build();
97 }
98
99
100
101
102
103
104
105 default GordianStreamKeySpec chacha7539(final GordianLength pKeyLength) {
106 return withType(GordianStreamKeyType.CHACHA20).withSubType(GordianChaCha20Key.ISO7539).withKeyLength(pKeyLength).build();
107 }
108
109
110
111
112
113
114
115 default GordianStreamKeySpec xchacha(final GordianLength pKeyLength) {
116 return withType(GordianStreamKeyType.CHACHA20).withSubType(GordianChaCha20Key.XCHACHA).withKeyLength(pKeyLength).build();
117 }
118
119
120
121
122
123
124
125 default GordianStreamKeySpec salsa(final GordianLength pKeyLength) {
126 return withType(GordianStreamKeyType.SALSA20).withKeyLength(pKeyLength).build();
127 }
128
129
130
131
132
133
134
135 default GordianStreamKeySpec xsalsa(final GordianLength pKeyLength) {
136 return withType(GordianStreamKeyType.SALSA20).withSubType(GordianSalsa20Key.XSALSA).withKeyLength(pKeyLength).build();
137 }
138
139
140
141
142
143
144
145 default GordianStreamKeySpec isaac(final GordianLength pKeyLength) {
146 return withType(GordianStreamKeyType.ISAAC).withKeyLength(pKeyLength).build();
147 }
148
149
150
151
152
153
154
155 default GordianStreamKeySpec rc4(final GordianLength pKeyLength) {
156 return withType(GordianStreamKeyType.RC4).withKeyLength(pKeyLength).build();
157 }
158
159
160
161
162
163
164
165 default GordianStreamKeySpec vmpc(final GordianLength pKeyLength) {
166 return withType(GordianStreamKeyType.VMPC).withKeyLength(pKeyLength).build();
167 }
168
169
170
171
172
173
174
175 default GordianStreamKeySpec vmpcKSA(final GordianLength pKeyLength) {
176 return withType(GordianStreamKeyType.VMPC).withSubType(GordianVMPCKey.KSA).withKeyLength(pKeyLength).build();
177 }
178
179
180
181
182
183
184
185 default GordianStreamKeySpec grain(final GordianLength pKeyLength) {
186 return withType(GordianStreamKeyType.GRAIN).withKeyLength(pKeyLength).build();
187 }
188
189
190
191
192
193
194
195 default GordianStreamKeySpec rabbit(final GordianLength pKeyLength) {
196 return withType(GordianStreamKeyType.RABBIT).withKeyLength(pKeyLength).build();
197 }
198
199
200
201
202
203
204
205 default GordianStreamKeySpec sosemanuk(final GordianLength pKeyLength) {
206 return withType(GordianStreamKeyType.SOSEMANUK).withKeyLength(pKeyLength).build();
207 }
208
209
210
211
212
213
214
215 default GordianStreamKeySpec snow3G(final GordianLength pKeyLength) {
216 return withType(GordianStreamKeyType.SNOW3G).withKeyLength(pKeyLength).build();
217 }
218
219
220
221
222
223
224
225 default GordianStreamKeySpec zuc(final GordianLength pKeyLength) {
226 return withType(GordianStreamKeyType.ZUC).withKeyLength(pKeyLength).build();
227 }
228
229
230
231
232
233
234
235
236 default GordianStreamKeySpec skeinXof(final GordianLength pKeyLength,
237 final GordianSkeinXofKey pStateLength) {
238 return withType(GordianStreamKeyType.SKEINXOF).withSubType(pStateLength).withKeyLength(pKeyLength).build();
239 }
240
241
242
243
244
245
246
247 default GordianStreamKeySpec blake2Xof(final GordianLength pKeyLength) {
248 return withType(GordianStreamKeyType.BLAKE2XOF).withKeyLength(pKeyLength).build();
249 }
250
251
252
253
254
255
256 default GordianStreamKeySpec blake3Xof() {
257 return withType(GordianStreamKeyType.BLAKE3XOF).build();
258 }
259
260
261
262
263
264
265 default GordianStreamKeySpec ascon() {
266 return withType(GordianStreamKeyType.ASCON).build();
267 }
268
269
270
271
272
273
274
275 default GordianStreamKeySpec elephant(final GordianElephantKey pSubSpec) {
276 return withType(GordianStreamKeyType.ELEPHANT).withSubType(pSubSpec).build();
277 }
278
279
280
281
282
283
284
285 default GordianStreamKeySpec isap(final GordianISAPKey pSubSpec) {
286 return withType(GordianStreamKeyType.ISAP).withSubType(pSubSpec).build();
287 }
288
289
290
291
292
293
294 default GordianStreamKeySpec photonBeetle() {
295 return withType(GordianStreamKeyType.PHOTONBEETLE).build();
296 }
297
298
299
300
301
302
303
304 default GordianStreamKeySpec romulus(final GordianRomulusKey pSubSpec) {
305 return withType(GordianStreamKeyType.ROMULUS).withSubType(pSubSpec).build();
306 }
307
308
309
310
311
312
313
314 default GordianStreamKeySpec sparkle(final GordianSparkleKey pSubSpec) {
315 return withType(GordianStreamKeyType.SPARKLE).withSubType(pSubSpec).build();
316 }
317
318
319
320
321
322
323 default GordianStreamKeySpec xoodyak() {
324 return withType(GordianStreamKeyType.XOODYAK).build();
325 }
326 }