c# - C# AES 算法何时会符合 FIPS 标准?

标签 c# security rijndaelmanaged rijndael fips

现在我唯一能得到 RijndaelManaged 的方法在打开 FIPS 的本地安全设置的计算机上工作的算法是 disable it .这是一台政府计算机,所以我不确定它会如何运行。我在 msdn blog sites 上看过帖子说他们正在开发符合 AES FIPS 标准的版本,但我似乎无法找到更多信息。有谁知道什么时候会发生这种情况?

最佳答案

在这个问题之前我从来没有意识到这一点,但你是对的。构造函数有这个:

public RijndaelManaged()
{
    if (Utils.FipsAlgorithmPolicy == 1)
    {
        throw new InvalidOperationException(Environment.GetResourceString("Cryptography_NonCompliantFIPSAlgorithm"));
    }
}

System.Security.Cryptography.AesManaged有类似的东西:

public AesManaged()
{
    if (CoreCryptoConfig.EnforceFipsAlgorithms)
    {
        throw new InvalidOperationException(SR.GetString("Cryptography_NonCompliantFIPSAlgorithm"));
    }
    this.m_rijndael = new RijndaelManaged();
    this.m_rijndael.BlockSize = this.BlockSize;
    this.m_rijndael.KeySize = this.KeySize;
}

你试过了吗System.Security.Cryptography.AesCryptoServiceProvider ?它应该可以工作,因为它使用的是 CAPI基于 FIPS AES 实现内置于 Windows。

This question在 Microsoft 的 .NET 基类库论坛上讨论了哪些算法符合 FIPS 并且有很好的链接。

看来微软正在制作 a consistent effort to obey the setting HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Lsa\FIPSAlgorithmPolicy 在 pre-Vista 机器上的使用以及 BCryptGetFipsAlgorithmMode 的使用用于后 Vista 的 API。

我认为在将实现认证为符合 FIPS 的过程中需要付出不小的努力,这就是为什么 Microsoft 可能不想重复该过程并且只为绝对需要此要求的客户提供 AesCryptoServiceProvider 的原因。

This MSDN blog post有一条评论更清楚:

The easy way to figure out if an algorithm is compliant or not is to look at the suffix. None of the *Managed types are FIPS certified. The *CryptoServiceProvider and *Cng types however, may well be FIPS certified. If they implement an algorithm that FIPS allows, and are using the default Microsoft providers, then they will be.

For instance, SHA256Managed is not (because it is *Managed). SHA256CryptoServiceProvider and SHA256Cng are.
MD5CryptoServiceProvider is not (because MD5 is not a FIPS algorithm).

关于c# - C# AES 算法何时会符合 FIPS 标准?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/939040/

相关文章:

c# - 在单个事务中发送多个 SQL 命令

c# - Visual Studio 2012 的增强型滚动条?

c# - 使用 Java 解密由 .NET 的 RijndaelManaged 加密的字节

c# - PdfTextExtractor 中的 iTextSharp 错误?

c# - 在 Xamarin 跨平台应用程序中呈现带有 ObservableCollection 数据的 DisplayActionSheet

php - 在 php 中发送邮件时如何删除显示系统信息的 header

api - 基于 SSL 的 HTTP 基本身份验证是否比 2 条腿 Oauth 安全?

java - 使用 rsa key 解密字符串

c# - 使用 Rijndael 加密/解密文件

exception - "Length of the data to decrypt is invalid."Rijndael 解密期间的异常