Forrest logo
back to the openssl tool

openssl-dgst:tldr:2c8ca

openssl-dgst: Sign a file using and ECDSA key.
$ openssl dgst -sign ${private_key_file} -sha256 -out ${output_file} ${input_file}
try on your machine

This command is using the OpenSSL utility to digitally sign a file using a private key and generate a SHA-256 cryptographic hash value of it.

Here's a breakdown of the command:

  • openssl: This is the command to invoke the OpenSSL utility.

  • dgst: This is the subcommand used to perform message digest operations.

  • -sign ${private_key_file}: This option specifies the private key file to be used for signing the input file. ${private_key_file} is a placeholder for the actual path to the private key file.

  • -sha256: This option specifies the hash algorithm to be used, in this case, SHA-256. The SHA-256 algorithm will generate a 256-bit hash value for the input file.

  • -out ${output_file}: This option specifies the path and filename for the output file where the signed hash value will be saved. ${output_file} is a placeholder for the desired output file path.

  • ${input_file}: This is the input file that will be hashed and signed. The ${input_file} is a placeholder for the actual path to the input file.

To summarize, the command will use the private key to sign the input file, generate a SHA-256 hash of that file, and save the signed hash value to the specified output file.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the openssl tool