Extract Serial SSL Certificate

The client and server contain the corresponding certificate.

When the server sends a message, it decodes the serial number in the certificate and sends it to the client. The client can then get a batch from its copy of the certificate and compare it with the one presented by the server. They must match.

The string representation of the sequence in the certificate is displayed as follows: -

58 17 9B 11 9E 0E F3 86 4A 41 DF A2 EE 60 92 08 58 17 9B 11 9E 0E F3 86 4A 41 DF A2 EE 60 92 08

Windows Server retrieves bytes using the method: X509Certificate.GetSerialNumber . The selected bytes looks like this: -

8 146 96 238 162 223 65 74 134 243 14 158 17 155 23 88 8 146 96 238 162 223 65 74 134 243 14 158 17 155 23 88

On OS X (client), using Core Foundation's SecCertificateCopySerialNumber function , the extracted bytes return: -

88 23 -101 -09 14 -13 -122 74 65 -33 -94 -18 96 -110 8 88 23 -101 17 -98 14 -13 -122 74 65 -33 -94 -18 96 -110 8

It is clear that they are not the same. Alternatively, using Qt, one can use QSslCertificate and get the serial number by calling SERIALNUMBER () . However, this returns the following bytes: -

53 56 58 49 55 58 57 98 58 49 49 58 57 101 58 48 101 58 102 51 58 56 54 58 52 97 58 52 49 58 100 102 58 97 50 58 101 101 58 54 48 58 57 50 58 48 56 58 53 56 58 49 55 58 57 98 58 49 49 58 57 101 58 48 101 58 102 51 58 56 54 58 52 97 58 52 49 58 100 102 58 97 50 58 101 101 58 54 48 58 57 50 58 48 56

What's going on here, why none of the byte arrays match, and how can I retrieve the serial number on OSX that matches the serial number from the Windows server?

+3


source to share


1 answer


String, unsigned characters, hexadecimal

58 17 9B 11 9E 0E F3 86 4A 41 DF A2 EE 60 92 08 58 17 9B 11 9E 0E F3 86 4A 41 DF A2 EE 60 92 08

      

Windows, unsigned characters, reversed decimal notation

8 146 96 238 162 223 65 74 134 243 14 158 17 155 23 88 8 146 96 238 162 223 65 74 134 243 14 158 17 155 23 88

      



OS X, signed characters, decimal representation

88 23 -101 -09 14 -13 -122 74 65 -33 -94 -18 96 -110 8 88 23 -101 17 -98 14 -13 -122 74 65 -33 -94 -18 96 -110 8

      

All three views are equal to each other

+4


source







All Articles