Tag Archives: certificate

A real world example of digital signature checking

In this post we will see exactly how we can check if a SSL certificate hasn’t been tampered with.

We will use https://google.com as an example and we’re manually going to check that the certificate’s digital signature is valid. Other important steps such as traversing the entire chain is beyond the scope of this simple example. Certificates don’t remain valid forever, so today you will get different ones. For sake of reproduction. I’ve included the ones I used later on in this post.

When I browsed to Google, it returned 2 certificates to my browser:

  1. Its own certificate
  2. The certificate of the intermediate CA that signed Google’s certificate

We’re going to use the following approach to check the signature on Google’s certificate:


  1. Retrieve the digital signature included in Google’s certificate.

  2. Retrieve the intermediate CA’s public-key from the CA’s certificate.

  3. Decrypt the digital signature in Google’s certificate using the public-key from the intermediate CA. Now we have the hash value that the intermediate CA calculated at the time when it signed Google’s certificate.

  4. Calculate the hash value of Google’s certificate ourself

  5. Compare the two hash values. If they are the same, then Google’s certificate has not changed since it was signed and therefore we consider it to be valid

Retrieve the signature from Google’s certificate


Google’s certificate is listed further on in this post. Its in the PEM format which is just a base64 encoded representation of a X.509 certificate. I decoded it back into ‘plain old’ bytes and then I had the ASN.1 DER encoded version of the certificate. Using an ASN.1 viewer I can see that the entire X.509 file has the following structure.

SEQUENCE(3 elem)
    SEQUENCE(8 elem) <-- Google's part of the certificate. It contains 8 things, which I'm not showing here
    SEQUENCE(2 elem) <-- 2 elements that say which algorithm the intermediate CA used to sign Google's part of the certificate. Its a SHA1 with RSA encryption
    BIT STRING(2048 bit) <-- Intermediate CA's signature

So the last 2048 bits (256 bytes) contain the signature of the certificate. Below is the hex representation of those bytes:

348B7D645A64085B1FF6D86DF35480F9D913EADB09210B7E7402B7779F730077C7C7926A7A953DCD814C35E30608C02586A220795F965AF0E97F3CE5C32E7234FD6259782E447BFF73F6319797CA8DB1EB8D0A58119FB0794EF83ACCD8E45895C91FDCA97BB82FB425811E8A4CF0D41594618A5663BF774AC9CE2DBB9798E6E5BB6C5CCEC68B80D93E8C6748394B3822DE437C4FB93BCF302723ACD4D9ECAC75FFA4993D559C12C2E17228AC917942B1666D9948C6C42FAD1B0EB8F78AB0B38A5B392F85E7BDBFE97FD7534269CBB8FE22B03EF305514668DCE491683B1DD6852DBEE9C21E9C9E955B41E7078ACB722B2555CECBDEAD60AEC4FDC1C9A9686BE8

By the way. If you're doing these steps too and using an ASN.1 viewer, you might have noticed that I skipped the first byte of the contents. That's because its a BITSTRING and the following quote from the ITU-T X.690 specification implies that the content starts with a byte thats not really part of the content

The initial octet shall encode, as an unsigned binary integer with bit 1 as the least significant bit, the number of unused bits in the final subsequent octet. The number shall be in the range zero to seven.

Retrieve the intermediate CA's public-key from the CA's certificate


The CA's public-key is stored somewhere in the the middle of its certificate (not Google's certificate). Here I used the same trick of using an ASN.1 viewer to figure out which part of the ASN.1 contained the key.

The modulo is

009C2A04775CD850913A06A382E0D85048BC893FF119701A88467EE08FC5F189CE21EE5AFE610DB7324489A0740B534F55A4CE826295EEEB595FC6E1058012C45E943FBC5B4838F453F724E6FB91E915C4CFF4530DF44AFC9F54DE7DBEA06B6F87C0D0501F28300340DA0873516C7FFF3A3CA737068EBD4B1104EB7D24DEE6F9FC3171FB94D560F32E4AAF42D2CBEAC46A1AB2CC53DD154B8B1FC819611FCD9DA83E632B8435696584C819C54622F85395BEE3804A10C62AECBA972011C739991004A0F0617A95258C4E5275E2B6ED08CA14FCCE226AB34ECF46039797037EC0B1DE7BAF4533CFBA3E71B7DEF42525C20D35899D9DFB0E1179891E37C5AF8E7269

