c# - Is there a keyed SHA256 hash algorithm that is FIPS compliant for .NET? -
i creating keyed sha256 hash using hmacsha256 following code:
hmacsha256 hmac = new hmacsha256(encoding.utf8.getbytes(secretkey); byte[] hash = hmac.computehash(encoding.utf8.getbytes(data)); string hashresult = string.empty; (int = 0; < hash.length; i++) { hashresult += hash[i].tostring("x2"); // hex format }
this working fine, however, fails in fips enabled environment because hmacsha256 uses underlying sha256managed implementation not fips compliant.
searching through msdn documentation find sha256 implementation of keyedhashalgorithm hmacsha256.
i required sign web service requests keyed sha256 hash (so can't change hash type), , must able run in fips enabled environment.
googling shows both sha256cryptoserviceprovider , sha256cng fips compliant ways create sha256 hashes, neither seem support creation of keyed hashes.
no, there not. here list of ones (scroll down fips.sys algorithms
section).
a work around i've used int past here, i'm not sure if work web services. this solution work.
Comments
Post a Comment