简体   繁体   English

C#将PublicKey转换为字符串,反之亦然

[英]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方法从stringbyte[]加载密钥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.

相关问题 在C#中将字符串数组转换为简单字符串,反之亦然 - converting an array of strings into a simple string and vice-versa in c# C#字节数组为字符串,反之亦然 - C# byte array to string, and vice-versa c# - 可以从C#类型转换为System.Type但反之亦然 - c# - can convert from C# type to System.Type but not vice-versa 用于将字节数组转换为字符串的编码,反之亦然 - Encoding to use to convert Bytes array to String and vice-versa 在z#中将zenkaku字符转换为hankaku,反之亦然 - Converting zenkaku characters to hankaku and vice-versa in C# 在C#中将十进制数组转换为字节数组,反之亦然 - Converting decimal array to byte array and vice-versa in C# 在C#中将数字数组通用转换为字节,反之亦然 - Generic conversion of number arrays into bytes and vice-versa in C# 从Java运行C#代码,反之亦然 - Run C# code from Java and vice-versa 在c#中将包含数组和字典的字符串转换为列表,反之亦然 - Convert the string containing array and dict into the list and vice versa in c# C#如何将以下表示形式的excel单元格地址转换为“ LetterNumber”到“ Number,Number”,反之亦然? - C# How can I convert an excel cells address in the following notation: “LetterNumber” to “Number, Number” and vice-versa?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM