Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FIPS validated application with HMAC function based on SHA512?

Tags:

c#

hmac

fips

I'm building a FIPS validated application and have the FIPS mode turned on on my computer. I need an HMAC function hopefully based on SHA512. I understand that the HMAC SHA1 function is FIPS validated but I have a hash function SHA512CryptoServiceProvider which is FIPS validated and I know that FIPS does in fact allow for SHA512. Is there a similar HMAC function in C# that does FIPS validated HMAC SHA512?

like image 817
hobeau Avatar asked Jan 18 '23 15:01

hobeau


1 Answers

There is a HMACSHA512 Class, but it uses the SHA512Managed Class internally, which is not FIPS certified.

You could try to create your own HMACSHA512 Class based on the SHA512CryptoServiceProvider Class:

public class MyHMACSHA512 : HMAC
{
    public MyHMACSHA512(byte[] key)
    {
        HashName = "System.Security.Cryptography.SHA512CryptoServiceProvider";
        HashSizeValue = 512;
        BlockSizeValue = 128;
        Key = key;
    }
}
like image 80
dtb Avatar answered Mar 25 '23 21:03

dtb