PGP message integrity: Basically, only private key can decrypt message encrypted with public key. But in the message integrity service in PGP does the reverse, where the Hash of the message if encrypted with private key and then the receiver decrypts it with public key! I need clarification.
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
This procedure, also called signing a message, does not encrypt the message itself, thus does not ensure it cannot be read by others. Instead, a hash sum of the message is encrypted using the private key.
For verifying, the recipient again calculates the hash sum of the message, and decrypts the hash sum calculated by the sender using the sender's public key. If this operation is successful, the recipient knows the the sender must be the owner of the private key, as nobody else could have used this for encrypting the hash message.
This requires that both keys (private and public) can be used to encrypt for each other, which is given for RSA. The procedure might be different for other encryption algorithms.