简体   繁体   English

WinRT存储RSA私钥

[英]WinRT where store RSA private key

In my WinRT application I must store private key for later decryption. 在我的WinRT应用程序中,我必须存储私钥以便以后解密。 In another applications there was RSACryptoServiceProvider, which I used: 在另一个应用程序中有RSACryptoServiceProvider,我用过:

 CspParameters cspParams = new CspParameters();

 cspParams.KeyContainerName = ContainerName;

 RSACryptoServiceProvider RSAalg = new RSACryptoServiceProvider(cspParams);

 RSAalg.PersistKeyInCsp = true;

but in WinRT are another classes in another namespace. 但是在WinRT中是另一个名称空间中的另一个类。 I'm looking for alternative how to store private key in container (or another safe place). 我正在寻找替代方法如何将私钥存储在容器(或其他安全的地方)。

I have spent a lot of time looking for the safest solution, but I find only few sites which could be usefull, eg: 我花了很多时间寻找最安全的解决方案,但我发现只有少数网站可以使用,例如:

http://www.rahulsingla.com/blog/2011/04/serializing-deserializing-rsa-public-private-keys-generated-using-bouncy-castle-library http://www.rahulsingla.com/blog/2011/04/serializing-deserializing-rsa-public-private-keys-generated-using-bouncy-castle-library

where is suggestion to keep decrypted private key (probably in file). 建议保留解密的私钥(可能在文件中)。 Is it safe? 安全吗?

I found CertificateEnrollmentManager class in Windows.Security.Cryptography.Certificates too. 我在Windows.Security.Cryptography.Certificates中找到了CertificateEnrollmentManager类。 But I can't understand how use this class to save certificate in KSP and encrypt/decrypt data by certificate. 但我无法理解如何使用此类在KSP中保存证书并通过证书加密/解密数据。

Windows stores private keys in \\Documents and Settings\\\\Application Data\\Microsoft\\Crypto\\RSA and requires that they be protected with a password. Windows将私钥存储在\\ Documents and Settings \\\\ Application Data \\ Microsoft \\ Crypto \\ RSA中,并要求使用密码保护它们。

The bottom line is that you want your private keys to be safe. 最重要的是,您希望您的私钥安全。 In some cases that means they can be stored on your hard drive. 在某些情况下,这意味着它们可以存储在您的硬盘上。 In other cases it means they should be stored in two-person access controlled safes with armed guards out front. 在其他情况下,这意味着它们应存放在双人通道控制的保险柜中,前面有武装警卫。 It just depends what's riding on any possible exposure. 这取决于任何可能的曝光。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM