1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package io.github.tonywasher.joceanus.gordianknot.api.keypair;
18
19 import org.bouncycastle.asn1.ASN1ObjectIdentifier;
20 import org.bouncycastle.asn1.bc.BCObjectIdentifiers;
21 import org.bouncycastle.pqc.crypto.frodo.FrodoParameters;
22 import org.bouncycastle.pqc.jcajce.spec.FrodoParameterSpec;
23
24
25
26
27 public enum GordianFRODOSpec {
28
29
30
31 AES640,
32
33
34
35
36 SHAKE640,
37
38
39
40
41 AES976,
42
43
44
45
46 SHAKE976,
47
48
49
50
51 AES1344,
52
53
54
55
56 SHAKE1344;
57
58
59
60
61
62
63 public FrodoParameters getParameters() {
64 switch (this) {
65 case AES640:
66 return FrodoParameters.frodokem640aes;
67 case SHAKE640:
68 return FrodoParameters.frodokem640shake;
69 case AES976:
70 return FrodoParameters.frodokem976aes;
71 case SHAKE976:
72 return FrodoParameters.frodokem976shake;
73 case AES1344:
74 return FrodoParameters.frodokem1344aes;
75 case SHAKE1344:
76 return FrodoParameters.frodokem1344shake;
77 default:
78 throw new IllegalArgumentException();
79 }
80 }
81
82
83
84
85
86
87 public FrodoParameterSpec getParameterSpec() {
88 switch (this) {
89 case AES640:
90 return FrodoParameterSpec.frodokem640aes;
91 case SHAKE640:
92 return FrodoParameterSpec.frodokem640shake;
93 case AES976:
94 return FrodoParameterSpec.frodokem976aes;
95 case SHAKE976:
96 return FrodoParameterSpec.frodokem976shake;
97 case AES1344:
98 return FrodoParameterSpec.frodokem1344aes;
99 case SHAKE1344:
100 return FrodoParameterSpec.frodokem1344shake;
101 default:
102 throw new IllegalArgumentException();
103 }
104 }
105
106
107
108
109
110
111 public ASN1ObjectIdentifier getIdentifier() {
112 switch (this) {
113 case AES640:
114 return BCObjectIdentifiers.frodokem640aes;
115 case SHAKE640:
116 return BCObjectIdentifiers.frodokem640shake;
117 case AES976:
118 return BCObjectIdentifiers.frodokem976aes;
119 case SHAKE976:
120 return BCObjectIdentifiers.frodokem976shake;
121 case AES1344:
122 return BCObjectIdentifiers.frodokem1344aes;
123 case SHAKE1344:
124 return BCObjectIdentifiers.frodokem1344shake;
125 default:
126 throw new IllegalArgumentException();
127 }
128 }
129 }