Certificates For Non-Techies

certificate Jan 24, 2019

I've been planning to write this for a while now, and finally have a bit of spare time to hopefully be able to write something which will help others.

When people come across certificates, it often appears to be some sort of black magic. I would know, I used to be one of these very people. But in reality once you have a firm grasp of the basic concepts of certificates, they are not that complicated. The purpose of this post to hopefully help bridge this gap and provide a means to allow others a better understanding of certificates and how they play a role in security.


Ultimately all certificates are used as part of a cryptographic function. That is not to say all cryptographic functions involve certificates, however you will not find a certificate which is being used outside of some form of cryptographic function. These functions typically only boil down to 2 types:

  • Public-key encryption
  • Some form of cryptographic signing - typically used to validate something or someone

I'm going to touch on the public key, since this is an underlying foundation to typical certificates (at least all certificates which are used for web sites as well as digital signatures). As the name suggests there is a public key. Now this notion of a key being public may seem as weird, but it is still as the name suggests. The key is meant to be publicly shared, scary right? Well not quite, there is an associated private key. This key has to be kept private, as the name suggests. This private key is used by the key holder to perform that sensitive cryptographic functions (more on this later).

Certificate Structure


For this post I will only focus on X.509 certificates. These are by far your most common defining format of certificates. X.509 certificates are also available in different formats:


For the structure of a X.509 certificate I will only focus on v3, since again these are going to be vastly the majority which you will encounter.

v3 certificates have the basic structure of:

  • Certificate
    • Data
      • Version: 3 (0x2)
      • Serial Number
      • Signature Algorithm
      • Issuer
      • Validity period
        • Not Before
        • Not After
      • Subject
      • Subject Public Key Info
        • Public Key Algorithm (along with the public key)
      • X509v3 extensions (optional)
    • Signature Algorithm (along with signature)

For example the current (at the time of writing this post) X.509 certificate for https://www.google.co.uk looks like:

        Version: 3 (0x2)
        Serial Number: 4627240520293488349 (0x403742bcae6316dd)
        Signature Algorithm: sha256WithRSAEncryption
        Issuer: C = US, O = Google Trust Services, CN = Google Internet Authority G3
            Not Before: Jan  8 08:21:00 2019 GMT
            Not After : Apr  2 08:21:00 2019 GMT
        Subject: C = US, ST = California, L = Mountain View, O = Google LLC, CN = www.google.co.uk
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                RSA Public-Key: (2048 bit)
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Extended Key Usage: 
                TLS Web Server Authentication
            X509v3 Subject Alternative Name: 
            Authority Information Access: 
                CA Issuers - URI:http://pki.goog/gsr2/GTSGIAG3.crt
                OCSP - URI:http://ocsp.pki.goog/GTSGIAG3

            X509v3 Subject Key Identifier: 
            X509v3 Basic Constraints: critical
            X509v3 Authority Key Identifier: 

            X509v3 Certificate Policies: 

            X509v3 CRL Distribution Points: 

                Full Name:

    Signature Algorithm: sha256WithRSAEncryption

Generating Certificates

The process of generating a certificate involves several steps:

  1. Generate the private key which will be used for the certificate.
  2. Generate a Certificate Signing Request (CSR), using the private key. This includes all the details from the requester which will be included in the certificate, such as Subject information (name, email address, organization, etc).
  3. Post the CSR to a CA (more on this below), and obtain the certificate back from the CA.

The process of generating a certificate from a CSR involves the private key for the CA. This means that a CA is nothing more than a glorified certificate! In fact CA's are certificates, where one could view them simply as signing certificates (they are differentiation by the X509v3 Extended Key Usage field having an entry of Certificate Sign, as well as the X509v3 Basic Constraints: critical field having a value of CA:TRUE).

Chain of Trust

Now there is a problem. What is stopping me from simply trying to create my own certificate for an existing site, which I have no authority over (for example www.google.com)? Well this is where the notion of a Certificate Authority comes into play. Certificate Authorities, or CA's, are organizations which the consumer of the certificate (say a user browsing to a site) has placed a form of trust in, to ensure that certificates are only issued to those authorized to do so.

