Digital signature for a file using openssl

To Generate Private Key

openssl genrsa -out privatekey.pem 2048

To Sign

openssl dgst -sha256 -sign privatekey.pem -out data.txt.signature data.txt

To Generate The Public Key

dgst -verify requires the public key

openssl rsa -in privatekey.pem -outform PEM -pubout -out publickey.pem

To Verify

openssl dgst -sha256 -verify publickey.pem -signature data.txt.signature data.txt
  • In case of success: prints "Verified OK", return code 0
  • In case of failure: prints "Verification Failure", return code 1

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)