What are the public key and private key?

M.hosein abbasi
3 min readNov 23, 2021

In this tutorial, I want to investigate pair keys which Each pair consists of a public key and a private key.

It is normal to know that mathematical problems are used to generate keys.

You can encrypt any message using the public key (Note that the public key must be received from the receiver because it can only be decrypted through the private key).

Public key algorithms are fundamental security primitives in modern cryptosystems, including applications and protocols which offer assurance of the confidentiality, authenticity, and non-reputability of electronic communications and data storage. They underpin numerous Internet standards, such as Transport Layer Security (TLS), S/MIME, PGP, and GPG. Some public-key algorithms provide key distribution and secrecy (e.g., Diffie–Hellman key exchange), some provide digital signatures (e.g., Digital Signature Algorithm), and some provide both (e.g., RSA). Compared to symmetric encryption, asymmetric encryption is rather slower than good symmetric encryption, too slow for many purposes. Today’s cryptosystems (such as TLS, Secure Shell) use both symmetric encryption and asymmetric encryption, often by using asymmetric encryption to securely exchange a secret key which is then used for symmetric encryption.

Two of the best-known uses of public-key cryptography are:

Public key encryption, in which a message is encrypted with the intended recipient’s public key. For properly chosen and used algorithms, messages cannot in practice be decrypted by anyone who does not possess the matching private key, who is thus presumed to be the owner of that key and so the person associated with the public key. This can be used to ensure the confidentiality of a message.

Digital signatures, in which a message is signed with the sender’s private key and can be verified by anyone who has access to the sender’s public key. This verification proves that the sender had access to the private key, and therefore is very likely to be the person associated with the public key. This also ensures that the message has not been tampered with, as a signature is mathematically bound to the message it originally was made from, and verification will fail for practically any other message, no matter how similar to the original message.

One important issue is confidence/proof that a particular public key is authentic, i.e. that it is correct and belongs to the person or entity claimed, and has not been tampered with or replaced by some (perhaps malicious) the third party.


The most obvious application of a public key encryption system is for encrypting communication to provide confidentiality — a message that a sender encrypts using the recipient’s public key which can be decrypted only by the recipient’s paired private key.

Another application in public-key cryptography is the digital signature. Digital signature schemes can be used for sender authentication.

Non-repudiation systems use digital signatures to ensure that one party cannot successfully dispute its authorship of a document or communication.

Further applications built on this foundation include digital cash, password-authenticated key agreement, time-stamping services, non-repudiation protocols, etc.


This was my experience with asymmetric cryptography. I hope it was useful for you.

In the next-tutorial, I am going to teach you the difference between asymmetric cryptography and symmetric cryptography.