Repository navigation
Use keyed HMAC constructors in ManagedAuthenticatedEncryptor - #69859
Merged
DeagleGross merged 2 commits intoOct 16, 2026
Merged
DeagleGross merged 2 commits into
DeagleGross merged 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Required review evidence remains incomplete, so the absence of findings does not establish approval readiness.
0 open findings
What changed in this PR
Extends the earlier Data Protection optimization to remaining instance-based HMAC paths, reducing initialization overhead.
Changes:
- Adds keyed constructors for built-in HMAC algorithms.
- Routes instance-based validation through the keyed factory while preserving custom-algorithm fallback.
- Adds payload compatibility and encryption/decryption parity tests.
| File | Description |
|---|---|
| src/DataProtection/DataProtection/test/Microsoft.AspNetCore.DataProtection.Tests/Managed/ManagedAuthenticatedEncryptorTests.cs | Adds compatibility and keyed-factory tests. |
| src/DataProtection/DataProtection/src/Managed/ManagedAuthenticatedEncryptor.cs | Uses keyed factories for instance-based validation. |
| src/DataProtection/DataProtection/src/AuthenticatedEncryption/ManagedAuthenticatedEncryptorFactory.cs | Supplies keyed constructors for built-in HMAC types. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
BrennanConroy
approved these changes
Oct 15, 2026
DeagleGross
temporarily deployed
to
copilot-pat-pool
October 16, 2026 07:45 — with
GitHub Actions
Inactive
DeagleGross
temporarily deployed
to
copilot-pat-pool
October 16, 2026 07:46 — with
GitHub Actions
Inactive
DeagleGross
temporarily deployed
to
copilot-pat-pool
October 16, 2026 07:46 — with
GitHub Actions
Inactive
DeagleGross
temporarily deployed
to
copilot-pat-pool
October 16, 2026 07:48 — with
GitHub Actions
Inactive
DeagleGross
temporarily deployed
to
copilot-pat-pool
October 16, 2026 07:49 — with
GitHub Actions
Inactive
DeagleGross
temporarily deployed
to
copilot-pat-pool
October 16, 2026 07:50 — with
GitHub Actions
Inactive
Contributor
|
✅ No documentation PR was created. Confidence that documentation is needed: 3% No docs needed: internal performance refactoring in DataProtection (ManagedAuthenticatedEncryptor and its factory) with no public or observable behavior change. Documentation surfaces considered
|
DeagleGross
temporarily deployed
to
copilot-pat-pool
October 16, 2026 07:50 — with
GitHub Actions
Inactive
This branch was previously deployed
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.
Follow-up to dotnet/aspnetcore#69789, addressing the remaining instance-based validation paths affected by dotnet/runtime#135759.
Instead of doing creating a
HashAlgorithminstance and then setting theKey, we can pass key immediately in the ctor:Proof
Tested on
HMACSHA384which is not covered by one-shot. The code exercises fallback path which uses keyed-constructor.Environment: RC2
11.0.0-rc.2.26508.107, WSL Ubuntu, verified loaded OpenSSL 3.5.8, BenchmarkDotNet 0.13.0, server GC, 6 warmups and 20 measured iterationsFixes #66536