Verifying a signature

In the previous example, we learned how to create a signature of a message for the recipient to verify. Now let's look at the process of verifying a signature.

If you receive a message and a signature, you must first decrypt the signature using the sender's public key. Then hash the original message and see if your hash matches the decrypted signature. If your hash matches the decrypted signature, then you can be sure that the sender is the person who owns the private key that is paired with the public key you used to verify.

To verify the signature, we are using the same algorithms (RSA PKCS#1 v1.5 with SHA-256) that were used to create the signature.

This example requires two command-line arguments. The first argument ...

Get Security with Go now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.