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