There are 2 odd things about this modulo. I know that its a 2048 bit / 256 byte key. However I have 257 bytes. You might think that we're running into that BITSTRING thing again here, but that's not the case as the ASN.1 tag specifies that the modulo element is an INTEGER. Whats really going on is that the RSA modulo is a 2048 bit unsigned number and that's serialized with an extra leading byte to indicate that its unsigned.

The exponent is:

01 00 01

Decrypt the signature from Google’s certificate


We know the intermediate CA's public key and we know the bytes that contain the signature of the certificate. So now we can do an RSA decyption on those bytes and voila, we will have the hash that the intermediate CA calculated during the signing process.

I used the following snippet of Python to do this. But most languages should be able to do this:

#Decrypt the signature from the certificate using the intermediate CA's public RSA key
modulo    = 0x009C2A04775CD850913A06A382E0D85048BC893FF119701A88467EE08FC5F189CE21EE5AFE610DB7324489A0740B534F55A4CE826295EEEB595FC6E1058012C45E943FBC5B4838F453F724E6FB91E915C4CFF4530DF44AFC9F54DE7DBEA06B6F87C0D0501F28300340DA0873516C7FFF3A3CA737068EBD4B1104EB7D24DEE6F9FC3171FB94D560F32E4AAF42D2CBEAC46A1AB2CC53DD154B8B1FC819611FCD9DA83E632B8435696584C819C54622F85395BEE3804A10C62AECBA972011C739991004A0F0617A95258C4E5275E2B6ED08CA14FCCE226AB34ECF46039797037EC0B1DE7BAF4533CFBA3E71B7DEF42525C20D35899D9DFB0E1179891E37C5AF8E7269
exponent  = 0x010001
signature = 0x348B7D645A64085B1FF6D86DF35480F9D913EADB09210B7E7402B7779F730077C7C7926A7A953DCD814C35E30608C02586A220795F965AF0E97F3CE5C32E7234FD6259782E447BFF73F6319797CA8DB1EB8D0A58119FB0794EF83ACCD8E45895C91FDCA97BB82FB425811E8A4CF0D41594618A5663BF774AC9CE2DBB9798E6E5BB6C5CCEC68B80D93E8C6748394B3822DE437C4FB93BCF302723ACD4D9ECAC75FFA4993D559C12C2E17228AC917942B1666D9948C6C42FAD1B0EB8F78AB0B38A5B392F85E7BDBFE97FD7534269CBB8FE22B03EF305514668DCE491683B1DD6852DBEE9C21E9C9E955B41E7078ACB722B2555CECBDEAD60AEC4FDC1C9A9686BE8
IntermediateCAsHash = pow(signature, exponent, modulo)
bytesOfHash = IntermediateCAsHash.to_bytes(sys.getsizeof(IntermediateCAsHash),byteorder='big', signed=False)
print ( "%s" % ''.join(format(x, '02X') for x in bytesOfHash ))

Running this code, gave me the following output ( I manually added line breaks, so remove them if you ever copy/paste this somewhere):

00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000001FFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFF003021300906052B0E03021A
05000414F8F3D8AACF7E27B2F66A2231
C3240682A15ADFF6

The 0000...1FFF...FF00 part is an RSA Encryption Block Type 1 from the PKCS#1 standard and isn't really part of the data that the intermediate CA wanted to encrypt. We can ignore it and focus on the 3021300906052B0E03021A05000414F8F3D8AACF7E27B2F66A2231C3240682A15ADFF6 part. This part is an ASN.1 DER encoded data-structure defined in RFC2313 as:

DigestInfo ::= SEQUENCE {
     digestAlgorithm DigestAlgorithmIdentifier,
     digest Digest
}
DigestAlgorithmIdentifier ::= AlgorithmIdentifier
Digest ::= OCTET STRING

The AlgorithmIdentifier is defined in RFC 5280 as

AlgorithmIdentifier  ::=  SEQUENCE  {
    algorithm               OBJECT IDENTIFIER,
    parameters              ANY DEFINED BY algorithm OPTIONAL
}

