Public Key Encryption
Public-key cryptography, or asymmetric cryptography, is the field of cryptographic systems that use pairs of related keys. Each key pair consists of a public key and a corresponding private key. Key pairs are generated with cryptographic algorithms based on mathematical problems termed one-way functions.
The security of public-key cryptography depends on keeping the private key secret; the public key can be openly distributed without compromising security.

Application of PKC
- Encryption/Decryption
- The sender encrypts the message using the receiver’s public key
- Digital Signature
- The sender signs a message by encrypting the message or a transformation of the message using its private key
- Key exchange
- Two sides cooperate to exchange a session key, typically for conventional encryption.
Condition of PKC
- Computationally easy
- To generate public and private key pair
- To encrypt the message using an encryption key
- To decrypt the message using the decryption key
- Computational infeasible
- To compute the private key using the public key
- To recover the plaintext using ciphertext and public key
- The encryption and decryption can be applied in either order

RSA Algorithm
RSA encryption algorithm is a type of public-key encryption algorithm. Named after its inventors Rivest, Shamir, and Adelman (RSA)

RSA algorithm uses the following procedure to generate public and private keys:
Youtube → Gate Smasher
- Choose two different large random prime numbers.
- Calculate n = p x q