Skip to content

Commit 4c8fe99

Browse files
committed
removed extra references to NIST OIDs.
1 parent bd65f15 commit 4c8fe99

File tree

6 files changed

+38
-29
lines changed

6 files changed

+38
-29
lines changed

pkix/src/main/java/org/bouncycastle/cms/DefaultCMSSignatureAlgorithmNameGenerator.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,13 @@ public DefaultCMSSignatureAlgorithmNameGenerator()
186186
simpleAlgs.put(BCObjectIdentifiers.sphincsPlus_shake_256s, "SPHINCS+-SHAKE-256s");
187187
simpleAlgs.put(BCObjectIdentifiers.sphincsPlus_shake_256f, "SPHINCS+-SHAKE-256f");
188188

189+
simpleAlgs.put(NISTObjectIdentifiers.id_slh_dsa_sha2_128s, "SLH-DSA-SHA2-128S");
190+
simpleAlgs.put(NISTObjectIdentifiers.id_slh_dsa_sha2_128f, "SLH-DSA-SHA2-128F");
191+
simpleAlgs.put(NISTObjectIdentifiers.id_slh_dsa_sha2_192s, "SLH-DSA-SHA2-192S");
192+
simpleAlgs.put(NISTObjectIdentifiers.id_slh_dsa_sha2_192f, "SLH-DSA-SHA2-192F");
193+
simpleAlgs.put(NISTObjectIdentifiers.id_slh_dsa_sha2_256s, "SLH-DSA-SHA2-256S");
194+
simpleAlgs.put(NISTObjectIdentifiers.id_slh_dsa_sha2_256s, "SLH-DSA-SHA2-256F");
195+
189196
simpleAlgs.put(BCObjectIdentifiers.picnic_signature, "Picnic");
190197
}
191198

pkix/src/main/java/org/bouncycastle/operator/DefaultSignatureAlgorithmIdentifierFinder.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,19 @@ public class DefaultSignatureAlgorithmIdentifierFinder
226226
algorithms.put("DILITHIUM3-AES", BCObjectIdentifiers.dilithium3_aes);
227227
algorithms.put("DILITHIUM5-AES", BCObjectIdentifiers.dilithium5_aes);
228228

229+
algorithms.put("SLH-DSA-SHA2-128S", NISTObjectIdentifiers.id_slh_dsa_sha2_128s);
230+
algorithms.put("SLH-DSA-SHA2-128F", NISTObjectIdentifiers.id_slh_dsa_sha2_128f);
231+
algorithms.put("SLH-DSA-SHA2-192S", NISTObjectIdentifiers.id_slh_dsa_sha2_192s);
232+
algorithms.put("SLH-DSA-SHA2-192F", NISTObjectIdentifiers.id_slh_dsa_sha2_192f);
233+
algorithms.put("SLH-DSA-SHA2-256S", NISTObjectIdentifiers.id_slh_dsa_sha2_256s);
234+
algorithms.put("SLH-DSA-SHA2-256F", NISTObjectIdentifiers.id_slh_dsa_sha2_256f);
235+
algorithms.put("SLH-DSA-SHAKE-128S", NISTObjectIdentifiers.id_slh_dsa_shake_128s);
236+
algorithms.put("SLH-DSA-SHAKE-128F", NISTObjectIdentifiers.id_slh_dsa_shake_128f);
237+
algorithms.put("SLH-DSA-SHAKE-192S", NISTObjectIdentifiers.id_slh_dsa_shake_192s);
238+
algorithms.put("SLH-DSA-SHAKE-192F", NISTObjectIdentifiers.id_slh_dsa_shake_192f);
239+
algorithms.put("SLH-DSA-SHAKE-256S", NISTObjectIdentifiers.id_slh_dsa_shake_256s);
240+
algorithms.put("SLH-DSA-SHAKE-256F", NISTObjectIdentifiers.id_slh_dsa_shake_256f);
241+
229242
algorithms.put("FALCON-512", BCObjectIdentifiers.falcon_512);
230243
algorithms.put("FALCON-1024", BCObjectIdentifiers.falcon_1024);
231244

pkix/src/test/java/org/bouncycastle/tsp/test/PQCTSPTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public void testSPHINCSPlus()
131131

