Skip to content

Commit d8724e9

Browse files
committed
draft-ietf-lamps-dilithium-certificates-07 => RFC 9881
1 parent 34c4cc2 commit d8724e9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

core/src/main/java/org/bouncycastle/pqc/crypto/util/PrivateKeyFactory.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,13 @@ else if (mlkemKey instanceof ASN1Sequence)
246246

247247
// TODO This should only allow seed but is length-flexible
248248
MLKEMPrivateKeyParameters mlkemPriv = new MLKEMPrivateKeyParameters(mlkemParams, seed, pubParams);
249+
250+
/*
251+
* RFC 9881 8.2. When receiving a private key that contains both the seed and the expandedKey, the
252+
* recipient SHOULD perform a seed consistency check to ensure that the sender properly generated
253+
* the private key. [..] If the check is done and the seed and the expandedKey are not consistent,
254+
* the recipient MUST reject the private key as malformed.
255+
*/
249256
if (!Arrays.constantTimeAreEqual(mlkemPriv.getEncoded(), encoding))
250257
{
251258
throw new IllegalArgumentException("inconsistent " + mlkemParams.getName() + " private key");

0 commit comments

Comments
 (0)