> One other point here, is that we should try at least one interop experiment
> with the PQC algorithm, whether it's composite mldsa44-ed25519-sha512 or
> mldsa44-sha512. This choice should be discussed at the interim Wednesday.
> -Wei
Some implementation experience that may help before Wednesday's interim:
I have implemented mldsa44-ed25519-sha512 in mail-auth, the Rust library behind
Stalwart's DKIM2 support, as part of updating it to
draft-ietf-dkim-dkim2-spec-07. It is available for interop testing in the
mail-auth playground at https://mail-auth.stalw.art, where you can generate
keys, sign and verify messages with rsa-sha256, ed25519-sha256 and
mldsa44-ed25519-sha512. I am happy to share keys and test messages with anyone
who wants to try it against their own implementation.
On the "implementing your own crypto" concern: I did not have to implement any
primitive myself. ML-DSA-44 and Ed25519 come from AWS-LC (and, in a second
backend, from the RustCrypto ml-dsa and ed25519-dalek crates). The composite
part from draft-ietf-lamps-pq-composite-sigs is only the construction of M' (a
fixed prefix, the label, the context length and context, and the SHA-512
pre-hash) plus splitting and concatenating keys and signatures. Both backends
pass the test vectors in Appendix E of the LAMPS draft. The one library feature
it needs is pure ML-DSA with a caller-supplied context string, since the LAMPS
label is used as the ML-DSA context. AWS-LC supports that in its C API,
although the aws-lc-rs wrapper does not expose it yet, so I call AWS-LC
directly for that step. OpenSSL has the same building blocks: it has no
composite algorithm as such, but OpenSSL 3.6 signs and verifies pure ML-DSA-44
with a caller-supplied context string (for example "openssl pkeyutl -sign
-rawin -p
keyopt context-string:COMPSIG-MLDSA44-Ed25519-SHA512"), so the composite can
be built on it in the same way. Performance is not a concern either: on my
machine a composite signature takes about 46 microseconds to sign and 30
microseconds to verify with AWS-LC, against about 18 microseconds for an
Ed25519 verification.
While implementing it I found some points the current texts leave open. I think
they need answers whichever PQ algorithm the group picks, because most of them
apply to a plain mldsa44-sha512 as well.
1. What is signed. Section 3.4 of -07 says the algorithm "computes a hash over
all the Message-Instance and DKIM2-Signature fields as described in Section
12.8 using SHA-512 [FIPS-180-4] as the hash-alg. It signs the hash with both
the "post-quantum" MLDSA-44 algorithm [FIPS-204] and the PureEdDSA variant
Ed25519 (see [RFC8032])." That mirrors Section 3.3 and does not cite LAMPS;
only dns-01 says the algorithm "is specified in" the LAMPS draft, and lists it
as an informative reference. I can see three readings that do not interoperate:
a. The LAMPS composite, where its message M is the Section 12.8 signing
input, and the SHA-512 in Section 3.4 is the LAMPS pre-hash computed outside
the signer (LAMPS Section 10.5, External Pre-hashing). The input is hashed once.
b. The LAMPS composite, where M is the SHA-512 digest of the Section 12.8
input, by analogy with Section 3.3. M' then contains SHA-512(SHA-512(input)).
c. No LAMPS combiner: plain ML-DSA-44 and Ed25519 each sign the digest and
the two values are concatenated.
I implemented (a), which matches Richard's pointer to the LAMPS draft and
avoids hashing twice. It is also the "pre-hashed input model" from Wei's threat
model statement, which LAMPS explicitly allows. For a plain mldsa44-sha512 the
equivalent question is whether pure ML-DSA signs the SHA-512 digest (as Ed25519
does in Section 3.3) or whether HashML-DSA is meant. Either way, a sentence
stating exactly what bytes are passed to the signature primitive would remove
the ambiguity.
2. Context string. Neither draft specifies an application context, so for the
composite the LAMPS default (empty) applies, and that is what I use. Plain
ML-DSA also takes a context string. Should DKIM2 define one (for example
"DKIM2") for domain separation, or is empty deliberate?
3. Key encoding. I publish the raw composite public key in p=, that is the
1312-byte ML-DSA-44 public key followed by the 32-byte Ed25519 public key, not
a SubjectPublicKeyInfo structure, which is how I read dns-01 together with
LAMPS Sections 4.1 and 5. Given the RSA format errata in dns-01 Appendix A, it
would help to say explicitly whether SPKI is allowed for the new key types.
If the interim decides to go with plain ML-DSA-44 instead, adding it on my side
is a small change, and I will add it to the playground as well so there is
something to interop against.
Best,
Mauro
_______________________________________________
Ietf-dkim mailing list -- [email protected]
To unsubscribe send an email to [email protected]