So this means we should get:

SEQUENCE(2 elements)
    SEQUENCE(2 elements)
        OBJECT IDENTIFIER
        NULL (see RFC2313)
    OCTET STRING 

And indeed when we use the ASN.1 decoder we get the following output:

SEQUENCE(2 elem)
    SEQUENCE(2 elem)
        OBJECT IDENTIFIER 1.3.14.3.2.26 sha1(OIW)
        NULL
    OCTET STRING(20 byte) F8F3D8AACF7E27B2F66A2231C3240682A15ADFF6

So, now we know that the hash value calculated by the intermediate CA is

F8F3D8AACF7E27B2F66A2231C3240682A15ADFF6

Calculate the hash value of Google's certificate ourself


Now we are going to repeat the same hash calculation that the intermediate CA did a long time ago. We will:

  1. Need to extract the bytes that represents Google's part of the certificate.This may NOT include any of bytes that hold the digital signature itself.
  2. Run a SHA1 hash calculation on it.

The following python code does that and when I run it, it prints

F8F3D8AACF7E27B2F66A2231C3240682A15ADFF6

.

So we conclude that Google's certificate has not been tampered with!

import base64
import hashlib
    
def showSha1HashOfCertificate(bashe64EncodedCert):

    #Before doing the base64 decoding, we need to remove the 1st and last lines
    certificateWithoutCommentLines = bashe64EncodedCert.replace("-----BEGIN CERTIFICATE----","").replace("----END CERTIFICATE-----","")
    bytesOfCertificate =  base64.b64decode(certificateWithoutCommentLines)
    
    #The hash is calculated over the bytes that resulted from DER encoding the part that the X.509 specs
    #refer as the 'tbsCertificate' field of the entire certificate. 
    #Using the ASN.1 viewer I see that the tbsCertificate (the first member of the sequence) starts at offset 4 and its length is 4 + 1453 bytes     
    bytesOftbsCertificatePart = bytesOfCertificate[4: 1461]
    sha1Hasher = hashlib.sha1()
    sha1Hasher.update(bytesOftbsCertificatePart)
    ourHash = sha1Hasher.digest();
    print ("%s" % ''.join(format(x, '02X') for x in ourHash ))

googlesBashe64EncodedCert = """
-----BEGIN CERTIFICATE-----
MIIGxTCCBa2gAwIBAgIIVGohyFSBd4owDQYJKoZIhvcNAQEFBQAwSTELMAkGA1UE
... I removed a lot of the lines for brevity
rsT9wcmpaGvo
-----END CERTIFICATE-----
"""

showSha1HashOfCertificate(googlesBashe64EncodedCert)

The certificates


Below is the certificate for Google (its a big one!)

-----BEGIN CERTIFICATE-----
MIIGxTCCBa2gAwIBAgIIVGohyFSBd4owDQYJKoZIhvcNAQEFBQAwSTELMAkGA1UE
BhMCVVMxEzARBgNVBAoTCkdvb2dsZSBJbmMxJTAjBgNVBAMTHEdvb2dsZSBJbnRl
cm5ldCBBdXRob3JpdHkgRzIwHhcNMTUwNDA4MTM0MDEwWhcNMTUwNzA3MDAwMDAw
WjBmMQswCQYDVQQGEwJVU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the certificate of the intermediate CA that signed the above certificate:

