Public Key Infrastructure (PKI)
In previous posts we have seen public key cryptography as a two-key cryptographic system to ensure the confidentiality and authenticity of messages. Today we will go a little further, and solve a problem that you may have discovered throughout our series of posts on cryptography. If you still don't know what all of this is about, in the following links you can find all the information you need to be up to date with what we will see in today's post.
-
Asymmetric cryptography in OpenSSL - Public key
-
Asymmetric cryptography in OpenSSL - Private key
-
Asymmetric cryptography in OpenSSL - Encrypted key
The Man in the middle Attack
One of the most important problems of public key cryptography is the distribution of keys. This is so, because it is assumed that the participants (receiver, sender) trust each other with their public keys and that they do so through a secure channel. Suppose Emily has sent her public key to Steave via email. What would happen if someone (the interceptor) manages to intercept that message and replaces Steave's public key with his own public key? In practical terms, it would be much easier to get the credentials to enter Emily's email and have the interceptor send the message to Steave with his public key. The idea is for you to imagine a similar identity theft scenario. When Emily sends a message to Steave she will actually use the interceptor's public key, which in turn will decrypt the message and re-encrypt it with Steave's public key to finally send it to him. When Steave sends an encrypted message to Emily, the same thing will happen, the interceptor will decrypt the message and re-encrypt it to finally send it to Emily. This type of attack is called "Man in the middle attack". Note that Emily is actually communicating with Steave but without confidentiality. One solution to this problem is PKI.
PKI (Public key infrastructure)
The solution to the problem of knowing whether a public key belongs to a person is PKI (Public Key Infrastructure). The idea of this solution is to have a trusted entity (CA) that certifies that a public key belongs to a given person. More broadly, a PKI is a set of roles, policies, software, and procedures necessary to handle, create, manage, distribute, store, and revoke digital certificates and handle public key cryptography.
A person will be identified with some useful data such as name and address. The trusted entity will issue a certificate that contains, among other things:
- Necessary information about the person (name, address, date of birth, ...)
- The person's public key
- The date of creation of the certificate
- The date of revocation of the certificate
- The digital signature of all this information issued by the PKI
With this infrastructure scheme, the next time Emily wants to send a message to Steave, she will ask for his certificate (which includes his public key) from which she can validate his digital signature issued by the PKI and his revocation date. If this validation passes, then Emily can safely and confidentially send a message to Steave and vice versa.
To learn how to create a PKI, you can follow this tutorial: