Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

vcsjones
Copy link
Member

This adds HMAC "Verify" APIs for validating an HMAC signature.

KMAC will be a followup PR.

Contributes to #116028

@vcsjones vcsjones added this to the 11.0.0 milestone Sep 12, 2025
@vcsjones vcsjones requested a review from bartonjs September 12, 2025 16:59
@vcsjones vcsjones self-assigned this Sep 12, 2025
@Copilot Copilot AI review requested due to automatic review settings September 12, 2025 16:59
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

@Copilot Copilot AI left a 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 adds HMAC "Verify" APIs for validating HMAC signatures across the cryptographic library. The changes introduce new verification methods that perform fixed-time comparisons to prevent timing attacks.

Key changes include:

  • Addition of new Verify and VerifyAsync methods to all HMAC classes (HMACSHA1, HMACSHA256, HMACSHA384, HMACSHA512, HMACSHA3_256, HMACSHA3_384, HMACSHA3_512, HMACMD5)
  • New verification APIs in CryptographicOperations class for general HMAC verification
  • Addition of VerifyCurrentHash and VerifyHashAndReset methods to IncrementalHash class
  • Creation of shared implementation infrastructure through HMACShared class

Reviewed Changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
IncrementalHashTests.cs Adds comprehensive test coverage for new verify methods in IncrementalHash
HmacTests.cs Adds base test infrastructure and validation tests for HMAC verification APIs
HmacSha*.cs (test files) Implements abstract verify methods for each HMAC algorithm test class
IncrementalHash.cs Implements VerifyCurrentHash and VerifyHashAndReset methods
HMACShared.cs New shared implementation for HMAC verification logic across all algorithms
HMAC*.cs (implementation files) Adds Verify and VerifyAsync static methods to each HMAC class
CryptographicOperations.cs Adds general-purpose HMAC verification APIs
Project and reference files Updates to include new HMACShared.cs file and API surface

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant