Search code examples
c#.netfips

Detecting if FIPS is being enforced via .NET C#


Is there a way to determine from the .NET framework whether or not the FIPS policy is being enforced on the windows computer?


Solution

  • You can use this code to check whether FIPS is enabled or not:

    public static object getKey(string Name)
    {
        RegistryKey uac = Registry.LocalMachine.OpenSubKey(@"System\CurrentControlSet\Control\Lsa\FIPSAlgorithmPolicy", true);
        if (uac == null)
        {
            uac = Registry.LocalMachine.CreateSubKey(@"System\CurrentControlSet\Control\Lsa\FIPSAlgorithmPolicy");
        }
        return uac.GetValue(Name);
    }
    

    Just pass "Enabled" key into it and it will return 1 or 0 based on the enabled or disabled.