<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Enoch Tsang on Medium]]></title>
        <description><![CDATA[Stories by Enoch Tsang on Medium]]></description>
        <link>https://medium.com/@echtsang?source=rss-a6606cce672c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*NPEpVvP0VQGA8Zh_3-iiNQ.jpeg</url>
            <title>Stories by Enoch Tsang on Medium</title>
            <link>https://medium.com/@echtsang?source=rss-a6606cce672c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 01:17:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@echtsang/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Making Sense of SSL Certificate Bundles]]></title>
            <link>https://medium.com/@echtsang/making-sense-of-ssl-certificate-bundles-a307780083c5?source=rss-a6606cce672c------2</link>
            <guid isPermaLink="false">https://medium.com/p/a307780083c5</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[ssl]]></category>
            <category><![CDATA[tls]]></category>
            <dc:creator><![CDATA[Enoch Tsang]]></dc:creator>
            <pubDate>Fri, 21 Oct 2016 23:34:35 GMT</pubDate>
            <atom:updated>2016-10-21T23:34:35.090Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently at my workplace Calgary Scientific Inc., I was tasked with updating the SSL certificate on one of our company websites. I had setup self-signed certificates for testing environments before, but this was my first run in with an actual signed certificate, and getting that green lock beside the URL. As I was reading through guides online, one of the biggest issues I faced was that all the guides threw around words like “root certificate” or “CSR”, but I couldn’t identify what was what and I didn’t know where to put them. So here’s to giving back to the community a resource that would have greatly helped me.</p><p>If you’re looking for a practical resource for setting up SSL I hope this post proves to be valuable for you, if you’re looking for how SSL works and why it is important you should look somewhere else.</p><h4><strong>Terminology</strong></h4><ul><li><strong>SSL vs TLS</strong></li></ul><p>SSL and TLS talk about the same practice. In your Googling adventures, a “Setting up TLS” guide and a “Setting up SSL” guide can be seen as teaching the same thing. TLS is just an updated version of SSL, you can think of TLS 1.0 as SSL 3.1.</p><ul><li><strong>Certificate Authority (CA)</strong></li></ul><p>This is who you will be buying the SSL certificate from, keep note of their name. Some examples: Go Daddy, Let’s Encrypt, Starfield Technologies.</p><ul><li><strong>Certificate Signing Request (CSR)</strong></li></ul><p>Your first step in setting up SSL will be to generate a CSR. Upon generation you get two files, a private key and a CSR. CSR files usually end with<em> .csr</em>. If you open up a CSR, it will look something like this (I’ve omitted most of the hash).</p><pre>-----BEGIN CERTIFICATE REQUEST-----<br>MIIDODCCAiACAQAwgaoxCzAJBgNVBAYTAkNBMRAwDgYDVQQIDAdBbGJlcnRhMRAw<br>DgYDVQQHDAdDYWxnYXJ5MSAwHgYDVQQKDBdDYWxnYXJ5IFNjaWVudGlmaWMgSW5j<br>...<br>6TMyXuU+v8exDV5Dy1SuNL4pzT1o+GOn6/XmqJgSdeiAH9AtrY/6aQEZ1Xlz45TB<br>Oyu1WpIkqX6IhZgZ<br>-----END CERTIFICATE REQUEST-----</pre><p>You can generate a CSR in Linux using openssl.</p><pre>openssl req -new -newkey rsa:2048 -nodes \<br>    -keyout <em>yourdomain</em>.key \<br>    -out <em>yourdomain</em>.csr</pre><p>After sending the CSR to a CA, they will give back to you a bunch of certificates.</p><ul><li><strong>Certificate</strong></li></ul><p>These files usually end in .crt. The server, root, and intermediate certificates will be in this format (again I’ve omitted most of the hash).</p><pre>-----BEGIN CERTIFICATE-----<br>MIIFXjCCBEagAwIBAgIJAMCvBFY89YheMA0GCSqGSIb3DQEBCwUAMIHGMQswCQYD<br>VQQGEwJVUzEQMA4GA1UECBMHQXJpem9uYTETMBEGA1UEBxMKU2NvdHRzZGFsZTEl<br>...<br>lej5w3/53QsQa8GbTzWU4HnsMy8VvT8UsGQpIDLFCmZb2LwO+aOF1wbx+oicx8j3<br>ghz/cB1StFlDhCW7maxjvx6Uc3eBSnHYEjxiSUp/297QJw==<br>-----END CERTIFICATE-----</pre><p>When you open up certificates in a text editor, you just see a big hash, but you can inspect certificates for more information using the openssl command in Linux:</p><pre>openssl x509 -in file.crt -text -noout</pre><p>In Windows, open up the file for more information just by double clicking.</p><ul><li><strong>Server Certificate</strong></li></ul><p>This certificate contains information specific to your site. When you inspect the file you should see your domain name appear somewhere(i.e. <em>mysite.com</em>). This is the only file where you should see your domain name when inspecting. You can inspect a file by using the openssl command in Linux or by double clicking in Windows.</p><ul><li><strong>Root Certificate</strong></li></ul><p>This is a special certificate that you receive that is self-signed by the CA. This is going to be at the top of your certificate chain if you need one. You can identify this by looking at the subject and issuer field when inspecting. A root certificate will have the <em>exact same </em>subject and issuer field.</p><ul><li><strong>Intermediate Certificate</strong></li></ul><p>If a certificate you have received is not a server or root certificate, it is probably an intermediate certificate.</p><ul><li><strong>Certificate Chain</strong></li></ul><p>This is also usually a <em>.crt</em> file, this file contains many certificates inside and might look something like this.</p><pre>-----BEGIN CERTIFICATE-----<br>MIIFADCCA+igAwIBAgIBBzANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMx<br>...<br>7nIMpBKGgc0T0U7EPMpODdIm8QC3tKai4W56gf0wrHofx1l7<br>-----END CERTIFICATE-----<br>-----BEGIN CERTIFICATE-----<br>MIIEoDCCA4igAwIBAgIDORSEMA0GCSqGSIb3DQEBCwUAMGgxCzAJBgNVBAYTAlVT<br>...<br>iawXqMzVN3cWxYC5DI9XAlWZhXtJ8C5boMJXU12i6KY3wwH6<br>-----END CERTIFICATE-----<br>-----BEGIN CERTIFICATE-----<br>MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzEl<br>...<br>WQPJIrSPnNVeKtelttQKbfi3QBFGmh95DmK/D5fs4C8fF5Q=<br>-----END CERTIFICATE-----</pre><p>Sometimes, you have to create this yourself with all the certificates you’ve gotten. All you need to do is concatenate different certificate files (it’s as simple as it sounds), like the root and intermediate certificate. Also note that order matters, the root certificate should be at the very top as well as preserving any previous order when you received it from your CA.</p><ul><li><strong>Private Key</strong></li></ul><p>This is the only file that is top secret, when you generate your CSR you will generate one of these as well, it will usually be a <em>.key</em> or <em>.pem</em> file. This gets put somewhere on your server and shouldn’t go anywhere else, don’t email it around and don’t send it to your CA. When you generate a CSR you will generate one of these as well. It will look something like below.</p><pre>-----BEGIN PRIVATE KEY-----<br>NgTAnt0V7yQ6AaeBmeHGvaAYIVLCdiErq+vjHn2ii4Udzqcbs8+zTJpEt+H/S6kb<br>MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC+G2DbdppCF/yK<br>...<br>T9qmHnv3w2E/vC2OlOitw7UOTsGBMkLb8RPiBRMr3M+HWm0KUoF28XjVa7FwIS8J<br>QusrAMoo+1qw+GZdSaayLt0njNve030EdQykRxO+21<br>-----END PRIVATE KEY-----</pre><h4>Example Procedure</h4><p>For an idea of how this all comes together, I’ll outline how I set up a certificate bundle onto a website hosted on Amazon Cloudfront.</p><p>The first step for me was creating a CSR, the domain name will be squeakychickens.com. So the command would be:</p><pre>openssl req -new -newkey rsa:2048 -nodes \<br>    -keyout <em>squeakychickens</em>.key \<br>    -out <em>squeakychickens</em>.csr</pre><p>This generates two files, <em>squeakychickens.key </em>and <em>squeakychickens.csr. </em>Now we keep the <em>squeakychickens.key </em>file somewhere safe and the <em>squeakychickens.csr</em> file gets sent to the CA. In my case, I had to pass it off to my IT department to get signed, I also had to tell them the type of webserver I was using, the options were IIS, Apache, Exchange, Tomcat, Mac OS X, or Other. Amazon Cloudfront would be an “Other” answer.</p><p>Afterwards, I was given 3 files as the certificate bundle from CA:</p><ul><li><em>b2ab06783cf5992f.crt</em></li><li><em>sf_bundle-g2-g1.crt</em></li><li><em>sfroot-g2.crt</em></li></ul><p>The command for uploading certificates to Amazon is:</p><pre>aws iam upload-server-certificate \<br>   --server-certificate-name example_com \<br>   --certificate-body file://example.crt \<br>   --private-key file://example.key \<br>   --certificate-chain file://example.crt \<br>   --path /cloudfront/</pre><p>There are some steps I’ve omitted between acquiring the certificate bundle and uploading the server certificate, <a href="https://bryce.fisher-fleig.org/blog/setting-up-ssl-on-aws-cloudfront-and-s3/">here’s an excellent guide with those details</a>. I’m going to focus more on the certificate bundle.</p><ul><li>The <em>server-certificate-name </em>turned out to be an internal name on Amazon, so it didn’t matter what was used.</li><li>The <em>certificate-body </em>turned out to be the server certificate. I identified <em>b2ab06783cf5992f.crt </em>to be the server certificate. I wrote up how to identify the server certificate above in the terminology section.</li><li>The <em>private-key</em> was the other file I generated when I created the csr, <em>squeakychickens.key.</em></li><li>The <em>certificate-chain </em>is was a little more complicated. This needed to be a combination of all the other certificates I received. I created a new file called <em>chain.crt</em> then copied the contents of the root certificate <em>sfroot-g2.crt </em>into it. Below that that, I copied the contents of the intermediate certificate <em>sf_bundle-g2-g1.crt, </em>in my case this file was already a certificate chain (it had multiple certificates inside) but I could still concatenate them the same way<em>. </em>Note that the order of the certificates in <em>chain.crt</em> does matter! I wrote up how to identify the root and intermediate certificates above in the terminology section.</li><li>The <em>path </em>is just where to upload it on Amazon, for Cloudfront distributions the <em>/cloudfront/ </em>path will work.</li></ul><p>With that figured out, the command I used to successfully push up the SSL certificate was:</p><pre>aws iam upload-server-certificate \<br>   --server-certificate-name squeakychickens_com\<br>   --certificate-body file://b2ab06783cf5992f.crt \<br>   --private-key file://squeakychickens.key \<br>   --certificate-chain file://chain.crt \<br>   --path /cloudfront/</pre><h4>Conclusion</h4><p>Hopefully I’ve helped you make sense of all the different files that come wiht SSL. Did you find an error? Did this help you? Does something not make sense? Please leave a comment!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a307780083c5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>