Tuesday, 15 April 2014

.net - Getting X509SerialNumber integer value from X509Certificate2 -


I am trying to receive a X509.v3 evidence (as I X50 9Certificate2 object) Serial Number It is an XML signature created by another software working with a lot of certificates, and it has a serial number of X509 serial number element in XADDC XML, which is considered to be an integer. Is:

  & lt; Ks509SerialNumber xmlns = "http: //wwwkv3 org / 2000/09 / Ksmldasing #" & gt; 1315010063538360283821765366094690 & lt; / X509SerialNumber & gt;  

Unfortunately, I assume it would be unable to get out of X509Certificate2 object that has been started with the certificate used to sign the above XML. The value that I get

  X509 Certificate 2-> SerialNumber = "40D5C2ADDEFD92740000000B9B62" X509Certificate2- & gt; GetSerialNumber () = "40D5C2ADDEFD92740000000B9B62" Convert :: ToBase64String (X509Certificate2- & gt; GetSerialNumber ()) = "YpsLAAAAdJL93q3C1UA ="  

I GetSerialNumber () Returns a Base64String . As you can see, GetSerialNumber () and GetSerialNumber () return different values, out of these values ​​"131501006353836028382121366366094690" what is the way to get an integer value ?

Something like this should work:

  var serialHexString = "40D5C2ADDEFD92740000000B9B62 "; Var serial = Bigintegrkprs (Siriylhaksstring, number Stailkhaksonnbr);  

No comments:

Post a Comment