How to store a public key in a machine-level RSA key container

梦想与她 提交于 2019-11-29 02:04:49

It seems that key containers are not intended for this purpose (this is implied by "How to: Store Asymmetric Keys in a Key Container" from the .NET Framework Developer's Guide, and confirmed by a disccusion on MSDN).

Other mechanisms, such as storing the key in an XML file, need to be used to achieve this goal.

WarrenDodsworth

This link may help you. http://msdn.microsoft.com/en-IN/library/tswxhw92(v=vs.80).aspx

var cp = new CspParameters();
cp.KeyContainerName = ContainerName;

// Create a new instance of RSACryptoServiceProvider that accesses
// the key container.
RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(cp);

// Delete the key entry in the container.
rsa.PersistKeyInCsp = false;

// Call Clear to release resources and delete the key from the container.
rsa.Clear();

This is what it says about key deletion.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!