Public Key vs Private Key
Cryptography is the study of hiding information, and it is used when communicating over an untrusted medium such as internet, where information needs to be protected from other third parties. Encryption uses an algorithm called a cipher to encrypt data and it can be decrypted only using a special key. Encrypted information is known as ciphertext and the process of obtaining the original information (plaintext) from the ciphertext is known as decryption. One of the two widely used encryption methods is Public Key Encryption (other being the Symmetric Key Encryption). Specialty of public key encryption is that two different but mathematically related keys called public key and private key are used (as opposed to symmetric key encryption, which uses the same private key for encryption and decryption).
Public key encryption encrypts data using the recipient’s public key and it cannot be decrypted without using a matching private key. In other words, you need one key to lock (encrypt the piantext) and another key to unlock (decrypt the cypertext). Important thing is that one key cannot be used in the place of the other. Depending on which key is published, public key encryption can be used for two purposes.
What is Public Key?
In public key encryption, data encrypted using the recipient’s public key cannot be decrypted without using a matching private key. On the other hand, the public key can be used to decrypt data encrypted by the matching private key. However, public key cannot be used in the place of the private key. If the locking key is made public, then this system can be used by anybody to send private communication to the holder of the unlocking key. This makes sure that the legal recipient (one who has the matching private key) is the only person able to read the message. So, this confirms confidentiality of the communication between two parties.
What is Private Key?
In public key encryption, the private key can only be used to decrypt the data that was encrypted using the matching public key. Similarly, data encrypted using private key can only be decrypted using the matching public key. However, the private key cannot be used in the place of the public key. If the locking key is made private, this system makes it possible to verify that the documents were locked by the owner. The reason is that a message encrypted by the sender can only be opened by a person with the matching public key, thus verifying that the sender did actually hold the private key (meaning that the original and non-tampered message has been received). Therefore, this is used for digital signatures.
What is the difference between Public Key and Private Key?
Public key and private key is the couple of keys used in public key cryptography. If the locking key is made public, then the unlocking key becomes the private key, and vice versa. Public key cannot be used to derive the private key. If the public key is the locking key, then it can be used to send private communication (i.e. to preserve confidentiality). If the private key is the locking key, then the system can be used to verify documents sent by the holder of the private key (i.e. to preserve authenticity).