Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To check a signature with OpenSSL we use the public key related to the private key the file was signed with. We extract the public key to the pubkey.pem file from the given certificate.pem X.509 certificate file.

Code Block
languagebash
openssl x509 -in certificate.pem -noout -pubkey > pubkey.pem

...

In this step a file test.txt is signed with the privkey.pem private key file, the binary signature is stored to the test.txt.sig file.

bash
Code Block
language
openssl dgst -sign privkey.pem -keyform pem -sha256 -out test.txt.sig -binary test.txt

...

In this step the pubkey.pem public key file is used to check if the test.txt.sig signature file matches the test.txt file.

bash
Code Block
language
openssl dgst -verify pubkey.pem -keyform pem -sha256 -signature test.txt.sig -binary test.txt

...