(2) The sender generates a message digest of the message and encrypts the digest with his own private key to form the sender's digital signature;
(3) This digital signature is sent to the receiver together with the message as an attachment to the message;
(4) The receiver first uses the same algorithm to calculate a new message digest from the received original message, and then decrypts the digital signature of the message attachment with the sender's public key, and compares the two message digests. If the values are the same, the receiver can confirm that the digital signature belongs to the sender.