Bouncy Castle Cryptography Library 1.87

org.bouncycastle.pqc.crypto.test
Class MLDSATest

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.bouncycastle.pqc.crypto.test.MLDSATest
All Implemented Interfaces:
junit.framework.Test

public class MLDSATest
extends junit.framework.TestCase


Constructor Summary
MLDSATest()
           
 
Method Summary
 void testCalculateMuVerify()
           
 void testComponentLengthChecks()
           
 void testConsistency()
           
 void testExpandedPrivateKeyTrConsistency()
           
 void testHashExternalMu()
           
 void testHashQuickBrownFox()
           
 void testKeyGen()
           
 void testKeyGenCombinedVectorSet()
           
 void testMLDSARejection()
           
 void testPreferredFormatCopyIsIndependent()
           
 void testPrivateKeyEmbeddedPublicKeyConsistency()
           
 void testPrivateKeyInfoChoiceArms()
          RFC 9881 sec. 6: the privateKey is CHOICE { seed [0] OCTET STRING (SIZE (32)), expandedKey OCTET STRING, both SEQUENCE { seed, expandedKey } } and the tag says which arm is present.
 void testPrivateKeyRejectsMalformedLength()
           
 void testQuickBrownFox()
           
 void testRawExpandedKeyThatReadsAsDer()
          A raw expanded key is random content, so it can begin with bytes that read as a tag and a length exactly covering the rest - about once in 2^24 keys - and must still be read as the raw expanded key. tr binds rho, so the prefix cannot be forced onto an ML-DSA key: this seed was found by search, and its rho begins 77 82 09 fc, a tag and the length 2556 that covers the other bytes of an ML-DSA-44 expanded key exactly.
 void testRNG()
           
 void testSigGen()
           
 void testSigGenCombinedVectorSet()
           
 void testSigVer()
           
 void testSigVerCombinedVectorSet()
           
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MLDSATest

public MLDSATest()
Method Detail

testPreferredFormatCopyIsIndependent

public void testPreferredFormatCopyIsIndependent()

testConsistency

public void testConsistency()
                     throws java.lang.Exception
Throws:
java.lang.Exception

testKeyGen

public void testKeyGen()
                throws java.io.IOException
Throws:
java.io.IOException

testSigGen

public void testSigGen()
                throws java.io.IOException
Throws:
java.io.IOException

testSigVer

public void testSigVer()
                throws java.io.IOException
Throws:
java.io.IOException

testRNG

public void testRNG()

testKeyGenCombinedVectorSet

public void testKeyGenCombinedVectorSet()
                                 throws java.io.IOException
Throws:
java.io.IOException

testSigGenCombinedVectorSet

public void testSigGenCombinedVectorSet()
                                 throws java.io.IOException
Throws:
java.io.IOException

testSigVerCombinedVectorSet

public void testSigVerCombinedVectorSet()
                                 throws java.io.IOException
Throws:
java.io.IOException

testQuickBrownFox

public void testQuickBrownFox()
                       throws java.lang.Exception
Throws:
java.lang.Exception

testHashQuickBrownFox

public void testHashQuickBrownFox()
                           throws java.lang.Exception
Throws:
java.lang.Exception

testHashExternalMu

public void testHashExternalMu()
                        throws java.lang.Exception
Throws:
java.lang.Exception

testCalculateMuVerify

public void testCalculateMuVerify()
                           throws java.lang.Exception
Throws:
java.lang.Exception

testMLDSARejection

public void testMLDSARejection()
                        throws java.lang.Exception
Throws:
java.lang.Exception

testPrivateKeyRejectsMalformedLength

public void testPrivateKeyRejectsMalformedLength()

testComponentLengthChecks

public void testComponentLengthChecks()
                               throws java.lang.Exception
Throws:
java.lang.Exception

testPrivateKeyEmbeddedPublicKeyConsistency

public void testPrivateKeyEmbeddedPublicKeyConsistency()
                                                throws java.lang.Exception
Throws:
java.lang.Exception

testPrivateKeyInfoChoiceArms

public void testPrivateKeyInfoChoiceArms()
                                  throws java.lang.Exception
RFC 9881 sec. 6: the privateKey is CHOICE { seed [0] OCTET STRING (SIZE (32)), expandedKey OCTET STRING, both SEQUENCE { seed, expandedKey } } and the tag says which arm is present. Each arm must have its exact length, while the three pre-RFC forms of earlier drafts (the raw seed, the raw expanded key and the seed in an untagged OCTET STRING) are still read.

Throws:
java.lang.Exception

testRawExpandedKeyThatReadsAsDer

public void testRawExpandedKeyThatReadsAsDer()
                                      throws java.lang.Exception
A raw expanded key is random content, so it can begin with bytes that read as a tag and a length exactly covering the rest - about once in 2^24 keys - and must still be read as the raw expanded key. tr binds rho, so the prefix cannot be forced onto an ML-DSA key: this seed was found by search, and its rho begins 77 82 09 fc, a tag and the length 2556 that covers the other bytes of an ML-DSA-44 expanded key exactly.

Throws:
java.lang.Exception

testExpandedPrivateKeyTrConsistency

public void testExpandedPrivateKeyTrConsistency()
                                         throws java.lang.Exception
Throws:
java.lang.Exception

Bouncy Castle Cryptography Library 1.87