1 /*
2 * GordianKnot: Security Suite
3 * Copyright 2012-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 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.hqc.HQCParameters;
22 import org.bouncycastle.pqc.jcajce.spec.HQCParameterSpec;
23
24 /**
25 * HQC KeySpec.
26 */
27 public enum GordianHQCSpec {
28 /**
29 * HQC 128.
30 */
31 HQC128,
32
33 /**
34 * HQC 192.
35 */
36 HQC192,
37
38 /**
39 * HQC 256.
40 */
41 HQC256;
42
43 /**
44 * Obtain HQC Parameters.
45 *
46 * @return the parameters.
47 */
48 public HQCParameters getParameters() {
49 switch (this) {
50 case HQC128:
51 return HQCParameters.hqc128;
52 case HQC192:
53 return HQCParameters.hqc192;
54 case HQC256:
55 return HQCParameters.hqc256;
56 default:
57 throw new IllegalArgumentException();
58 }
59 }
60
61 /**
62 * Obtain HQC ParameterSpec.
63 *
64 * @return the parameters.
65 */
66 public HQCParameterSpec getParameterSpec() {
67 switch (this) {
68 case HQC128:
69 return HQCParameterSpec.hqc128;
70 case HQC192:
71 return HQCParameterSpec.hqc192;
72 case HQC256:
73 return HQCParameterSpec.hqc256;
74 default:
75 throw new IllegalArgumentException();
76 }
77 }
78
79 /**
80 * Obtain HQC algorithm Identifier.
81 *
82 * @return the identifier.
83 */
84 public ASN1ObjectIdentifier getIdentifier() {
85 switch (this) {
86 case HQC128:
87 return BCObjectIdentifiers.hqc128;
88 case HQC192:
89 return BCObjectIdentifiers.hqc192;
90 case HQC256:
91 return BCObjectIdentifiers.hqc256;
92 default:
93 throw new IllegalArgumentException();
94 }
95 }
96 }