Skip to content

Commit

Permalink
commented out composite test (still using pre-NIST oid).
Browse files Browse the repository at this point in the history
  • Loading branch information
dghgit committed Aug 21, 2024
1 parent 4bcd6b6 commit bd65f15
Showing 1 changed file with 24 additions and 26 deletions.
50 changes: 24 additions & 26 deletions pkix/src/test/java/org/bouncycastle/cert/test/CertTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
import org.bouncycastle.asn1.misc.MiscObjectIdentifiers;
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers;
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
import org.bouncycastle.asn1.pkcs.PrivateKeyInfo;
import org.bouncycastle.asn1.pkcs.RSAPublicKey;
import org.bouncycastle.asn1.x500.X500Name;
import org.bouncycastle.asn1.x500.X500NameBuilder;
Expand Down Expand Up @@ -120,7 +119,6 @@
import org.bouncycastle.operator.ContentVerifierProvider;
import org.bouncycastle.operator.DefaultDigestAlgorithmIdentifierFinder;
import org.bouncycastle.operator.DefaultSignatureAlgorithmIdentifierFinder;
import org.bouncycastle.operator.OperatorCreationException;
import org.bouncycastle.operator.bc.BcRSAContentSignerBuilder;
import org.bouncycastle.operator.bc.BcRSAContentVerifierProviderBuilder;
import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
Expand All @@ -143,7 +141,6 @@
import org.bouncycastle.util.encoders.Base64;
import org.bouncycastle.util.encoders.Hex;
import org.bouncycastle.util.test.SimpleTest;
import org.bouncycastle.util.test.TestFailedException;

public class CertTest
extends SimpleTest
Expand Down Expand Up @@ -5514,28 +5511,29 @@ private void checkParseCompositePublicKey()
}
}

private void checkParseCompositePrivateKey()
{
try
{
//compositePrivateKeyExample.pem does NOT contain the sample private key from https://www.ietf.org/archive/id/draft-ounsworth-pq-composite-sigs-13.html
//because the at this moment, the Dilithium private key formats don't match.
//this sample was generated from this BC implementation
PEMParser pemParser = new PEMParser(new InputStreamReader(TestResourceFinder.findTestResource("pqc/composite", "compositePrivateKeyExample.pem")));
PrivateKeyInfo privateKeyInfo = (PrivateKeyInfo)pemParser.readObject();

isEquals(privateKeyInfo.getPrivateKeyAlgorithm().getAlgorithm(), MiscObjectIdentifiers.id_MLDSA44_ECDSA_P256_SHA256);

CompositePrivateKey compositePrivateKey = new CompositePrivateKey(privateKeyInfo);

isEquals(compositePrivateKey.getPrivateKeys().get(0).getAlgorithm(), "DILITHIUM2");
isEquals(compositePrivateKey.getPrivateKeys().get(1).getAlgorithm(), "ECDSA");
}
catch (Exception e)
{
fail("checkParseCompositePrivateKey failed: " + e.getMessage());
}
}
// TODO: OIDS no updated
// private void checkParseCompositePrivateKey()
// {
// try
// {
// //compositePrivateKeyExample.pem does NOT contain the sample private key from https://www.ietf.org/archive/id/draft-ounsworth-pq-composite-sigs-13.html
// //because the at this moment, the Dilithium private key formats don't match.
// //this sample was generated from this BC implementation
// PEMParser pemParser = new PEMParser(new InputStreamReader(TestResourceFinder.findTestResource("pqc/composite", "compositePrivateKeyExample.pem")));
// PrivateKeyInfo privateKeyInfo = (PrivateKeyInfo)pemParser.readObject();
//
// isEquals(privateKeyInfo.getPrivateKeyAlgorithm().getAlgorithm(), MiscObjectIdentifiers.id_MLDSA44_ECDSA_P256_SHA256);
//
// CompositePrivateKey compositePrivateKey = new CompositePrivateKey(privateKeyInfo);
//
// isEquals(compositePrivateKey.getPrivateKeys().get(0).getAlgorithm(), "DILITHIUM2");
// isEquals(compositePrivateKey.getPrivateKeys().get(1).getAlgorithm(), "ECDSA");
// }
// catch (Exception e)
// {
// fail("checkParseCompositePrivateKey failed: " + e.getMessage());
// }
// }

private void checkParseAndVerifyCompositeCertificate()
{
Expand Down Expand Up @@ -5713,7 +5711,7 @@ public void performTest()

checkCompositeSignatureCertificateCreation();
checkParseCompositePublicKey();
checkParseCompositePrivateKey();
// checkParseCompositePrivateKey();
checkParseAndVerifyCompositeCertificate();
}

Expand Down

0 comments on commit bd65f15

Please sign in to comment.