Skip to content

Commit

Permalink
Updated tests to ML-DSA rather than Dilithium
Browse files Browse the repository at this point in the history
  • Loading branch information
dghgit committed Aug 22, 2024
1 parent 67c85f8 commit 74a6244
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
import java.security.spec.RSAPublicKeySpec;
import java.util.Enumeration;

import javax.swing.KeyStroke;

import org.bouncycastle.asn1.ASN1BMPString;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1InputStream;
Expand All @@ -48,12 +46,12 @@
import org.bouncycastle.asn1.x509.KeyPurposeId;
import org.bouncycastle.internal.asn1.misc.MiscObjectIdentifiers;
import org.bouncycastle.jcajce.PKCS12StoreParameter;
import org.bouncycastle.jcajce.spec.MLDSAParameterSpec;
import org.bouncycastle.jce.PKCS12Util;
import org.bouncycastle.jce.interfaces.PKCS12BagAttributeCarrier;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.jce.provider.JDKPKCS12StoreParameter;
import org.bouncycastle.jce.provider.X509CertificateObject;
import org.bouncycastle.pqc.jcajce.spec.DilithiumParameterSpec;
import org.bouncycastle.pqc.jcajce.spec.FalconParameterSpec;
import org.bouncycastle.pqc.jcajce.spec.NTRUParameterSpec;
import org.bouncycastle.pqc.jcajce.spec.SPHINCSPlusParameterSpec;
Expand Down Expand Up @@ -1097,13 +1095,13 @@ private void testGOSTStore()
private void testDilithiumStore()
throws Exception
{
KeyPairGenerator kpg = KeyPairGenerator.getInstance("Dilithium", "BC");
KeyPairGenerator kpg = KeyPairGenerator.getInstance("ML-DSA", "BC");

kpg.initialize(DilithiumParameterSpec.dilithium3);
kpg.initialize(MLDSAParameterSpec.ml_dsa_65);

KeyPair kp = kpg.generateKeyPair();

Certificate cert = TestUtils.createSelfSignedCert("CN=Dilithium Test", "Dilithium3", kp);
Certificate cert = TestUtils.createSelfSignedCert("CN=Dilithium Test", "ML-DSA-65", kp);

KeyStore pkcs12 = KeyStore.getInstance("PKCS12", BC);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class TestUtils
algIds.put("SHA1withECDSA", new AlgorithmIdentifier(X9ObjectIdentifiers.ecdsa_with_SHA1));
algIds.put("SHA256withECDSA", new AlgorithmIdentifier(X9ObjectIdentifiers.ecdsa_with_SHA256));
algIds.put("Ed448", new AlgorithmIdentifier(EdECObjectIdentifiers.id_Ed448));
algIds.put("Dilithium3", new AlgorithmIdentifier(NISTObjectIdentifiers.id_ml_dsa_65));
algIds.put("ML-DSA-65", new AlgorithmIdentifier(NISTObjectIdentifiers.id_ml_dsa_65));
algIds.put("Falcon-512", new AlgorithmIdentifier(BCObjectIdentifiers.falcon_512));
algIds.put("SPHINCS+", new AlgorithmIdentifier(BCObjectIdentifiers.sphincsPlus_sha2_128f_r3));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import java.security.Security;

import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.bc.BCObjectIdentifiers;
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.pqc.jcajce.spec.DilithiumParameterSpec;
Expand Down Expand Up @@ -43,9 +42,9 @@ public void testKeyPairGeneratorNames()
};

String[] algs = new String[]{
"DILITHIUM2",
"DILITHIUM3",
"DILITHIUM5"
"ML-DSA-44",
"ML-DSA-65",
"ML-DSA-87"
};

for (int i = 0; i != oids.length; i++)
Expand Down

0 comments on commit 74a6244

Please sign in to comment.