C#有base64的编码的包装类吗?是哪个?

dreamdragon2008 2003-09-12 04:22:07
C#有base64的编码的包装类吗?是哪个?
...全文
56 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
dreamdragon2008 2003-09-12
  • 打赏
  • 举报
回复
我试试看,行的话,就来给分。
CMIC 2003-09-12
  • 打赏
  • 举报
回复
Convert.ToBase64String():
storm97 2003-09-12
  • 打赏
  • 举报
回复
Decode the Base64 certificate data. For example, the following Visual C# sample code decodes Base64 certificate data:
using System;
using System.IO;
using System.Security.Cryptography.X509Certificates;
using System.Text;

namespace ReadBase64Cert
{
public class ReadBase64Cert
{
public ReadBase64Cert()
{
}
public static void Main(string[] args)
{
if (args.Length < 1)
{
Console.WriteLine("Usage: Base64EncodedFile (.cer)\n");
return;
}

// args[0] - Base64Encoded .cer file

// Open the certificate, and read it into a byte array.
FileStream certFile = new FileStream(args[0],
FileMode.Open,
FileAccess.Read);
int size = (int)certFile.Length;
byte[] certBytes = new byte[size];
size = certFile.Read(certBytes, 0, size);
certFile.Close();

// Remove the unnecessary characters.
String certString = Encoding.ASCII.GetString(certBytes);
StringBuilder sb = new StringBuilder(certString);
sb.Replace("-----BEGIN CERTIFICATE-----", "");
sb.Replace("-----END CERTIFICATE-----", "");

// Decode the bytes from base64 to raw bytes.
certBytes = Convert.FromBase64String(sb.ToString());
X509Certificate cert = new X509Certificate(certBytes);
Console.WriteLine(cert.GetName());
}
}
}

yewei4u 2003-09-12
  • 打赏
  • 举报
回复
应该没有,base64比较专业了

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