Communication is significantly more widespread in today’s world and more and more people are choosing to communicate with others to share information over the network. However, users also confront rising security threats on the networks that cause much annoyance to them such as; network sniffing, rendering the data inaccurate and unreliable before the receiver receives it, sending misleading information by acting on behalf of others, stealing private information that belong to others etc. Yet, to overcome all these threats and vulnerabilities public-key systems have been introduced.
When the sender wants to send a secure message to someone else, he/she resorts to the method of public-key systems where the sender encrypts the data by using various encryption algorithms and the receiver decrypts that encyrpted message. Encrypting the message wth the public-key systems protects the message from the numerous threats available on networks.
This article covers the public-key cryptography methods; and the benefits derived and risks prevented after its implementation.
1. Symmetric encryption:
The symmetric encryption uses simple encryption algorithms. The same key is used for encrypting the data and decrypting it as well. In this type of encryption, both the the sender and the receiver should own the same key.
After the data is encrypted using symmetric encryption methods, the data cannot be sniffed unless the intruder owns that key.
2. Asymmetric encryption: (Public/Private Keys):
The asymmetric encrytion method uses (optionally) one key for encrypting the message and another for decrypting it. These pairs are named and identified in pairs and one pair can decrypt the data that the other has encrypted.
data <---> private key <---> encyrpted data <---> public key <---> data
Cryptography aims to eliminate two basic security concerns. In the first one, the security of the message is guaranteed since it travels over the network after being encrypted; therefore, employing encryption and decryption methods allow only the sender and the receiver to see the message. The other security concern is whether the receiver is confident about genuineness of the origin of the message; that is the message should not have been changed as it was travelling over the network or the sender should not be fake. (e-signature)
Using public/private keys provides a solution to both security concerns. The public key that belongs to one of them is open to everybody else. However, the private key of the public key is only known to the owner of the key. By this way, this owner can encrypt the data he/she will send and the data can be encrypted by the genuine receiver with the public key of the sender.
Let's provide the reader with some exemplary situations about the steps where the public and private keys are used as e-signature or for encryption;
Encryption is a method implemented when the sender wants his/her message to be read by noone else but the one he/she sends the message to. This method prevents others to see and read the message as it is travelling over the network.
To provide an exemplary situation, let`s assume that Feyza wants to send a message to Mustafa and she wants to make sure that this message can only be seen by Mustafa himself.
Feyza ---> Message ---> Mustafa
The first thing Feyza must do is to obtain the public key of Mustafa; then she encrypts her message with this public key.
Feyza ---> Message --- PubMustafa ---> [Message]PubMustafa
Then she sends the encrypted message to Mustafa. Mustafa decrypts the message by using his own private key. Only then he is able to read it.
[ Message ]PubMustafa --- PrMustafa ---> Message
The message can only be decrypted by the private key of Mustafa; therefore it is impossible for anybody else other than Mustafa to read the message without obtaining Mustafa's private key.
b) Electronic Signature and Authentication:
Electronic signature is a mechanism of authentication that verifies whether the message(data) received is actually sent by the genuine sender or not.
Let's assume that there is a busy e-mail traffic between Feyza and Mustafa and they are discussing an important issue about a license agreement. The e-mail correspondence should be kept confidential due to the nature of the subject matter; therefore, Feyza does not want anybody to cheat and send an e-mail to Mustafa on behalf of her. To ensure this, Feyza encrypts the messages she sends to Mustafa with her own e-signature.
To do this, Feyza creates the message she will send to Mustafa.
Feyza ---> Message
Then Feyza encrypts this message with her own private key.
Feyza ---> Message --- PrFeyza ---> [ Message ]PrFeyza
Feyza creates a packet of the encrypted message and her own public key. Then she sends this packet to Mustafa.
Feyza ---> [[Message ]PrFeyza + PubFeyza ] ---> Mustafa
It is not dangerous for Feyza to send her own public key along with the message. The main aim here is to verify that the sender of the message is genuinely Feyza. Her public key comprises data that is accessible to everybody.
Mustafa receives the message and opens it by using the public key of Feyza. He is now confident that the message is actually sent by Feyza.
[ Message ]PrFeyza --- PubFeyza ---> Message
c) Sending messages as encrypted and with e-signature:
To achieve the two ultimate aims, namely privacy and genuineness of the data, both mechanisms can be implemented simultaneously to ensure that the data is received from the genuine person, that the data is not changed, and that the data is read only by the person intended. One implements the public/private key system, symmetric encryption and hash algorithms to achieve this.
Let's assume that Feyza wishes to send Mustafa an encrypted messsage along with an e-signature. Signing the mesage with e-signature and encrypting the message is two distinct jobs under one task.
Before signing the message with e-signature, Feyza runs a hash akgorithm on the message and calculates its checksum.
Feyza ---> Message --- hash alg. ---> Total = [ Message ]Hash
Hash algorithm is implemented here because Feyza wants to make sure that the integrity of the message is kept intact. Encryption algorithms are not preffered in this task because hash algorithm is both smaller in size and it runs faster.
The next level in the process is the signing of the message whose checksum is created. This checksum is encrypted with the private key of Feyza.
Total --- PrFeyza ---> [Total]PrFeyza
The encrypted checksum, the message itself, Feyza`s public key, the name of the hash algorithm all create a packet.
[Message + [Total]PrFeyza +PubFeyza + hash alg]
Now that the signing of the message is completed, after seeing the public/private keys in the packet, Mustafa is able to understand that the message is originally sent by Feyza. Mustafa obtains the checksum by using the public key in the message. To obtain another checksum from the crude message that is sent, Mustafa runs the hash algorithm on the crude message once again (the name of the hash algorithm was sent by Feyza to Mustafa). Mustafa compares the two checksums to understand whether the message is changed by someone else. If both sums are identical, it means that the message was not changed and that the message was originally sent by Feyza. If both sums are not identical, it means that the message was not sent by Feyza. Mustafa then distrusts and ignores the message because it has been altered on the way.
To send the complete message over the network as encrypted, one must use symmetric encryption. Symmetric encryption is used, because, with long messages, it is faster and simpler to use symmetric encryption than using the public/private-key algorithm.
In this example, Feyza creates a symmetric key for once before sending the message packet over the network. She encrypts the message created with this symmetric key.
[Message + [Total]PrFeyza +PubFeyza + hash alg ]symK
Mustafa will require this symmetric key that Feyza created to be able to read the message. Therefore, this symmetric key created should also be included in the packet.
[Message + [Total]PrFeyza +PubFeyza + hash alg ]symK+ symK
If we send this message as it is created this way over the network, a malicious intruder on the net is easily able to obtain the content of the message. To prevent this and to make sure that only Mustafa sees this message, the public key of Mustafa should be used. Remember that this was also required during the encryption of the message.
At this stage, if all the packet is encrypted by using the public key of Mustafa, the size will get bigger and the algorithm will run slower. Therefore, encrypting the symmetric key that is required to open the packet with the public key of Mustafa will suffice the overcome this problem.
At the last stage, the packet to be sent to Mustafa over the network is going to be as in the following formula;
Feyza--->[[Message+[Total]PrFeyza+PubFeyza+hash alg]symK +
Anybody who obtains this message will not be able to access to the symmetric key since she/he does not own the private key of Mustafa| therfore the intruder will not be able to obtain the content of the message sent.
After receiving the message, Mustafa will obtain the symmetric key with his own private key in the first instance; then, he will open the message by using this symmetric key. In the message he will find the public key of Feyza and the hash algorithm. Then he will understand whether the message was changed, or the message was originally sent by Feyza or not.
This method, as well as preventing the alteration of the message while it is travelling over the network, also prevents others to see the content. Malicious users are no more able to act as if they are the genuine senders of the message.
What is a Certificate?
Certificate is the data which verifies the identification of the public key owner. It is a proof of identity concerning the owner of the certificate. It is the same logic of mind as in the cases of identification cards and driving licenses we use in our everyday life to prove our own identities.
The certificates contain the following information,
- The identity of the certificate authority
- The identity of the owner
- The public key of the owner
- The expiry date of the certificate
- The signature of the certificate server that attests this certificate, etc.
Through this certificate, a person, who receives a message/data, is able to recognize the identity of the sender. He/she is also able to understand whether the certificate is of a reliable source, or whether the validity of the certificate is certified by a genuine cetificate auhority.
An alternative method to the one mentioned above is to send encrypted and e-signed messages over the network by using certificates that verify the genuine identity of the senders.
Sending Encrypted and E-signed Messages Through Using Certificate:
Let's go over the steps that explained the methods about how to send encrypted and e-signed messages to Mustafa. However, this time we are going to assume that the message will be encrypted by the certificate of Mustafa:
We should look at the two stages separately when Feyza wants to send Mustafa an encrypted and e-signed message at a time.
Before signing the message Feyza runs hash algorithm on the message and calculates a checksum of the message.
Feyza ---> Message --- hash alg. ---> Total = [ Message ]Hash
In the next stage after calculating the checksum of the message, the message will be signed. Here, the checksum should be encrypted with Feyza's private key.
Total --- PrFeyza ---> [Total]PrFeyza
The checksum which is encrypted, the message itself, Feyza's certificate instead of her public key and the hash algorithm applied altogether comprise a packet.
[Message + [Total]PrFeyza +CertFeyza + hash alg]
The process of signing the message is completed.
Feyza creates a symmetric key for once before sending the message packet over the network. Then she encrypts the message with this symmetric key.
[Message + [Total]PrFeyza +CertFeyza + hash alg ]symK
To be able to read the message, Mustafa requires the symmetric key that Feyza created. Therefore, the symmetric key should also be included in the message packet.
[Message + [Total]PrFeyza +CertFeyza + hash alg ]symK+ symK
To ensure that the message to be sent is going to be read only by Mustafa, the public key of Mustafa should be used. If certificate is going to be used, it is in the certificate of Mustafa where Mustafa’s public key key is located. In fact Mustafa’s certificate is used. In this certificate, as next to the public key of Mustafa, the following information is also available: the expiry date of Mustafa’s certificate, information prooving that this certificate genuinely belongs to Mustafa, information prooving that this certificate has not been changed, and lastly, information prooving that this certificate is attested by a genuine certificate authority.
To encrypt the message Feyza checks the certificate of Mustafa. On seeing the information available in the certificate, she understands that the certificate actually belongs to Mustafa. Then she checks whether the certificate has expired or not. In the next essential step, Feyza checks whether the certificate authority that attested this certificate is in the list of reliable certificate authorities. If Feyza does not encounter any problems about all these steps, she can be confident that this certificate actually belongs to Mustafa.
Now the packet will be sent to Mustafa over the network; and in this final stage, the packet along with the certificate of Mustafa looks like as in the following formula;
Feyza--->[[Message+[Total]PrFeyza+CertFeyza+hash alg]symK +
Any person who receives this message will not be able to access to the symmetric key since she/he does not own the private key of Mustafa; therefore, she/he will not be able to read the message.
After receiving this message Mustafa will obtain the symmetric key with his own private key. He will then open the message with this symmetric key and check the authenticity of Feyza’s certificate. By using the certificate and hash algorithm, he will see whether the message has been changed or not. He will also confirm that this message is genuinely received from Feyza.
The two important reasons why people prefer to use certificates instead of public/private keys are as follows: the identity of the person who uses these keys are attested also by certain reliable institutions and these certificates are widely used as proof of identification throughout the electronic medium.
What is PKI (Public Key Infrastructure)?
PKI is a set of software, certification policies and procedures to manage certificates and key pairs.
The following functions should be available on a PKI that is being managed:
1. Generating key and certificate:
To be able to generate key and certificate, one should be able to answer the following questions: How are the keys going to be generated? How should they be publicized?
There must be an interface through which the users are going to request certificates. According to the requests that are received through the interface, the public/private key pairs should be produced for the certificate. Then, these certificates should be published to the users.
2. Protecting private keys:
People inescapably demand from a PKI a mechanism that protects the private keys, because they do want to be protected against malicious intentions of other people, such as stealing their private keys.
3. Revocation of the certificates:
PKI needs to provide a facility for revocating any of the certificates distributed to any person; there may be a variety of situations that require the revocation of certificates; the private keys of people can be stolen, or an employee may no longer be available because she/he is ill or no longer works for that company etc. PKI must have the means to notify the users of all revocated certificates.
4. Backing-up Key Pairs and Recovery:
In some cases, it is essential to back-up private keys. Private keys are very important for people when using certificates. If a private key is lost, the person cannot open the encrypted messages she/he receives. Therefore, PKI is responsible for backing up the private keys and recovering the same private key for a particular certificate in times of need.
5. Updating keys and certificates that expire:
Certificates have certain validity periods. That means they expire after a certain period of time; therefore, they must be renewed when expiry dates approach. In the normal case, PKI is responsible for renewing the certificates of the users before the expiry dates cause any incovenience to them. PKI should also notify the user about the renewal process. In addition, PKI must be able to renew the keys if the user demands this.
6. The management of key operations:
PKI should be able to keep the log information and history of updated certificates, and moreover, PKI should be able to obtain the inventory of all the operations whenever needed. PKI must be able to manage all of these tasks.
7. Availability of the Certificates:
Communication through certificates require people to obtain the certificate of the person they will send the encrypted message to. This requires PKI to render all the certificates it generated available to all the users.
Through and careful efforts have to be taken in order to establish a PKI system as a whole and according to the features mentioned above. The technical and administrative work that must be undertaken demands painstaking commitment even to the minute details.
Excluding structures designed to control of the identity of people, part of the job can be done through the help of specific software. There is an abundant supply of open source and proprietary software relevant to this issue. In the next article, you will be able to find ample amount of information about such software.
As the key pairs enable the secure transmission of data over the network, which means that data sent over the network is kept as original; and, the communication is maintained confidently between the genuine sender and genuine receiver. This is unquestionably an important phenomenon regarding the secure communication on the net.