-----BEGIN CERTIFICATE-----
MIID8DCCAtigAwIBAgIDAjp2MA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT
MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i
YWwgQ0EwHhcNMTMwNDA1MTUxNTU1WhcNMTYxMjMxMjM1OTU5WjBJMQswCQYDVQQG
EwJVUzETMBEGA1UEChMKR29vZ2xlIEluYzElMCMGA1UEAxMcR29vZ2xlIEludGVy
bmV0IEF1dGhvcml0eSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
AJwqBHdc2FCROgajguDYUEi8iT/xGXAaiEZ+4I/F8YnOIe5a/mENtzJEiaB0C1NP
VaTOgmKV7utZX8bhBYASxF6UP7xbSDj0U/ck5vuR6RXEz/RTDfRK/J9U3n2+oGtv
h8DQUB8oMANA2ghzUWx//zo8pzcGjr1LEQTrfSTe5vn8MXH7lNVg8y5Kr0LSy+rE
ahqyzFPdFUuLH8gZYR/Nnag+YyuENWllhMgZxUYi+FOVvuOAShDGKuy6lyARxzmZ
EASg8GF6lSWMTlJ14rbtCMoU/M4iarNOz0YDl5cDfsCx3nuvRTPPuj5xt970JSXC
DTWJnZ37DhF5iR43xa+OcmkCAwEAAaOB5zCB5DAfBgNVHSMEGDAWgBTAephojYn7
qwVkDBF9qn1luMrMTjAdBgNVHQ4EFgQUSt0GFhu89mi1dvWBtrtiGrpagS8wEgYD
VR0TAQH/BAgwBgEB/wIBADAOBgNVHQ8BAf8EBAMCAQYwNQYDVR0fBC4wLDAqoCig
JoYkaHR0cDovL2cuc3ltY2IuY29tL2NybHMvZ3RnbG9iYWwuY3JsMC4GCCsGAQUF
BwEBBCIwIDAeBggrBgEFBQcwAYYSaHR0cDovL2cuc3ltY2QuY29tMBcGA1UdIAQQ
MA4wDAYKKwYBBAHWeQIFATANBgkqhkiG9w0BAQUFAAOCAQEAJ4zP6cc7vsBv6JaE
+5xcXZDkd9uLMmCbZdiFJrW6nx7eZE4fxsggWwmfq6ngCTRFomUlNz1/Wm8gzPn6
8R2PEAwCOsTJAXaWvpv5Fdg50cUDR3a4iowx1mDV5I/b+jzG1Zgo+ByPF5E0y8tS
etH7OiDk4Yax2BgPvtaHZI3FCiVCUe+yOLjgHdDh/Ob0r0a678C/xbQF9ZR1DP6i
vgK66oZb+TWzZvXFjYWhGiN3GhkXVBNgnwvhtJwoKvmuAjRtJZOcgqgXe/GFsNMP
WOH7sf6coaPo/ck/9Ndx3L2MpBngISMjVROPpBYCCX65r+7bU2S9cS+5Oc4wt7S8
VOBHBw==
-----END CERTIFICATE-----

How to generate self signed certificates

Sometimes you need a self-signed certificate for the purpose of testing websites or digitally signing files such as PDFs. Your PDF software will probably ask you for a .pfx file. You can generate these on Windows, Mac or linux

On Windows


On windows, with Visual Studio, you can use the makecert utility:

cd "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\"
.\makecert.exe -r -a sha512 -len 4096 -pe -sv c:\users\gerben\documents\example.key -n "CN=Test" c:\users\gerben\documents\example.cer
.\pvk2pfx.exe -pvk c:\users\gerben\documents\example.key -spc c:\users\gerben\documents\example.cer -pfx c:\users\gerben\documents\example.pfx -po PasswordForPfxFile

Linux and Mac


Most linux and OSX machines have openssl installed by default. You can generate the various files as follows:

commandprompt> openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout example.key -out example.pem -subj "/C=NL/O=Tester/CN=example.com/emailAddress=test@example.com"
commandprompt> openssl pkcs12 -export -out example.pfx -inkey example.key -in example.pem 
#openssl will ask you for a password. Don't forget it

This will output the following:

File Description
example.key Your private key.
example.pem The certificate. This also contains your public key
example.pfx An encrypted, password protected file that contains both your private and public key

You can see your public key with the following command:

commandprompt> openssl x509 -in example.pem -pubkey
-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC52G+QBJsz1m/rzINSjzABnLjQ
18c+PGMn+w0CxCHsOkIGBRYP80k8+ZznhlMJ2pJ7knM5McHUuYxfBaMU1GraTjS5
c0nb/5AbPR6iWM5rI/Ha02CMmZmSsspq2RhSZZU0Buco0sAqjf9KPn6/uuoNdvTe
kDTMIH7cgB+NsJSadwIDAQAB
-----END PUBLIC KEY-----

You can see the contents of your certificate using the following command:

commandprompt> openssl x509 -in example.pem -text
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            fd:22:40:d8:00:b8:68:fa
        Signature Algorithm: sha1WithRSAEncryption
        Issuer: C=NL, O=Tester, CN=example.com/emailAddress=test@example.com
        Validity
            Not Before: Apr 16 12:52:39 2015 GMT
            Not After : Apr 15 12:52:39 2016 GMT
        Subject: C=NL, O=Tester, CN=example.com/emailAddress=test@example.com
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
            RSA Public Key: (1024 bit)
                Modulus (1024 bit):
                    00:b9:d8:6f:90:04:9b:33:d6:6f:eb:cc:83:52:8f:
                    30:01:9c:b8:d0:d7:c7:3e:3c:63:27:fb:0d:02:c4:
                    21:ec:3a:42:06:05:16:0f:f3:49:3c:f9:9c:e7:86:
                    53:09:da:92:7b:92:73:39:31:c1:d4:b9:8c:5f:05:
                    a3:14:d4:6a:da:4e:34:b9:73:49:db:ff:90:1b:3d:
                    1e:a2:58:ce:6b:23:f1:da:d3:60:8c:99:99:92:b2:
                    ca:6a:d9:18:52:65:95:34:06:e7:28:d2:c0:2a:8d:
                    ff:4a:3e:7e:bf:ba:ea:0d:76:f4:de:90:34:cc:20:
                    7e:dc:80:1f:8d:b0:94:9a:77
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Subject Key Identifier: 
                B4:82:EE:F5:8A:75:34:82:BD:23:03:3B:96:E4:A9:AE:B7:3B:5F:A9
            X509v3 Authority Key Identifier: 
                keyid:B4:82:EE:F5:8A:75:34:82:BD:23:03:3B:96:E4:A9:AE:B7:3B:5F:A9
                DirName:/C=NL/O=Tester/CN=example.com/emailAddress=test@example.com
                serial:FD:22:40:D8:00:B8:68:FA

            X509v3 Basic Constraints: 
                CA:TRUE
    Signature Algorithm: sha1WithRSAEncryption
        76:27:e2:e6:07:a2:cd:db:3a:6a:14:f4:a1:17:8e:7e:ff:97:
        da:b4:78:29:a1:33:be:ca:49:5f:26:83:6c:f8:40:9e:65:67:
        91:ae:b8:14:5c:09:85:7f:e6:a0:6d:bb:a5:7d:e7:16:2e:c9:
        6b:86:39:16:74:6f:e6:5c:40:8a:a0:4e:ec:eb:70:1a:85:e4:
        a1:7c:21:e1:a5:71:76:3b:dc:43:74:f2:ee:a7:eb:d2:f9:5b:
        44:3e:26:7a:f8:e8:c7:40:c9:71:b9:e7:ad:93:8d:69:00:69:
        16:e2:fb:e5:6d:45:b2:fb:8f:df:fc:2b:c7:a9:58:59:35:22:
        56:7f
-----BEGIN CERTIFICATE-----
MIIC4TCCAkqgAwIBAgIJAP0iQNgAuGj6MA0GCSqGSIb3DQEBBQUAMFUxCzAJBgNV
BAYTAk5MMQ8wDQYDVQQKEwZUZXN0ZXIxFDASBgNVBAMTC2V4YW1wbGUuY29tMR8w
HQYJKoZIhvcNAQkBFhB0ZXN0QGV4YW1wbGUuY29tMB4XDTE1MDQxNjEyNTIzOVoX
DTE2MDQxNTEyNTIzOVowVTELMAkGA1UEBhMCTkwxDzANBgNVBAoTBlRlc3RlcjEU
MBIGA1UEAxMLZXhhbXBsZS5jb20xHzAdBgkqhkiG9w0BCQEWEHRlc3RAZXhhbXBs
ZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALnYb5AEmzPWb+vMg1KP
MAGcuNDXxz48Yyf7DQLEIew6QgYFFg/zSTz5nOeGUwnaknuSczkxwdS5jF8FoxTU
atpONLlzSdv/kBs9HqJYzmsj8drTYIyZmZKyymrZGFJllTQG5yjSwCqN/0o+fr+6
6g129N6QNMwgftyAH42wlJp3AgMBAAGjgbgwgbUwHQYDVR0OBBYEFLSC7vWKdTSC
vSMDO5bkq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