132132
try
133133
{
134-
KeyPairGenerator g = KeyPairGenerator.getInstance("SPHINCS+", BC);
134+
KeyPairGenerator g = KeyPairGenerator.getInstance("SLH-DSA", BC);
135135

136136
KeyPair p = g.generateKeyPair();
137137

@@ -152,7 +152,7 @@ public void testSPHINCSPlus()
152152
// create the certificate - version 1
153153
//
154154

155-
ContentSigner sigGen = new JcaContentSignerBuilder("SPHINCS+")
155+
ContentSigner sigGen = new JcaContentSignerBuilder("SLH-DSA-SHA2-128F")
156156
.setProvider(BC).build(privKey);
157157
JcaX509v3CertificateBuilder certGen = new JcaX509v3CertificateBuilder(
158158
new X500Name("CN=Test"),
@@ -167,7 +167,7 @@ public void testSPHINCSPlus()
167167
X509Certificate cert = new JcaX509CertificateConverter()
168168
.setProvider("BC").getCertificate(certGen.build(sigGen));
169169

170-
ContentSigner signer = new JcaContentSignerBuilder("SPHINCS+").setProvider(BC).build(privKey);
170+
ContentSigner signer = new JcaContentSignerBuilder("SLH-DSA-SHA2-128F").setProvider(BC).build(privKey);
171171

172172
TimeStampTokenGenerator tsTokenGen = new TimeStampTokenGenerator(
173173
new JcaSignerInfoGeneratorBuilder(new JcaDigestCalculatorProviderBuilder().build())

prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/slhdsa/SignatureSpi.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ protected void engineInitVerify(PublicKey publicKey)
3838
}
3939
else
4040
{
41-
throw new InvalidKeyException("unknown public key passed to SPHINCS+");
41+
throw new InvalidKeyException("unknown public key passed to SLH-DSA");
4242
}
4343
}
4444

@@ -69,7 +69,7 @@ protected void engineInitSign(PrivateKey privateKey)
6969
}
7070
else
7171
{
72-
throw new InvalidKeyException("unknown private key passed to SPHINCS+");
72+
throw new InvalidKeyException("unknown private key passed to SLH-DSA");
7373
}
7474
}
7575

