What is public key cryptography?
In public key cryptography, a pair of keys, a private key and a public key, is created for each user.
A private key is a key that is private to you and that you create and keep private until you no longer use the keypair. A public key, as the name suggests, is a key that is open to an unspecified number of users. There are several ways to publish.
- How to register with the public key search server
- How to publish on your own homepage
- How to send by email
- How to use a CA (Certificate Authority)
The characteristics of the two keys in this pair are as follows:
- Data encrypted with the public key can only be decrypted with the private key of the pair.
- Data encrypted with a private key can only be decrypted with the corresponding public key.
Encryption is a one-way street and can only be decrypted with a paired key to undo. Encryption can be performed using either key, but in public key cryptography, encryption is performed using the public key.
The sender sends a message encrypted with the recipient's public key to the recipient. The sender must somehow obtain the other party's (recipient's) public key.
The recipient decrypts it with his (recipient's) private key to restore the plaintext.
In this way, public key cryptography achieves encryption and decryption by using different encryption and decryption keys.
total number of keys in public key cryptography
In public-key cryptography, the public key used for encryption can be made public, so when n people communicate, a separate key pair is created for each of the n-1 people, which is the number of communication partners. No need.
Mr. A needs to create and manage only two keys, Mr. A's private key and public key, and Mr. B needs to create and manage two keys, Mr. B's private key and public key. you just need to
◆ Total number of keys in public key cryptography
The number of keys required can be calculated using the following formula:
Total number of keys = 2n
Since each person only needs to have two keys, a private key and a public key, the total number of keys for n people is 2n.