Search code examples
opensslrsasha1signingsha256

Creating a sha256 signature using openssl


I need to create a SHA256 signature using OpenSSL ?

I tried:

  openssl sha256 -sha256 -binary -sign (providing my priv key & contents)

But, I get the following error : openssl:Error: 'sha256' is an invalid command.

sha1 works fine, but I thought sha256 was supported as well.


Solution

  • OpenSSL uses the command 'dgst' to calculate various digests (including SHA-256). The command also allows you to sign a digest (using a private key) and verify a signature (using a public key).