public class XMSSPromotionCompatibilityTest
extends junit.framework.TestCase
| Constructor and Description |
|---|
XMSSPromotionCompatibilityTest() |
| Modifier and Type | Method and Description |
|---|---|
void |
testParametersWithRandomAcceptedForSigning()
The JCA layer wraps the private key in a ParametersWithRandom whenever a SecureRandom is
supplied - XMSSSignatureSpi.engineInitSign(PrivateKey, SecureRandom) does - so all four
signers have to accept the wrapper.
|
void |
testSignaturesMatchAtEveryIndexOfAKey()
Every index a key can reach, not only its first.
|
void |
testStandardParameterSetEncodingMatches()
A standard RFC 8391 parameter set, which is encoded in the RFC 9802 form (id-alg-xmss-hashsig
with the 4-octet parameter-set OID ahead of the raw key) rather than the legacy
XMSSKeyParams one - a different branch of both key factories.
|
void |
testStreamingRoundTrip()
The promoted signers implement org.bouncycastle.crypto.Signer rather than the pqc
StateAwareMessageSigner, so a message streamed in through update() must sign and verify, and
the buffer must be consumed by each operation rather than carried into the next.
|
void |
testXMSSKeysAndSignaturesMatchAcrossImplementations()
The same seed drives both implementations, so a matching pair of keys must come out with
identical X.509 / PKCS#8 encodings, and each side must verify the other's signature.
|
void |
testXMSSMTKeysAndSignaturesMatchAcrossImplementations() |
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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, setUp, tearDown, toStringpublic void testXMSSKeysAndSignaturesMatchAcrossImplementations()
throws java.lang.Exception
java.lang.Exceptionpublic void testStandardParameterSetEncodingMatches()
throws java.lang.Exception
It is also the only branch that carries the raw private key layout, the legacy one building
its ASN.1 structure out of the key's own fields instead, so this is where that layout is
compared byte for byte against the deprecated copy - and it therefore has to reach both
families. The XMSS^MT cases elsewhere in this class are non-standard heights and take the
legacy branch, so before XMSSMT-SHA2_20/2_256 was added here nothing in the tree compared an
XMSS^MT raw encoding at all: a build whose XMSS^MT index field was one byte wider than it
should be passed every case of this class. That set was left out as too slow, which its key
is not - a height 10 tree per side, the same shape as the XMSS cases above it - so what it
skips is the signing and cross-verification half of checkXMSSMT, whose first signature at
this height costs as much again as the key does and which the h=4/d=2 sets of
testXMSSMTKeysAndSignaturesMatchAcrossImplementations() already cover.
java.lang.Exceptionpublic void testXMSSMTKeysAndSignaturesMatchAcrossImplementations()
throws java.lang.Exception
java.lang.Exceptionpublic void testSignaturesMatchAtEveryIndexOfAKey()
throws java.lang.Exception
The two implementations agreeing at index 0 says nothing about the idx_sig field of the H_msg key - r || root || toByte(idx_sig, n) of RFC 8391 sec. 4.1.9 and 4.2.7 - because at index 0 that field is all zeros whatever is done with it, and every other case above signs exactly once. Where those bytes sit, and how many of them there are, shows only once the index is non-zero, and a sign-then-verify round trip cannot show it either: both directions of one implementation build the key the same way, so they agree with each other while disagreeing with the other implementation. Comparing the two at every index is what pins it, and it walks the BDS traversal state through every shape it takes on the way.
java.lang.Exceptionpublic void testStreamingRoundTrip()
throws java.lang.Exception
java.lang.Exceptionpublic void testParametersWithRandomAcceptedForSigning()
throws java.lang.Exception
java.lang.Exception