Add FIPS-compliant hash algorithm support#338
Open
sxndmxn wants to merge 3 commits intolecaillon:masterfrom
Open
Add FIPS-compliant hash algorithm support#338sxndmxn wants to merge 3 commits intolecaillon:masterfrom
sxndmxn wants to merge 3 commits intolecaillon:masterfrom
Conversation
Add configurable hash algorithms (SHA-256, SHA-384, SHA-512) for FIPS compliance while maintaining backward compatibility with existing MD5 checksums through dual validation. Changes: - Add HashAlgorithmType enum (MD5, SHA256, SHA384, SHA512) - Add ChecksumCalculator utility for centralized hash calculation - Add ChecksumAlgorithm configuration property (default: MD5) - Implement dual validation in MigrationScript.ValidateChecksum() - Expand metadata table checksum column from VARCHAR(32) to VARCHAR(128) - Add --checksum-algorithm CLI option - Update target framework to .NET 10
Replace custom HashAlgorithmType enum with .NET's built-in HashAlgorithmName struct for better alignment with .NET conventions and improved extensibility. Changes: - Delete HashAlgorithmType.cs custom enum - Use System.Security.Cryptography.HashAlgorithmName throughout - Use CryptographicOperations.HashData() for modern, efficient hashing - CLI option accepts string and converts to HashAlgorithmName - Update all tests to use HashAlgorithmName Benefits: - Uses official .NET cryptography pattern - Extensible for future algorithms via HashAlgorithmName constructor - Better FIPS mode handling (automatic) - Works with modern .NET crypto APIs
Remove [AllowedValues] restriction and use HashAlgorithmName constructor directly to accept any system-supported hash algorithm. The runtime will validate algorithm support via CryptographicOperations. HashData(), throwing CryptographicException for unsupported algorithms.
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
--checksum-algorithmCLI optionChanges
HashAlgorithmTypeenum (MD5, SHA256, SHA384, SHA512)ChecksumCalculatorutility for centralized hash calculationChecksumAlgorithmconfiguration property (default: MD5)MigrationScript.ValidateChecksum()Test plan
ChecksumCalculatorTesttests addedFileMigrationScriptTest