Digital Signatures
Index
Digital signatures
In this example we will see how you can use OpenSSL to generate and verify digital signatures.
Generate a digital signature for a file
To generate the digital signature of a file, we will perform the following operations:
Create a key pair and save it to a file:
Extract the public key from the key pair:
Generate a hash of a file we want to sign:
Using the private key, sign the hash and save it to a file:
Verify the digital signature of a file
To check the previously generated subscription, you need to perform the following operations:
Create a hash of the file whose signature we want to verify:
Verify the digital signature using the public key:
Verify the difference between the original verified hash and the newly generated hash:
Last updated