It so happens that many software vendors and applications, such as web browsers and Operating Systems, have already vetted (and consistently do so) a list of CA's whom they deem to be trust worthy. This list forms what sometimes referred to as a trust store. This is simply a list of CA certificate (and hence the public keys of the CAs). The application will then use the public key of the CA to ensure that the presented certificate was signed by the private key of the CA (which it trusts).

The chain of trust notion comes into the fact that a CA is nothing more than a glorified certificate. This means that a CA can (and in fact do) generate another certificate which in turn itself could become a CA. So what you end up having a hierarchical structure for trust. Form example if you have a look at the certificate for https://www.google.co.uk again (taken from a SSL Labs scan):


You will see that the server certificate has been signed by CA named Google Internet Authority G3 and that CA has been generated from (it's certificate signed by) a CA named GlobalSign. Also interesting in the above image we notice that the scan trusted all the certificates.

The magic of all of this is if I trust the top level CA, I will then trust ALL certificates generated by that CA, including any certificates generated by children CAs (so long at the application can validate the full chain back up to the root). Some terminology you might hear regarding this is a root CA (the top level or root level CA) and subordinate CAs (or children CAs, CA's generated from the root CA).

Most clients also have the option to explicitly trust a certificate itself. This is typically done when one uses a self-signed certificate.

Certificate Validation

Signing Validation

I briefly touched on certificate validation above, in terms of a client validating that a certificate has been signed by a trusted CA. How does this actually work? Well when a CA generates a certificate from a CSR, it signs the certificate with it's own private key. And since only this CA should only ever have this private key, only this CA can generate that signature. When a client wishes to validate the certificate it, will take the public key of the CA (from the CA's certificate), and ensure that the signature on the certificate which it is validating is valid. I won't go into the details, but this is the basic principle of signing with a private key and then validating with the public key. If a different private key (and hence different CA) was used to generate the signature, then validation will fail with using the non-matching public key. Another key feature of this process is to ensure that the certificate has not been tampered with. Otherwise a malicious actor could simply change a certificate which they obtained legitimately to fit their needs. For example they could request a certificate to evil.eve.com and simply alter the certificate to become for www.google.com


This is pretty obvious so I won't go into much detail. The validity fields on the certificate (not before and not after) need to be validated to ensure that the certificate is still valid. This is becoming more and more important since certificate revocation is not in a particularly good state at the moment.

Common Name and Subject Alternative Name

Validating the Common Name (CN) and/or Subject Alternative Name (SAN) are a requirement of a server certificate. For secure connections you not only want to prevent someone from tampering with or spying on what you a sending and receiving from a server, but you need to validate that you are indeed communicating with the intended server.

For client certificates, this depends on the server and it's implementation. For signing certificates this will only be meta-data and is not all that important for the signing process.

When validating the CN or SAN, the client will need to ensure that:

  • If a DNS entry is in the SAN, that one of the entries matches the hostname of the certificate for the server which it is connecting to.
  • If no entry exists, then the client will look to the CN field.

Wildcards allow for many domains to be associated with a single certificate. However this carries its own risks and is something which I advise against. Also I've notice that some clients are now only looking at the SAN field and are not longer looking at the CN field at all.


Yes certificate are perhaps a bit confusing and scary at first, but once you boil them down to their basic components and abstract away some of the complexities that they have associated with them (such as the maths and cryptography), they are not all at that difficult to understand. Hopefully this post will hope some have a better understanding of certificates and how they work.

Do's & Don'ts

  • Don't share a certificate's private key. If this is compromised the certificate becomes worthless from a security perspective.
  • Do validate certificates:
    • Signed by a trusted CA.
    • For server certificates the hostname of the server appears in the CN field or as a DNS entry in the SAN field.
    • Validate that the certificate has not expired.
  • Don't blindly trust CA's. Ensure that the CA is a reputable CA and one which can be trusted to follow best practices to ensure that only authorized requesters obtain certificates signed by it.
  • Do share certificates (only the certificate itself), these are meant to be public, and you do not gain any security value keeping these private.


Sean Wright

Lead Application Security SME at Immersive Labs with an origin as a software developer. Primarily focused on web based application security with a special interest in TLS related subjects.

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.