开发者

Diffie-Hellman cryptographic algorithm is not supported on this platform

I am keep having this problem.

The specified cryptographic algorithm is not supported on this platform.

Exception Details: System.PlatformNotSupportedException: The specified cryptographic algorithm is not supported on this platform.

The below is the code. This codes are failed on Windows XP Pro SP3 and Windows 2003 Server with 3.5 framework installed on it.

<%@ 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 E开发者_如何转开发CDiffieHellmanCng();

    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>


MSDN says the class is supported on the following OSes:

  • Windows 7
  • Windows Vista SP1 or later
  • Windows XP SP3
  • Windows Server 2008 (Server Core Role not supported)
  • Windows Server 2008 R2 (Server Core Role not supported)


Based on reading other Microsoft documentation, my own experiments, and the questioner's, I'm convinced that the MSDN docs are in error and that Elliptic Curve DH is only supported on Windows Vista and higher. ECDH is only supported by Windows CNG, which in turn is only available on Vista and higher. I would love to be proved wrong.


It may be due to a differences in operating systems. The code you are trying to run may only work in certain Windows OS's, or on only 64-bit or only 32-bit computers. Do you have documentation for this algorithm>?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