我一直有这个问题。
此平台不支持指定的加密算法。 异常详细信息: System.PlatformNotSupportedException:此平台不支持指定的加密算法。
下面是代码。此代码在Windows SP3和Windows2003Server上失败,其上安装了3.5框架。
<%@ 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>发布于 2010-07-07 21:34:37
MSDN说,这个类在以下OSes上得到支持:
发布于 2010-07-07 21:29:18
这可能是由于操作系统的不同所致。您试图运行的代码可能只在某些Windows操作系统上运行,或者只在64位或32位计算机上工作。您有这个algorithm>的文档吗?
https://stackoverflow.com/questions/3198954
复制相似问题