|
5 | 5 |
|
6 | 6 | import org.bouncycastle.asn1.x509.AlgorithmIdentifier; |
7 | 7 | import org.bouncycastle.crypto.AsymmetricCipherKeyPair; |
8 | | -import org.bouncycastle.crypto.CipherParameters; |
9 | 8 | import org.bouncycastle.crypto.EncapsulatedSecretExtractor; |
10 | 9 | import org.bouncycastle.crypto.EncapsulatedSecretGenerator; |
11 | 10 | import org.bouncycastle.crypto.SecretWithEncapsulation; |
12 | 11 | import org.bouncycastle.crypto.params.AsymmetricKeyParameter; |
13 | 12 | import org.bouncycastle.crypto.util.DEROtherInfo; |
14 | | -import org.bouncycastle.crypto.generators.MLKEMKeyPairGenerator; |
15 | | -import org.bouncycastle.crypto.kems.MLKEMExtractor; |
16 | | -import org.bouncycastle.crypto.kems.MLKEMGenerator; |
17 | | -import org.bouncycastle.crypto.params.MLKEMKeyGenerationParameters; |
18 | | -import org.bouncycastle.crypto.params.MLKEMParameters; |
19 | | -import org.bouncycastle.crypto.params.MLKEMPrivateKeyParameters; |
| 13 | +import org.bouncycastle.pqc.crypto.KEMParameters; |
20 | 14 | import org.bouncycastle.pqc.crypto.ntru.NTRUKEMExtractor; |
21 | 15 | import org.bouncycastle.pqc.crypto.ntru.NTRUKEMGenerator; |
22 | 16 | import org.bouncycastle.pqc.crypto.ntru.NTRUKeyGenerationParameters; |
@@ -67,21 +61,11 @@ public static class PartyU |
67 | 61 | * @param partyVInfo receiver party info. |
68 | 62 | * @param random a source of randomness. |
69 | 63 | */ |
70 | | - public PartyU(CipherParameters kemParams, AlgorithmIdentifier algorithmID, byte[] partyUInfo, byte[] partyVInfo, SecureRandom random) |
| 64 | + public PartyU(KEMParameters kemParams, AlgorithmIdentifier algorithmID, byte[] partyUInfo, byte[] partyVInfo, SecureRandom random) |
71 | 65 | { |
72 | 66 | super(algorithmID, partyUInfo, partyVInfo, random); |
73 | 67 |
|
74 | | - if (kemParams instanceof MLKEMParameters) |
75 | | - { |
76 | | - MLKEMKeyPairGenerator kPg = new MLKEMKeyPairGenerator(); |
77 | | - |
78 | | - kPg.init(new MLKEMKeyGenerationParameters(random, (MLKEMParameters)kemParams)); |
79 | | - |
80 | | - aKp = kPg.generateKeyPair(); |
81 | | - |
82 | | - encSE = new MLKEMExtractor((MLKEMPrivateKeyParameters)aKp.getPrivate()); |
83 | | - } |
84 | | - else if (kemParams instanceof NTRUParameters) |
| 68 | + if (kemParams instanceof NTRUParameters) |
85 | 69 | { |
86 | 70 | NTRUKeyPairGenerator kPg = new NTRUKeyPairGenerator(); |
87 | 71 |
|
@@ -140,15 +124,11 @@ public static class PartyV |
140 | 124 | * @param partyVInfo receiver party info. |
141 | 125 | * @param random a source of randomness. |
142 | 126 | */ |
143 | | - public PartyV(CipherParameters kemParams, AlgorithmIdentifier algorithmID, byte[] partyUInfo, byte[] partyVInfo, SecureRandom random) |
| 127 | + public PartyV(KEMParameters kemParams, AlgorithmIdentifier algorithmID, byte[] partyUInfo, byte[] partyVInfo, SecureRandom random) |
144 | 128 | { |
145 | 129 | super(algorithmID, partyUInfo, partyVInfo, random); |
146 | 130 |
|
147 | | - if (kemParams instanceof MLKEMParameters) |
148 | | - { |
149 | | - encSG = new MLKEMGenerator(random); |
150 | | - } |
151 | | - else if (kemParams instanceof NTRUParameters) |
| 131 | + if (kemParams instanceof NTRUParameters) |
152 | 132 | { |
153 | 133 | encSG = new NTRUKEMGenerator(random); |
154 | 134 | } |
|
0 commit comments