【发布时间】:2015-01-18 22:21:23
【问题描述】:
我正在将现有(并且正在运行)的 ASP.NET 网站移动到 Azure 网站。该站点的功能之一是签署 XML 文档。获取密钥的代码是:
// retrieve a key from the key safe - this will create it if it does not exist yet
System.Security.Cryptography.CspParameters csp = new CspParameters();
csp.KeyContainerName = "MyKeyName";
System.Security.Cryptography.RSACryptoServiceProvider key = new RSACryptoServiceProvider(csp);
最后一行抛出 CryptographicException,并显示消息“系统找不到指定的文件”。
我没有将密钥或容器放入 Azure - 我的理解是 ServiceProvider 会创建一个。 我查看了this article,但没有得到任何线索。
显然我遗漏了一些基本的东西。
【问题讨论】:
-
建议您查看这篇文章的答案,它应该可以满足您的需求:stackoverflow.com/questions/23827884/…
标签: c# asp.net azure cryptography