prov/src/main/java/org/bouncycastle/jce/provider/BouncyCastleProvider.java

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.bouncycastle.crypto.CryptoServicePurpose;
2525
import org.bouncycastle.crypto.CryptoServicesRegistrar;
2626
import org.bouncycastle.internal.asn1.isara.IsaraObjectIdentifiers;
27+
import org.bouncycastle.jcajce.provider.asymmetric.slhdsa.SLHDSAKeyFactorySpi;
2728
import org.bouncycastle.jcajce.provider.config.ConfigurableProvider;
2829
import org.bouncycastle.jcajce.provider.config.ProviderConfiguration;
2930
import org.bouncycastle.jcajce.provider.symmetric.util.ClassUtil;
@@ -348,18 +349,18 @@ private void loadServiceClass(String packageName, String serviceName)
348349
private void loadPQCKeys()
349350
{
350351
addKeyInfoConverter(BCObjectIdentifiers.sphincsPlus, new SPHINCSPlusKeyFactorySpi());
351-
addKeyInfoConverter(NISTObjectIdentifiers.id_slh_dsa_sha2_128s, new SPHINCSPlusKeyFactorySpi());
352-
addKeyInfoConverter(NISTObjectIdentifiers.id_slh_dsa_sha2_128f, new SPHINCSPlusKeyFactorySpi());
353-
addKeyInfoConverter(NISTObjectIdentifiers.id_slh_dsa_sha2_192s, new SPHINCSPlusKeyFactorySpi());
354-
addKeyInfoConverter(NISTObjectIdentifiers.id_slh_dsa_sha2_192f, new SPHINCSPlusKeyFactorySpi());
355-
addKeyInfoConverter(NISTObjectIdentifiers.id_slh_dsa_sha2_256s, new SPHINCSPlusKeyFactorySpi());
356-
addKeyInfoConverter(NISTObjectIdentifiers.id_slh_dsa_sha2_256f, new SPHINCSPlusKeyFactorySpi());
357-
addKeyInfoConverter(NISTObjectIdentifiers.id_slh_dsa_shake_128s, new SPHINCSPlusKeyFactorySpi());
358-
addKeyInfoConverter(NISTObjectIdentifiers.id_slh_dsa_shake_128f, new SPHINCSPlusKeyFactorySpi());
359-
addKeyInfoConverter(NISTObjectIdentifiers.id_slh_dsa_shake_192s, new SPHINCSPlusKeyFactorySpi());
360-
addKeyInfoConverter(NISTObjectIdentifiers.id_slh_dsa_shake_192f, new SPHINCSPlusKeyFactorySpi());
361-
addKeyInfoConverter(NISTObjectIdentifiers.id_slh_dsa_shake_256s, new SPHINCSPlusKeyFactorySpi());
362-
addKeyInfoConverter(NISTObjectIdentifiers.id_slh_dsa_shake_256f, new SPHINCSPlusKeyFactorySpi());
352+
addKeyInfoConverter(NISTObjectIdentifiers.id_slh_dsa_sha2_128s, new SLHDSAKeyFactorySpi());
353+
addKeyInfoConverter(NISTObjectIdentifiers.id_slh_dsa_sha2_128f, new SLHDSAKeyFactorySpi());
354+
addKeyInfoConverter(NISTObjectIdentifiers.id_slh_dsa_sha2_192s, new SLHDSAKeyFactorySpi());
355+
addKeyInfoConverter(NISTObjectIdentifiers.id_slh_dsa_sha2_192f, new SLHDSAKeyFactorySpi());
356+
addKeyInfoConverter(NISTObjectIdentifiers.id_slh_dsa_sha2_256s, new SLHDSAKeyFactorySpi());
357+
addKeyInfoConverter(NISTObjectIdentifiers.id_slh_dsa_sha2_256f, new SLHDSAKeyFactorySpi());
358+
addKeyInfoConverter(NISTObjectIdentifiers.id_slh_dsa_shake_128s, new SLHDSAKeyFactorySpi());
359+
addKeyInfoConverter(NISTObjectIdentifiers.id_slh_dsa_shake_128f, new SLHDSAKeyFactorySpi());
360+
addKeyInfoConverter(NISTObjectIdentifiers.id_slh_dsa_shake_192s, new SLHDSAKeyFactorySpi());
361+
addKeyInfoConverter(NISTObjectIdentifiers.id_slh_dsa_shake_192f, new SLHDSAKeyFactorySpi());
362+
addKeyInfoConverter(NISTObjectIdentifiers.id_slh_dsa_shake_256s, new SLHDSAKeyFactorySpi());
363+
addKeyInfoConverter(NISTObjectIdentifiers.id_slh_dsa_shake_256f, new SLHDSAKeyFactorySpi());
363364

364365
addKeyInfoConverter(BCObjectIdentifiers.sphincsPlus_sha2_128s_r3, new SPHINCSPlusKeyFactorySpi());
365366
addKeyInfoConverter(BCObjectIdentifiers.sphincsPlus_sha2_128f_r3, new SPHINCSPlusKeyFactorySpi());

prov/src/main/java/org/bouncycastle/pqc/jcajce/provider/SPHINCSPlus.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,6 @@ public void configure(ConfigurableProvider provider)
9595
AsymmetricKeyInfoConverter keyFact = new SPHINCSPlusKeyFactorySpi();
9696

9797
registerKeyFactoryOid(provider, BCObjectIdentifiers.sphincsPlus, "SPHINCSPLUS", keyFact);
98-
registerKeyFactoryOid(provider, NISTObjectIdentifiers.id_slh_dsa_sha2_128s, "SPHINCSPLUS", keyFact);
99-
registerKeyFactoryOid(provider, NISTObjectIdentifiers.id_slh_dsa_sha2_128f, "SPHINCSPLUS", keyFact);
100-
registerKeyFactoryOid(provider, NISTObjectIdentifiers.id_slh_dsa_sha2_192s, "SPHINCSPLUS", keyFact);
101-
registerKeyFactoryOid(provider, NISTObjectIdentifiers.id_slh_dsa_sha2_192f, "SPHINCSPLUS", keyFact);
102-
registerKeyFactoryOid(provider, NISTObjectIdentifiers.id_slh_dsa_sha2_256s, "SPHINCSPLUS", keyFact);
103-
registerKeyFactoryOid(provider, NISTObjectIdentifiers.id_slh_dsa_sha2_256f, "SPHINCSPLUS", keyFact);
104-
registerKeyFactoryOid(provider, NISTObjectIdentifiers.id_slh_dsa_shake_128s, "SPHINCSPLUS", keyFact);
105-
registerKeyFactoryOid(provider, NISTObjectIdentifiers.id_slh_dsa_shake_128f, "SPHINCSPLUS", keyFact);
106-
registerKeyFactoryOid(provider, NISTObjectIdentifiers.id_slh_dsa_shake_192s, "SPHINCSPLUS", keyFact);
107-
registerKeyFactoryOid(provider, NISTObjectIdentifiers.id_slh_dsa_shake_192f, "SPHINCSPLUS", keyFact);
108-
registerKeyFactoryOid(provider, NISTObjectIdentifiers.id_slh_dsa_shake_256s, "SPHINCSPLUS", keyFact);
109-
registerKeyFactoryOid(provider, NISTObjectIdentifiers.id_slh_dsa_shake_256f, "SPHINCSPLUS", keyFact);
11098

11199
registerKeyFactoryOid(provider, BCObjectIdentifiers.sphincsPlus_sha2_128s_r3, "SPHINCSPLUS", keyFact);
112100
registerKeyFactoryOid(provider, BCObjectIdentifiers.sphincsPlus_sha2_128f_r3, "SPHINCSPLUS", keyFact);

0 commit comments

Comments
 (0)