The Public key and Private key are the cryptographic keys that are used to lock and unlock cryptographic functions including authentication, authorization, and encryption. Cryptographic keys are divided on the basis of the functions they perform, what properties it has and how it will be used. Like, a key might have one of the properties of Symmetric, Public or Private.

The keys can basically be grouped into two broad categories, symmetric (private or secret) key, and asymmetric (public) key.

In Private key cryptography, users share a secret key among themselves which is used to encrypt and decrypt messages. The basic difficulty lies in securely distributing the secret key as the complexity and size of the network rises.

Public key cryptography includes the use of the pair of a public and private key. The user is free to distribute the public key but must always keep the private key secret.

**Private Key:**

Private Key is used for encryption and decryption. It is symmetric as it is the only key that is shared with another party to decrypt the ciphertext or encrypted text. It is faster than public-key cryptography.

**Public Key:**

Two keys are used in the Public key. One key is used to encrypt and the other key is used to decrypt the ciphertext. The key used for encrypting the plain text to ciphertext or encrypted text is the Public Key. The key used by the receiver for decrypting ciphertext to read the message is the Private Key.

Let’s understand this with an example if Jack wants to send sensitive data to Jenny and also he wants to be sure that the data is able to be read by Jenny only. Here, he will encrypt the data with Jenny’s Public Key. Now, only Jenny has access to her corresponding Private Key. So, as a result, Jenny will be the only person with the capability of decrypting the encrypted data back to its original form.

**Differences:**

**1.Symmetric and Asymmetric**

- The private key is symmetrical as there is only one key which is the secret key.
- The public key is asymmetrical because there are two types of keys- a private key and a public key.

**2.Secrecy **

- In Private key Cryptography, the key is kept secret.
- In Public key Cryptography, one of the two keys is kept secret.

**3.Speed**

- Private key is faster than the public key.
- Public key is slower than the private key.

**4.Encryption and Decryption**

- In Private key, the same key is used to encrypt and decrypt the messages.
- In Public key, two keys are used- one key (public key) is used for encryption and another key (private key) is used for decryption.

**5.Privacy**

- In private key Cryptography, the key is private.
- In Public key Cryptography, public key is public and private key is private.

Public Key is made available to everyone by a publicly accessible repository or directory. On the other hand, the Private Key remains confidential to its respective owner. As the key pair is mathematically linked, whatever is encrypted with a Public Key will only be decrypted by its corresponding Private Key and vice versa.

Hence, we can say that both the keys play an important role in the security of any data, especially in **Blockchain** transactions.