Repository navigation
Conversation
Collaborator
|
This is currently implemented in the scossl-1.11-validation-fixes feature branch as part of the next 1.11 release, which will be RI'd to main after tagging. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix the ML-DSA PKCS#8 private-key codec so SCOSSL both emits and accepts the representations defined by RFC 9881.
SCOSSL previously wrapped every ML-DSA private-key representation in a universal ASN.1
OCTET STRINGand its decoder only accepted that wrapper. A 32-byte seed was therefore emitted as04 20 <seed>and standards-compliant seed-only keys encoded as80 20 <seed>were rejected. This prevented private-key exchange with OpenSSL 3.5 and .NET and caused PKCS#12 imports to fail before the private key could be matched to its certificate.Standards reference
RFC 9881, Section 6 defines:
The ASN.1 tag distinguishes the representation:
0x80([0] IMPLICIT) for a 32-byte seed0x04(universalOCTET STRING) for an expanded private key0x30(SEQUENCE) for a seed plus expanded keyChanges
Encoder
SYMCRYPT_MLDSAKEY_FORMAT_PRIVATE_SEEDwith context-specific primitive tag[0], producing80 20 <seed>.OCTET STRINGencoding for expanded private keys.Decoder
bothform, derive the expanded key from the seed and compare it in constant time with the supplied expanded key, rejecting inconsistent pairs.04 20 <seed>encoding while no longer emitting it.Interoperability impact
This fixes both directions of private-key exchange with RFC 9881 implementations, including OpenSSL 3.5 and .NET ML-DSA APIs. It also permits PKCS#12 files containing a standards-compliant seed-only ML-DSA PKCS#8 key to be imported and matched to their certificate.
Validation
symcryptprovider; verified the PKCS#8 payload is exactly80 20followed by the 32-byte seed.symcryptprovider, and verified the derived public key.symcryptprovider, and verified the public key matches .NET's SPKI.sys-cert-storeandcertutilwith the codec changes and successfully imported the realml-dsa-44.pfxfixture that previously failed withPKCS#12 key has no matching certificate.