The important thing here is to trim leading zeros that serve just for filling data into byte octets.
04CF = 4CF
4CF(hex) = 1231 (int)
Accessing the certificate serial number can be done in many ways. This is just an example.
//Load certificate X509Certificate2 _certificate = new X509Certificate2("C:\mycert.p12"); //Extract serial number and trim leading zeros String serialHex = _certificate.SerialNumber.TrimStart('0'); //Convert from hex to integer (im converting it also to string) String serialInteger = int.Parse(serialHex, NumberStyles.HexNumber).ToString();
Leave a Reply