SSL / TLS Overview Or:: How I Learned To Stop Worrying and Love The CA
SSL / TLS Overview Or:: How I Learned To Stop Worrying and Love The CA
SSL / TLS Overview Or:: How I Learned To Stop Worrying and Love The CA
Ti Leggett <leggett@mcs.anl.gov>
1.Assumed knowledge
This mini paper assumes you have some knowledge of what TCP is, what
cryptology/cryptography is, and have read Bob Olson's slides on Security in AG2.0. It will give a
brief overview of what SSL/TLS provides, how it works, what a Certificate Authority (CA) is,
and how a CA achieves its goal.
2.What SSL/TLS is
Secure Sockets Layer (SSL) and Transport Layer Security (TLS) are essentially the same thing.
SSL was developed at Netscape and has currently settled at SSLv3. TLS is a proposed Internet
Engineering Task Force (IETF) standard based off of SSLv3 with minor enhancements and bug
fixes. SSLv3 is by far more widespread but more and more applications understand TLS each
day. For the duration of this document I assume they are identical and will refer to them simply
as SSL.
The goal of SSL is to provide a secure transport for application protocols/data between two
points, henceforth called Alice and Bob, assuming that a malicious party, henceforth called "the
attacker," has control over the network between. In order for the transport to be secure it should
satisfy three conditions: confidentiality, message integrity, endpoint authentication.
Confidentiality is simply that no one outside is listening to what's going on inside. Message
integrity assures that what's going on inside hasn't been tampered with from outside. Endpoint
authentication is the ability to trust that who you're talking to on the end is who they say they are
and who you think they are.
3.3.Digests
A digest is a kind of fingerprint for any piece of data. The way a digest works is that given a
piece of variable length data, it generates a fixed length semi-unique hash based on the
characteristics of the data. I say semi-unique because going from any variable length data to a
fixed length string there will be clashes. The object of a digest is to have a length that is long
enough that clashes are not likely given two random pieces of data. Examples of digests are
MD5 and SHA-1.
3.4.MACs
MACs are like digests except that they also take into account a key in the computation, so that
both shared key and data are used to generate the MAC. The most widely used MAC is HMAC.
3.5.Other Techniques
Other techniques used are things like sequence numbers for the records transmitted and messages
that signal the end of transmission as well as relying on the reliable protocol's mechanisms for
delivery. These help to prevent such things as the attacker from inserting random data into the
stream in hopes to confuse and/or intercept the other parties.
And explanation of what this means and what's happening at each step:
1. The client (Alice) sends a list of ciphers it supports and a random number generated for
the key generation process
2. The server (Bob) sends back the cipher it has chose, it's public certificate, a random
number it generates for the key generation process, and optionally asks for the client's
public certificate
3. If the the client was asked, it sends its public certificate, verifies the server's identification
validity, generates a random key and encrypts it with the server's public key and sends it
to the server
4. The client generates a MAC of all previous messages using the random key, sends it to
the server and tells the server that all future messages will be encrypted with random key
5. The server independently generates the MAC of all previous messages to verify that no
tampering has been done, and replies that all future messages it will send will be
encrypted with the random key
At this point a secure transport has been setup for application data to flow through encrypted,
authenticated, and as we'll see, verified. When either party is ready to close the connection, it
first notifies the remote party it is doing so and then stops transmission.
In order to verify the application data has not been tampered with, each piece of data transmitted
goes through a hardening process which produces SSL records.
1. The data is broken up into fragments
2. The length of the fragment is calculated
3. A MAC is generated over the fragment and appended to the fragment
4. The fragment and MAC are encrypted with the session's shared random key
5. A header is appended to the encrypted payload that contains information such as the
length to expect, what type of data, sequence number, etc.
When the remote side receives the record it:
1. Reads the header to know what to expect in the payload
2. Decrypts the payload with the session's shared random key
3. Verifies the fragment has not been tampered with by comparing a MAC it generates over
it to the one supplied
4. Waits for all the records for the piece of data so that it can reassemble it to use
For those astute readers out there, you may be wondering why we use a shared secret key to do
the encryption and there's two reasons. First because the key is randomly generate on a per
session basis we have a high degree of confidence that the attacker won't be able to easily guess
it. Second, asymmetric algorithms are computationally expensive compared to symmetric ones.
So then why use asymmetric at all? Because symmetric algorithms depend on a shared key and if
that key is ever compromised, communications between all parties using the shared key are
compromised.
4.What a CA is
The role of the CA is to provide a trusted third party that is responsible for distributing
certificates. It's primary role is to verify that the party asking for the certificate is who they say
they are so that users depending on the CA can believe that the remote host presenting its
certificate is who they say they are. This verification is laid out in the CA's signing policy and
can be as lax as what I call the New Orleans beer philosophy, i.e., if you can ask for it you can
have it, or as strict as a DoD or NSA security clearance. There are many of these trusted CAs
whose business and life-blood it is to verify and sign these certificates. Some of these include
VeriSign and Thawte. In fact, these CA's public certificates are already bundled into your web
browser so that it knows to trust certificates signed by them.
Figure 2. Example Web Browser Certificate Manager
It is also possible for an organization or group to provide their own CA to sign employee or
group member certificates. By trusting a CA you are trusting all the certificates that it signs to
follow the CA's signing policy guidelines. If after all this, you are curious about how a CA
operates and what to consider to become your own CA, continue reading the next section.
5.How to become a CA
If you're thinking about becoming a CA, there are few things to understand and think about
before doing it. First the organization of trust is hierarchical and ends at a root CA. The root CA
is ultimately responsible for certificate signing, but it can delegate that to lower CAs as in the
figure below.
Figure 3. CA Hierarchy
As you can see here, Joe's certificate was signed by the root CA and Bob and Alice's were signed
by the sub CA. The sub CA's certificate was signed by the root CA as well.
Now in order to be a CA that can be trusted to any degree you have to layout you guidelines or
signing policy. In this you need to define over what area or virtual organization you'll be
presiding. You'll need to define how you will verify requests for certificates. Probably most
important, you'll need to determine how to securely store your CA's private key and who will
have access to it to sign certificates and how will that access be granted. Let's discuss the easy
parts first.
Normally certificates that the CA signs must have a DN that is a subset of the root CA's DN.
Let's enumerate out some of the DNs from the above figure.
Joe:
C=US,O=Snake Oil,CN=Joe
Sub CA:
C=US,ST=AnyState,L=AnyWhere,O=Snake Oil,OU=Oil,CN=Snake Oil CA 1
Bob:
C=US,ST=AnyState,L=AnyWhere,O=Snake Oil,OU=Oil,CN=Bob
5.2.Verifying certificates
As a CA you need to determine how you will verify CSRs. It can be something as easy as
matching the email address the CSR was sent from or as complex as having the requester
physically come in to prove his or her identity.
5.3.Securing your CA
The CA private key's privacy is tantamount. If un-authorized people have access to it, it
compromises the whole hierarchy of trust. Ideally, you want to have the machine that keeps the
private key off net and locked behind something like a card key access to prevent those not
authorized from gaining access. In order to have a portal for people to submit CSRs to we
introduce a machine called an Registration Authority (RA name taken for OpenCA). This
machine(s) can sit on the net and accept requests and queue them up for an Operator who then:
1. authorizes or denies the requests
2. moves the authorized requests to removable media (i.e., sneakernet),
3. takes them physically to the CA server
4. sign them saving the signed certificates back to the media
5. take it back to the RA server to upload the certificates so that the user can download them
and start using them
Obviously, this can be a large pain to do. If, however, security is not completely required, there
are ways to make this process a bit easier while not losing too much security, though your CA's
private key might be network accessible. You could place your CA server on a secure network
behind a very strict firewall. Access through the firewall should be limited only to the Operators
and only from a closed set of machines. Login access on the server should be limited to the
Operators and must not be clear text, and might in fact make use of a validly signed certificate.
The CA server should not be directly accessible from any externally accessible machine,
especially the RA server. If there is a web interface to the CA server for signing, access to the
web server should be client authenticated via a valid certificate. And most importantly, the CA's
private key should be read only by root and encrypted (i.e., have a passphrase attached to it).