How to use asymmetric key encryption algorithm to realize digital envelope and digital signature
Asymmetric encryption algorithm uses two completely different but completely matched keys-public key and private key. When using asymmetric encryption algorithm to encrypt files, only a pair of matching public keys and private keys are needed to complete the encryption and decryption process of plaintext. Encrypt plaintext with public key and decrypt ciphertext with private key. Moreover, the sender (encryptor) knows the public key of the receiver, and only the receiver (decryptor) knows its own private key. The basic principle of asymmetric encryption algorithm is that if the sender wants to send encrypted information that only the receiver can read, the sender must first know the public key of the receiver, and then encrypt the original text with the public key of the receiver; After receiving the encrypted ciphertext, the receiver can only decrypt the ciphertext with his own private key. Obviously, using asymmetric encryption algorithm, before the sender and the receiver communicate, the receiver must send the public key randomly generated by itself to the sender, while the private key is kept by itself. Because asymmetric algorithm has two keys, it is especially suitable for data encryption in distributed systems. The widely used asymmetric encryption algorithms include RSA algorithm and DSA algorithm proposed by American National Bureau of Standards.