File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
core/src/main/java/org/bouncycastle/pqc/crypto/util Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff 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" );
You can’t perform that action at this time.
0 commit comments