DSACryptoServiceProvider 有什么问题?

What is wrong with the DSACryptoServiceProvider?

docs 明确建议 不要 使用 DSACryptoServiceProvider 因为有

Newer asymmetric algorithms are available. Consider using the RSACryptoServiceProvider class instead of the DSACryptoServiceProvider class. Use DSACryptoServiceProvider only for compatibility with legacy applications and data.

DSA 有什么问题?是否只是 1024 的密钥大小和 SHA-1 哈希算法由于某种原因无法在此特定实现中交换,或者是否存在不应再使用 DSA 的一些通用内容?为什么?我猜离散对数问题没有得到有效解决,是吗?

Is it just the key size of 1024 and the SHA-1 hashing algorithm that for some reason cannot be exchanged in this specific implementation

有点。有两个竞争算法,名称为 DSA(或 DSS,如果您愿意)。

第一个在 FIPS 186-1 和 FIPS 186-2 中描述,适用于 512 到 1024 位的密钥,步长为 64 位,需要 SHA-1。

第二个,在 FIPS 186-3 和更新版本中描述,使用“批准的哈希函数”(基本上是 SHA-2 函数)处理大小为 1024、2048 和 3072 位的密钥。

DSACryptoServiceProvider 使用 Windows CAPI,它只支持旧版本的 DSA。 DSACng 使用 Windows CNG,它会说两个版本。所以 DSACryptoServiceProvider 无法升级(在 .NET 中,因为 Windows 表示 CAPI 是 maintenance-only 并且已弃用)。

DSA 总体上已失宠。它比 RSA 和 ECDSA 慢,它比 RSA 有更多的“完美或损坏”状态,它的密钥生成比 RSA 和 ECDSA 慢几个数量级。

Windows 已决定他们不支持并且“不会”支持使用 FIPS 186-3 DSA 签名的 X.509 证书......加密库只为被迫的人提供它有效地使用它。 (Apple Security.framework 不允许生成 DSA 密钥,无法验证 FIPS 186-3 签名,Apple 不提供 DSA 证书)。