[英]C# Convert a PublicKey to string and vice-versa
We are using PublicKeys in C#. 我们在C#中使用PublicKeys。 We are need to store and retrieve them from a sql database.
我们需要存储和从sql数据库中检索它们。 At the moment I am storing them as a string and I am not able to convert the string back to a public key token.
目前,我将它们存储为字符串,但无法将字符串转换回公钥令牌。
If you may please help me understand how to do so? 如果可以,请您帮我了解如何做? Or if there is a better way of implementing the same.
或者,如果有更好的方法来实现这一点。
Thanks! 谢谢!
如果您打算与X.509v3证书进行相互转换,请签出PublicKey类
If you have an x.509 certificate check out the X509Certificate2 class. 如果您具有x.509证书,请签出X509Certificate2类。 There is an
Import
method you can use to load up your key from a string
or byte[]
您可以使用一种
Import
方法从string
或byte[]
加载密钥byte[]
http://msdn.microsoft.com/en-us/library/ms148438(v=vs.110).aspx http://msdn.microsoft.com/en-us/library/ms148438(v=vs.110).aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.