SHA256CryptoServiceProvider 和相关的可以在 WinXP 上使用吗?
是否可以在 Windows XP 上使用 SHA256CryptoServiceProvider 和相关 SHA2 提供程序? 我知道提供商使用 Vista 及更高版本中包含的加密服务,是否可以在 XP 中安装 Microsoft 的这些服务?
编辑:我应该提供更多信息,MSDN 上的文档在 Windows XP 中对此支持方面是错误的。 请参阅 http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback。 aspx?FeedbackID=355031,这是 Microsoft 承认并接受的设计。 然而,没有任何地方列出解决方法(我看到的),所以我不确定是否可以安装正常工作所需的服务,或者是否像尝试在 WinXP 上安装 IIS 6 或 7 一样在风中倾斜。
Is it possible to use SHA256CryptoServiceProvider and related SHA2 providers on Windows XP? I know the providers use the cryptography services that are included in Vista and above is it possible to install these services in XP from Microsoft?
EDIT: I should've provided more information the documentation on the MSDN is wrong in regards to this being supported in Windows XP. See http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=355031 where this is acknowledged and accepted by Microsoft as by design. However there is no work around listed anywhere (that I saw) so I wasn't sure if it's possible to install the services this requires to work properly or if it's like tilting at windwills trying to install IIS 6 or 7 on WinXP.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
MSDN 文档似乎是正确的,因为它应该在设计上在 XP SP3 中受支持,如果不支持,那只是因为 .NET 中的bug 3.5.
AesCryptoServiceProvider 和 SHA256CryptoServiceProvider 使用相同的加密服务,名为“Microsoft 增强型 RSA 和 AES 加密提供程序”。 在 XP 下,服务的名称略有不同:“Microsoft 增强型 RSA 和 AES 加密提供程序(原型)”。 AesCryptoServiceProvider 的构造函数执行简单的检查:
SHAxxxCryptoServiceProvider 类的构造函数不检查(Prototype)名称,这就是它们在 XP 中失败的原因。 如果他们这样做了,他们就会成功。
在给定的 PC 上有一个简单的解决方法。 转到注册表项HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\Defaults\Provider,找到其名为“Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)”的子项,将其导出到.reg,编辑此.reg并从其名称中删除“(原型)”。 当您将其导入回来时,原始密钥将被复制为不带(Prototype)的新密钥,且内容相同。 从现在开始,SHA256CryptoServiceProvider 将在此 XPSP3 计算机上运行。
It seems that MSDN documentation is right in the sense that it should be supported in XP SP3 by design, and if it is not, it's only because of a bug in .NET 3.5.
Both AesCryptoServiceProvider and SHA256CryptoServiceProvider use the same cryptograhics service named "Microsoft Enhanced RSA and AES Cryptographic Provider". Under XP, the name of the service is slightly different: "Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)". The constructor of AesCryptoServiceProvider performs a simple check:
The constructors of SHAxxxCryptoServiceProvider classes do not check the (Prototype) name, and this is why they fail in XP. If they did, they would succeed.
There is a simple workaround on a given PC. Go to registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\Defaults\Provider, find its subkey named "Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)", export it to .reg, edit this .reg and delete " (Prototype)" from its name. When you import it back, the original key will be duplicated to the new key without (Prototype), with the same contents. From now on, SHA256CryptoServiceProvider will work on this XPSP3 machine.
我已经成功地使用了以下代码片段,尽管我对此并不是很满意,并且几乎发布了一个关于当时实例化
SHA512
的各种看似随意的方法的问题。 这是在 Windows XP、7 和可能的 Vista(记不清了)上进行了测试。我认为这应该与
SHA256
一样工作。此外,将两个版本的输出与 unix sha2 实用程序进行比较表明它们都正确实现了 SHA512。
I've had success with the following snippet, although I'm not really satisfied with it and nearly posted an SO question concerning the various seemingly haphazard ways to instantiate
SHA512
at the time. This is tested on Windows XP, 7, and possibly Vista (can't remember).I think this should work the same with
SHA256
.Also, comparing the output of both versions with a unix sha2 utility suggested that they both correctly implement SHA512.
来自 MSDN:
SHA256CryptoServiceProvider 类
平台:
Windows Vista、Windows XP SP2、Windows Server 2003
From MSDN:
SHA256CryptoServiceProvider Class
Platforms:
Windows Vista, Windows XP SP2, Windows Server 2003