A: the private key of the sender or the public key of the receiver
B: The sender's public key or the receiver's private key
Asymmetric encryption algorithms require two keys: public key and private key ). A public key is a pair of private keys. If a public key is used to encrypt data, only the corresponding private key can be used for decryption. If a private key is used to encrypt data, only the corresponding public key can be decrypted. Because encryption and decryption use two different keys, this algorithm is called asymmetric encryption algorithm.
Asymmetric encryption algorithms have good confidentiality and eliminate the need for end users to exchange keys. However, encryption and decryption take a long time and are slow, it is not suitable for encrypting files, but only for encrypting a small amount of data.
Working Principle
1. A must send information to B. both A and B must generate a pair of public and private keys for encryption and decryption. 2. A's private key is kept confidential. A's public key tells B; B's private key is kept confidential, and B's public key tells. 3. When a wants to send information to B, A encrypts the information with the public key of B because a knows the public key of B. 4. A sends the message to B (the message has been encrypted with the public key of B ). 5. After B receives the message, B decrypts the message of a with its own private key. No one else can decrypt the message because only B has B's private key.
Easy to make mistakes (3)