Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/259.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 此平台不支持Diffie-Hellman加密算法_C# - Fatal编程技术网

C# 此平台不支持Diffie-Hellman加密算法

C# 此平台不支持Diffie-Hellman加密算法,c#,C#,我一直有这个问题 此平台不支持指定的加密算法 异常详细信息:System.PlatformNotSupportedException:此平台不支持指定的加密算法 下面是代码。此代码在安装了3.5 framework的Windows XP Pro SP3和Windows 2003服务器上失败 <%@ Page Language="C#" AutoEventWireup="true" %> <%@ Import Namespace=&quo

我一直有这个问题

此平台不支持指定的加密算法

异常详细信息:System.PlatformNotSupportedException:此平台不支持指定的加密算法

下面是代码。此代码在安装了3.5 framework的Windows XP Pro SP3和Windows 2003服务器上失败

<%@ 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(服务器核心 角色(不受支持)

通过阅读其他Microsoft文档、我自己的实验和提问者的实验,我确信MSDN文档是错误的,椭圆曲线DH仅在Windows Vista及更高版本上受支持。ECDH仅由Windows CNG支持,而Windows CNG仅在Vista及更高版本上可用。我希望被证明是错的。

文档中说Windows 7、Windows Vista SP1或更高版本、Windows XP SP3、Windows Server 2008(不支持服务器核心角色)、Windows Server 2008 R2(不支持服务器核心角色)。NET Framework不支持所有平台的所有版本。有关受支持版本的列表,请参见.NET Framework系统要求。支持:4,3.5我在WindowsXPSP3和.NET3.5SP1上尝试了它,我得到了相同的错误消息。实际上,我在其他方法中遇到了完全相同的问题。文档中说它与我的操作系统兼容,但我得到了这个例外。