snippetbashTip
openssl dgst — OpenSSL command to generate digest values and perform signature operations. More information: <https
Viewed 0 times
commandopensslvaluescliopenssl dgstgeneratedigest
Problem
How to use the
openssl dgst command: OpenSSL command to generate digest values and perform signature operations. More information: <https://docs.openssl.org/master/man1/openssl-dgst/>.Solution
openssl dgst — OpenSSL command to generate digest values and perform signature operations. More information: <https://docs.openssl.org/master/man1/openssl-dgst/>.Calculate the SHA256 digest for a file, saving the result to a specific file:
openssl dgst -sha256 -binary -out {{output_file}} {{input_file}}Sign a file using an RSA key, saving the result to a specific file:
openssl dgst -sign {{private_key_file}} -sha256 -sigopt rsa_padding_mode:pss -out {{output_file}} {{input_file}}Verify an RSA signature:
openssl dgst -verify {{public_key_file}} -signature {{signature_file}} -sigopt rsa_padding_mode:pss {{signature_message_file}}Sign a file using and ECDSA key:
openssl dgst -sign {{private_key_file}} -sha256 -out {{output_file}} {{input_file}}Verify an ECDSA signature:
openssl dgst -verify {{public_key_file}} -signature {{signature_file}} {{signature_message_file}}Code Snippets
Calculate the SHA256 digest for a file, saving the result to a specific file
openssl dgst -sha256 -binary -out {{output_file}} {{input_file}}Sign a file using an RSA key, saving the result to a specific file
openssl dgst -sign {{private_key_file}} -sha256 -sigopt rsa_padding_mode:pss -out {{output_file}} {{input_file}}Verify an RSA signature
openssl dgst -verify {{public_key_file}} -signature {{signature_file}} -sigopt rsa_padding_mode:pss {{signature_message_file}}Sign a file using and ECDSA key
openssl dgst -sign {{private_key_file}} -sha256 -out {{output_file}} {{input_file}}Verify an ECDSA signature
openssl dgst -verify {{public_key_file}} -signature {{signature_file}} {{signature_message_file}}Context
tldr-pages: common/openssl dgst
Revisions (0)
No revisions yet.