Skip to content

Commit

Permalink
Adapt to NIST 203..205 and BC beta from 13. Sept 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
Akretsch committed Sep 18, 2024
1 parent 24a6f79 commit 6029efd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,9 @@ public static Mac getMac(final String macId) throws NoSuchAlgorithmException {
* @return signature
* @throws NoSuchAlgorithmException if signatureId is unknown
*/
public static Signature getSignature(final String signatureId) throws NoSuchAlgorithmException {
return tryWithAllProviders(p -> Signature.getInstance(signatureId, p));
public static Signature getSignature(String signatureId) throws NoSuchAlgorithmException {
String internalSigId=signatureId.startsWith("SLH-DSA")?"SLH-DSA":signatureId;
return tryWithAllProviders(p -> Signature.getInstance(internalSigId, p));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
import java.util.List;
import org.bouncycastle.asn1.bc.BCObjectIdentifiers;
import org.bouncycastle.asn1.misc.MiscObjectIdentifiers;
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers;
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;


/**
* provide lists of algoritrhms to test
*/
Expand All @@ -36,30 +38,27 @@ private TcAlgs() {}
public static List<Object[]> getPqSignatureAlgorithms() throws GeneralSecurityException, NoSuchAlgorithmException {
return Arrays.asList(new Object[][] {
{
"id_Falcon512_ECDSA_P256_SHA256",
"id_ml_dsa_44",
KeyPairGeneratorFactory.getGenericKeyPairGenerator(
org.bouncycastle.asn1.misc.MiscObjectIdentifiers.id_Falcon512_ECDSA_P256_SHA256)
},
{"LMS", KeyPairGeneratorFactory.getGenericKeyPairGenerator("LMS")},
{
"id-alg-hss-lms-hashsig",
KeyPairGeneratorFactory.getGenericKeyPairGenerator(PKCSObjectIdentifiers.id_alg_hss_lms_hashsig)
NISTObjectIdentifiers.id_ml_dsa_44)
},
//
{
"SPHINCS+-SHA2-128s",
KeyPairGeneratorFactory.getGenericKeyPairGenerator(BCObjectIdentifiers.sphincsPlus_sha2_128f)
"id_ml_dsa_65",
KeyPairGeneratorFactory.getGenericKeyPairGenerator(
NISTObjectIdentifiers.id_ml_dsa_65)
},
{
"SPHINCS+-SHAKE-256s",
KeyPairGeneratorFactory.getGenericKeyPairGenerator(BCObjectIdentifiers.sphincsPlus_shake_256s)
},
{"dilithium2", KeyPairGeneratorFactory.getGenericKeyPairGenerator(BCObjectIdentifiers.dilithium2)},
{"dilithium3", KeyPairGeneratorFactory.getGenericKeyPairGenerator(BCObjectIdentifiers.dilithium3)},
{"dilithium5", KeyPairGeneratorFactory.getGenericKeyPairGenerator(BCObjectIdentifiers.dilithium5)},
{"falcon_512", KeyPairGeneratorFactory.getGenericKeyPairGenerator(BCObjectIdentifiers.falcon_512)},
{"falcon_1024", KeyPairGeneratorFactory.getGenericKeyPairGenerator(BCObjectIdentifiers.falcon_1024)}
//
"id_ml_dsa_87",
KeyPairGeneratorFactory.getGenericKeyPairGenerator(
NISTObjectIdentifiers.id_ml_dsa_87)
},
{ "sphincsPlus_sha2_128s", KeyPairGeneratorFactory
.getGenericKeyPairGenerator(BCObjectIdentifiers.sphincsPlus_sha2_128s)
},
{ "id_slh_dsa_sha2_128s", KeyPairGeneratorFactory
.getGenericKeyPairGenerator(NISTObjectIdentifiers.id_slh_dsa_sha2_128s)
},
//
});
}

Expand Down Expand Up @@ -141,8 +140,8 @@ public static List<Object[]> getCompositeAlgorithms() throws GeneralSecurityExce

public static List<Object[]> getKemAlgorithms() throws GeneralSecurityException, NoSuchAlgorithmException {
return Arrays.asList(new Object[][] {
{"KYBER512", KeyPairGeneratorFactory.getGenericKeyPairGenerator(BCObjectIdentifiers.kyber512)},
{"KYBER1024", KeyPairGeneratorFactory.getGenericKeyPairGenerator(BCObjectIdentifiers.kyber1024)},
{"id_alg_ml_kem_512", KeyPairGeneratorFactory.getGenericKeyPairGenerator(NISTObjectIdentifiers.id_alg_ml_kem_512)},
{"id_alg_ml_kem_1024", KeyPairGeneratorFactory.getGenericKeyPairGenerator(NISTObjectIdentifiers.id_alg_ml_kem_1024)},
});
}

Expand Down

0 comments on commit 6029efd

Please sign in to comment.