[release/10.0] Fix blob type in CopyWithPrivateKey for ML-DSA - #129865
Merged
Conversation
Contributor
|
Tagging subscribers to this area: @bartonjs, @vcsjones, @dotnet/area-system-security |
lewing
approved these changes
Jun 26, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Backport of #129839 to release/10.0
/cc @PranavSenthilnathan
Customer Impact
Found when running unit tests on a recent Windows insider build. An exception will be thrown in some cases when an ML-DSA certificate and key are paired. Specifically, when the key is a BCrypt key that was generated or imported with a seed, we try to re-import it into NCrypt as a private key (instead of a seed). Previously, Windows was tolerant to this and was able to recognize that the key material represented the seed instead of the private key. With recent insider builds this has started to fail, so we need to be accurate when telling NCrypt the format of the key material.
Regression
Testing
Validated on insider build of Windows. This wasn't an issue before because Windows was more permissive in its ML-DSA imports by allowing seeds even when the blob type was private key instead.
Risk
Low. We're now passing the correct parameter for blob type as described in:
https://learn.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptimportkeypair#parameters