C# 此平台不支持Diffie-Hellman加密算法
我一直有这个问题 此平台不支持指定的加密算法 异常详细信息:System.PlatformNotSupportedException:此平台不支持指定的加密算法 下面是代码。此代码在安装了3.5 framework的Windows XP Pro SP3和Windows 2003服务器上失败C# 此平台不支持Diffie-Hellman加密算法,c#,C#,我一直有这个问题 此平台不支持指定的加密算法 异常详细信息:System.PlatformNotSupportedException:此平台不支持指定的加密算法 下面是代码。此代码在安装了3.5 framework的Windows XP Pro SP3和Windows 2003服务器上失败 <%@ Page Language="C#" AutoEventWireup="true" %> <%@ Import Namespace=&quo
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="System"%>
<%@ Import Namespace="System.Web"%>
<%@ Import Namespace="System.Security.Cryptography"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
</head>
<body>
<%
//http://blogs.msdn.com/b/shawnfa/archive/2007/01/22/elliptic-curve-diffie-hellman.aspx
//http://msdn.microsoft.com/en-us/library/cc488021.aspx is about 200-millisecond wait.
ECDiffieHellmanCng alice = new ECDiffieHellmanCng();
alice.KeyDerivationFunction = ECDiffieHellmanKeyDerivationFunction.Hash;
alice.HashAlgorithm = CngAlgorithm.Sha256;
ECDiffieHellmanCng bob = new ECDiffieHellmanCng();
bob.KeyDerivationFunction = ECDiffieHellmanKeyDerivationFunction.Hash;
bob.HashAlgorithm = CngAlgorithm.Sha256;
byte[] bobKey = bob.DeriveKeyMaterial(alice.PublicKey);
byte[] aliceKey = alice.DeriveKeyMaterial(bob.PublicKey);
AesCryptoServiceProvider aes = new AesCryptoServiceProvider();
aes.Key = aliceKey;
%>
</body>
</html>
这可能是由于操作系统不同造成的。您试图运行的代码可能仅在某些Windows操作系统中有效,或者仅在64位或32位计算机上有效。您是否有此算法的文档>?表示该类在以下操作系统上受支持:
- 视窗7
- Windows Vista SP1或更高版本
- WindowsXPSP3
- Windows Server 2008 (不支持服务器核心角色)
- Windows Server 2008 R2(服务器核心 角色(不受支持)