-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Bring up Windows HKDF with CNG #120310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bring up Windows HKDF with CNG #120310
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements HKDF (HMAC-based Key Derivation Function) support on Windows using the CNG (Cryptography Next Generation) API, providing a native Windows implementation for better performance. The implementation includes fallbacks to managed code for unsupported scenarios and algorithms.
- Adds native Windows CNG implementation for HKDF
DeriveKey
andExpand
operations - Maintains managed code fallback for
Extract
operation and MD5 hash algorithm - Requires Windows 10 version 1803 or later for CNG support
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
System/Security/Cryptography/HKDF.Windows.cs | New Windows-specific HKDF implementation using CNG APIs with fallback logic |
System.Security.Cryptography.csproj | Updated project file to include Windows HKDF implementation instead of managed-only version |
Interop.Blobs.cs | Added KDF_HKDF_INFO buffer descriptor constant for HKDF info parameter |
Interop.BCryptAlgPseudoHandle.cs | Added BCRYPT_HKDF_ALG_HANDLE pseudo-handle for HKDF algorithm |
Cng.cs | Added HKDF algorithm name constant and reordered RSA constant |
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HKDF.Windows.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HKDF.Windows.cs
Outdated
Show resolved
Hide resolved
Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones |
This implements HKDF on top of Windows CNG for
DeriveKey
andExpand
.Windows support is a little limited. Particularly:
Extract
is not clearly defined on how to accomplish this, soExtract
remains implemented by managed code.