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.ntru.NTRUParameters;
22 import org.bouncycastle.pqc.jcajce.spec.NTRUParameterSpec;
23
24
25
26
27 public enum GordianNTRUSpec {
28
29
30
31 HPS509,
32
33
34
35
36 HPS677,
37
38
39
40
41 HPS821,
42
43
44
45
46 HPS1229,
47
48
49
50
51 HRSS701,
52
53
54
55
56 HRSS1373;
57
58
59
60
61
62
63 public NTRUParameters getParameters() {
64 switch (this) {
65 case HPS509:
66 return NTRUParameters.ntruhps2048509;
67 case HPS677:
68 return NTRUParameters.ntruhps2048677;
69 case HPS821:
70 return NTRUParameters.ntruhps4096821;
71 case HPS1229:
72 return NTRUParameters.ntruhps40961229;
73 case HRSS701:
74 return NTRUParameters.ntruhrss701;
75 case HRSS1373:
76 return NTRUParameters.ntruhrss1373;
77 default:
78 throw new IllegalArgumentException();
79 }
80 }
81
82
83
84
85
86
87 public NTRUParameterSpec getParameterSpec() {
88 switch (this) {
89 case HPS509:
90 return NTRUParameterSpec.ntruhps2048509;
91 case HPS677:
92 return NTRUParameterSpec.ntruhps2048677;
93 case HPS821:
94 return NTRUParameterSpec.ntruhps4096821;
95 case HPS1229:
96 return NTRUParameterSpec.ntruhps40961229;
97 case HRSS701:
98 return NTRUParameterSpec.ntruhrss701;
99 case HRSS1373:
100 return NTRUParameterSpec.ntruhrss1373;
101 default:
102 throw new IllegalArgumentException();
103 }
104 }
105
106
107
108
109
110
111 public ASN1ObjectIdentifier getIdentifier() {
112 switch (this) {
113 case HPS509:
114 return BCObjectIdentifiers.ntruhps2048509;
115 case HPS677:
116 return BCObjectIdentifiers.ntruhps2048677;
117 case HPS821:
118 return BCObjectIdentifiers.ntruhps4096821;
119 case HPS1229:
120 return BCObjectIdentifiers.ntruhps40961229;
121 case HRSS701:
122 return BCObjectIdentifiers.ntruhrss701;
123 case HRSS1373:
124 return BCObjectIdentifiers.ntruhrss1373;
125 default:
126 throw new IllegalArgumentException();
127 }
128 }
129 }