Cryptography serves its purpose as to protect confidentiality, proof of authority and to maintain integrity. The below scenario explains on each of the functionality.
The purpose of confidentiality is to ensure that only intended recipient is authorized read the message.
Sender(S) encrypts message using Recipient(R)’s public key.
Recipient(R) decrypts message using R’s private key.
A message is intended to be read by R alone. Hence, S has to find a way to ensure that only R has the authority to ‘open’ the message. S will encrypt the message using R’s public key. Take note that any message that has been encrypted with R’s public key can only be decrypted using R’s private key. No one will have R’s private key unless R himself. Since R is the sole owner of his own private key, it is cleared that he is the only authorized person to read the encrypted message.
2. Proof of Authority
Proof of Authority ensures that the message is written and sent out by the originator alone which is a trusted source.
Sender(S) encrypts message using Sender(S)’s private key.
Recipient(R) decrypts message using S’s public key.
Initially, a message was written by the original author which is S. S intends to send it to R, at the meantime proving that he is indeed the sole person who wrote and sends it. Hence, S encrypts the message with none other but his own private key. No one will have S’s private key unless himself. Recipient who receives the message will only be able to decrypt it with S’s public key. Therefore, recipient is well assured that the received message was written by S when they are able to decrypt it using S’s public key.
Integrity added another layer of security and is considered as an extension of Scenario 2. It prevents message from being altered during the transmission.
Sender(S) hashed the message. Sender(S) then encrypts the hash and the message using S’s private key.
The encrypted hash and message are sent over to Recipient(R).
Verification will be carried out at Recipient’s end.
There will be two-way verification occurred at recipient site.
• Firstly, Recipient(R) decrypts the message using S’s public key. R will get the message after decryption.
Using the similar hashing algorithm, R will perform hashing on the message. The output would be the result of the calculated hash (Hash1).
• At the meantime, the encrypted hash will also be decrypted, the output will be Hash2.
Both Hash1 and Hash2 will be compared. An unaltered message yields a matching hash.