However, I have two problems:
Serial number is displayed as 32 char hexadecimal string
The resulting numbers are a lot of 0's, such as ‘00 .
I have tried to set the formatter with various . but this still did not solve it. I tried to use all the different options as you can see from the code below.
byte[] rr = null;
Org.BouncyCastle.X509.X509Store x509Store = new Org.BouncyCastle.X509.X509Store();
x509Store.Open(OpenFlags.ReadWrite);
Org.BouncyCastle.X509.Store.Item item = x509Store.GetCertificate(x509CertificateName);
if (item!= null)
{
rr = new byte[(int)item.GetLength(0)];
x509Store.GetCertificate(x509CertificateName).Export(item, rr, Org.BouncyCastle.X509.X509ContentType.Cert);
Org.BouncyCastle.X509.X509CertificateCollection collection = new Org.BouncyCastle.X509.X509CertificateCollection(rr);
foreach (Org.BouncyCastle.X509.X509Certificate certificate in collection)
{
Console.WriteLine(certificate.GetSerialNumber().GetPosHex());
}
}
A:
This code worked for me: ac619d1d87
Related links:
コメント