Rate this article: (17 votes, average: 4.12)
SSL. TLS. SHA-1. SHA-2. Or, how about a SHA2 certificate?
If you’re even a little bit exposed to the world of SSL/TLS certificates, you must’ve realized that it’s full of weird acronyms that mean nothing that they sound like. Today, we’re going to talk about one such acronym that puzzles many. Yes, we’re going to talk about SHA2 and how it’s used in the security implemented by SSL certificates.
SHA is the acronym for “secure hashing algorithm.” SHA, frequently written SHA-2, is a family of hashing algorithms. SHA1 (usually written SHA-1), the first algorithm of this family, was designed by the National Security Agency (NSA) and published as a federal standard in 1995 by the National Institute for Standards and Technology (NIST). The standards accepted by NIST are accepted by most of the industry globally. As such, SHA-1 quickly became an internet standard, replacing insecure algorithms such as MD-5. SHA-1 was eventually replaced by SHA-2, which we’ll get to more in a bit.
So, you likely understand what “secure” and “algorithm” mean. So, let’s talk about the term that you may not be as familiar with — hash. After that, we’ll circle back to talking about SHA2 and what we mean when someone talks about a SHA2 certificate or SHA2 security certificate.
A hash is the result of a hash function, a mathematical algorithm that turns simple forms of data (text, picture, video, audio, etc.) into an unreadable format that looks like what you might imagine the code of a nuclear weapon would be.
Do you know how does a hash value looks like? Well, here’s an example:
This is literally a hash of the word “hash.”
Now, there are good hash functions and bad hash functions. A good hash function yields a unique result for each piece of input. So, if there’s even the slightest of change in the input, it’ll be reflected in the output. If we capitalize the letter h in “hash” and run it through a hash function, this is what the hash of the word “Hash” would look like:
Now, this, obviously, looks nothing like the hash of the word “hash,” right? So that’s a sign of good hash function. Bad hash functions, on the other hand, don’t return different output for every input. If a hash function gives the same return for two different outputs, it’s considered broken and can’t be used.
Hashes are used by computers to identify, compare, or run calculations against files, content, and strings of data.
You might be aware that SSL/TLS certificates are issued by certificate authorities (CAs). When issuing a certificate, a certificate authority digitally signs the certificate. It’s worth noting that a certificate authority signs the hash of a digital certificate as it’s easier to sign the hash compared to signing an actual certificate. It acts as a cryptographic proof that the certificate hasn’t been modified since it was issued.
If anyone alters the certificate file by even a bit, it will cause the entire hash to change and, in turn, it would cause the signature to change. Also, if you change just a letter in a document of thousands of gigabytes, it would result in an entirely different hash. So, if an attacker wants to alter an SSL certificate to make it look fraudulent, he/she must produce the exact same hash as the original certificate. This, of course, is impossible for good hash functions. And as a result, the digital signature of a CA will be different, and the browsers would deem them invalid and show an error.
Therefore, it won’t be an exaggeration to say that hash functions form a foundation of the entire public key infrastructure. Even the slightest weakness could cause distrust in the whole industry, and that’s why having strong hash functions is the first thing that you need for public key infrastructure (PKI).
Over time, theoretical attacks against SHA-1 started, and it prompted NIST to create its successor, SHA-2. SHA-2 became an internet standard in 2002, and this was the time when SHA-1 was broken in theory, but nobody had broken it in practice. Therefore, the use of SSL certificates that used the SHA-1 hashing algorithm continued.
In 2017, thanks to joint efforts of the Cryptology Group at Centrum Wiskunde & Informatica (CWI) — the national research institute for mathematics and computer science in the Netherlands — and the Google’s Research Security, Privacy and Anti-Abuse Group, a successful collision attack was carried out against SHA-1. But that’s not when SHA-1 was deprecated — it wasn’t until 2015 that all major browsers deprecated SHA-1.
SHA-2 came out as the successor and became a worldwide internet cryptographic standard. It differs from its SHA-1 predecessor in terms of its construction. In other words, the techniques used for producing hashes in both algorithms differ.
Another thing that differentiates SHA-1 and SHA-2 is their bit length. SHA-1 is a 160-bit hash and therefore, all the hashes it creates are of 160-bit length. As we mentioned earlier, SHA-2 is a family of hashes and comes in various lengths, including 224-, 256-, 384-, and 512-bit digests.
So, if you come across the terms such as “SHA-2,” “SHA-256,” or “SHA-256 bit,” they actually mean the same thing. The number at the end reflects the hash sizes. Amongst them, SHA-256 is the most extensively used hashing algorithm, and every new SSL certificate is a “SHA2 certificate” (or a SHA2 security certificate, if you’d prefer, although they’re really just called SSL certificates) in the sense that it uses the SHA-2 hashing algorithm.
All the SSL/TLS certificates used in the world have SHA-2 at its core. Until now, no significant weakness has been discovered in SHA-2. However, it’s mathematically related to SHA-1, and that’s why many experts believe that it will last around the same time as its predecessor. But there’s no need to be concerned as NIST has already approved SHA-3. A great thing about SHA-3 is that, unlike SHA-2, it doesn’t share the mathematical characteristics of SHA-1. Therefore, it’s considered to be more secure and is expected to last longer than its predecessors.
Get SSL certificates that authenticate your identity and secure your site with prices that start as low as $7.02 per year!