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.cmce.CMCEParameters;
22 import org.bouncycastle.pqc.jcajce.spec.CMCEParameterSpec;
23
24
25
26
27 public enum GordianCMCESpec {
28
29
30
31 BASE3488,
32
33
34
35
36 PIVOT3488,
37
38
39
40
41 BASE4608,
42
43
44
45
46 PIVOT4608,
47
48
49
50
51 BASE6688,
52
53
54
55
56 PIVOT6688,
57
58
59
60
61 BASE6960,
62
63
64
65
66 PIVOT6960,
67
68
69
70
71 BASE8192,
72
73
74
75
76 PIVOT8192;
77
78
79
80
81
82
83 public CMCEParameters getParameters() {
84 switch (this) {
85 case BASE3488:
86 return CMCEParameters.mceliece348864r3;
87 case PIVOT3488:
88 return CMCEParameters.mceliece348864fr3;
89 case BASE4608:
90 return CMCEParameters.mceliece460896r3;
91 case PIVOT4608:
92 return CMCEParameters.mceliece460896fr3;
93 case BASE6688:
94 return CMCEParameters.mceliece6688128r3;
95 case PIVOT6688:
96 return CMCEParameters.mceliece6688128fr3;
97 case BASE6960:
98 return CMCEParameters.mceliece6960119r3;
99 case PIVOT6960:
100 return CMCEParameters.mceliece6960119fr3;
101 case BASE8192:
102 return CMCEParameters.mceliece8192128r3;
103 case PIVOT8192:
104 return CMCEParameters.mceliece8192128fr3;
105 default:
106 throw new IllegalArgumentException();
107 }
108 }
109
110
111
112
113
114
115 public CMCEParameterSpec getParameterSpec() {
116 switch (this) {
117 case BASE3488:
118 return CMCEParameterSpec.mceliece348864;
119 case PIVOT3488:
120 return CMCEParameterSpec.mceliece348864f;
121 case BASE4608:
122 return CMCEParameterSpec.mceliece460896;
123 case PIVOT4608:
124 return CMCEParameterSpec.mceliece460896f;
125 case BASE6688:
126 return CMCEParameterSpec.mceliece6688128;
127 case PIVOT6688:
128 return CMCEParameterSpec.mceliece6688128f;
129 case BASE6960:
130 return CMCEParameterSpec.mceliece6960119;
131 case PIVOT6960:
132 return CMCEParameterSpec.mceliece6960119f;
133 case BASE8192:
134 return CMCEParameterSpec.mceliece8192128;
135 case PIVOT8192:
136 return CMCEParameterSpec.mceliece8192128f;
137 default:
138 throw new IllegalArgumentException();
139 }
140 }
141
142
143
144
145
146
147 public ASN1ObjectIdentifier getIdentifier() {
148 switch (this) {
149 case BASE3488:
150 return BCObjectIdentifiers.mceliece348864_r3;
151 case PIVOT3488:
152 return BCObjectIdentifiers.mceliece348864f_r3;
153 case BASE4608:
154 return BCObjectIdentifiers.mceliece460896_r3;
155 case PIVOT4608:
156 return BCObjectIdentifiers.mceliece460896f_r3;
157 case BASE6688:
158 return BCObjectIdentifiers.mceliece6688128_r3;
159 case PIVOT6688:
160 return BCObjectIdentifiers.mceliece6688128f_r3;
161 case BASE6960:
162 return BCObjectIdentifiers.mceliece6960119_r3;
163 case PIVOT6960:
164 return BCObjectIdentifiers.mceliece6960119f_r3;
165 case BASE8192:
166 return BCObjectIdentifiers.mceliece8192128_r3;
167 case PIVOT8192:
168 return BCObjectIdentifiers.mceliece8192128f_r3;
169 default:
170 throw new IllegalArgumentException();
171 }
172 }
173 }