Versions Compared

Key

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

...

This document describes how to check the signature of a file signed with an X.509 certificate from the command line using OpenSSL.

The examples uses use EC private keys only.

Extracting the Public Key from the X.509 Certificate

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

...

Signing a File with a Private Key

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

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

...

  • Verified OK
    • The public key and signature for the signed file match.
  • Verification Failure
    • The public key and signature for the signed file do not match.