How to order certificate chain?
Well, the general case is that you do your certificate chain validation with one of these two approaches.
Verify that all certificates are self signed and therefore not trusted. Don't trust any certificates, except a few exceptions. This can be in the form of trusted third party certificates (Google, Gmail) or certificates provided by trusted authorities (Microsoft).
Verify certificates chain. The approach is that you verify the certificates from top to bottom. This will ensure that there is no problem with any certificate as long as the previous certificate has not been revoked.
However, if you want to further verify a third party certificate, you would need to get its certificate from a trusted authority.
What is a certificate chain?
Certificate chains link certificates together to help you determine which certificate was used to secure the connection.
Certificates are issued by governments, so your web browser doesn't know who is validating the credentials of another website. The certificate chain helps the browser decide what level of assurance it can give to the recipient.
What is a certificate? A certificate is basically a digital signature that helps identify someone or something that is authentic. A certification authority issues certificates, and the other party validates the certificate as authentic. All communication on the web is secured by certificates, because we don't trust any of our websites to be trustworthy. If a website were to use its own self-signed certificate, it could pass on untrusted information or send you malware.
Every website that you interact with has a self-signed certificate, because these are easy to create and inexpensive. To combat this, websites may use root certificates, allowing them to confirm the authenticity of other certificates. These root certificates include some of the most well-known names in the industry like VeriSign, Microsoft, and Thawte.
An expired certificate will look like this: Let's dig into the ins and outs of the process of looking up the certificate for a website. Once you find the certificate, you'll need to download it to your computer. As a rule of thumb, you should never download a certificate directly from a website, but only from a site you trust. Let's take a look at how you find the certificate:
Searching for a certificate. You start your search for a certificate by searching for the website in question. For example, if you want to look at Twitter, type twitter.com into your address bar and hit enter.
The site's domain name is what determines how to navigate to it. Each website has its own domain name. This is how Google recognizes the page if you search for twitter.com and Google sends the results to you. If you type goo.gl into your address bar, Google recognizes that you are looking for the domain google.com and directs you to that page. If you do a search on Google's homepage, your browser asks Google which version of Google.com it should connect to, so the browser can make an informed decision.
How to download a certificate chain?
If I want to download a certificate from our certificate signing authority (to install in my CA) what do I need to do? Here's the scenario: A CA (CertSigningService) issues certificates to clients (certificate signing request). Clients are required to upload their certs to the CA (this is an ISO requirement). The CA has a chain of intermediate certificates linking back to the CA root certificate. I want to copy the whole chain of certs (eg from the client cert to the root CA cert) to my local machine. What do I need to do to get the chain? How does one normally retrieve a chain from a CA? Downloading the entire chain is probably not very useful. I think what you're looking for is a single certificate from the root certificate.
I use this method on Windows: Connect to the CA server. Reverse the certificate path and download the certificate from the root CA certificate. This will work on any certificate including self-signed ones. Also, as mentioned in a comment, there are ways to do this using OpenSSL on other platforms.
How to generate an SSL certificate chain?
You can use one of the following tools to generate a self-signed certificate chain for web server and client applications.
Let's see an example using letsencrypt.org: Create a new letsencrypt.org account It's free, and it only takes a few minutes to create a new letsencrypt account. Generate a letsencrypt certificate. Click Create your first certificate. Select Certificate Authority (CA), and hit Next. Enter the domain name for which you want to create a certificate, and select the domain registrar that you want to use for the certificate. Enter the desired certificate options, and select Create and download my certificate. Generate a self-signed certificate chain. The letsencrypt.org certificate chain generator requires you to provide your public certificate, and it will automatically generate a self-signed certificate chain for you.
Copy the letsencrypt certificate chain. Letsencrypt certificate chain generator can also generate a file containing the letsencrypt certificate chain. The file will be saved in .zip format. You can download the .zip file to your computer.
Export the letsencrypt certificate chain. Click Export my certificate. Enter the name of the file that you want to save the letsencrypt certificate chain as, and select the directory where you want to save the file. Install the letsencrypt certificate chain. Copy the letsencrypt certificate chain file to the web server's document root. Add some SSL configuration. You can add some SSL configuration in the Apache web server configuration file. The following is an example of Apache configuration file. You should ensure that the openssl.cafile system variable is set to the path to the letsencrypt certificate chain file.
Test the SSL configuration. If everything is working correctly, the web server will display a letsencrypt.org page and the SSL certificate will appear to be valid.
Note: if you are using a Linux operating system, then you should append .crt to the certificate file name, like so: /etc/apache2/sites-available/default-ssl.
Related Answers
What is CN OU OC in a certificate?
This article describes the most important attributes of a certifi...
How do you verify client certificate authentication?
I have to develop a client authentication certificate for t...
What is a private certificate authority?
A lot of people confuse the private key of a CA with that of a certificate.br...