5 dgst, sha, sha1, mdc2, ripemd160, sha224, sha256, sha384, sha512, md4, md5, blake2b, blake2s - message digests
22 [B<-prverify filename>]
23 [B<-signature filename>]
25 [B<-fips-fingerprint>]
37 The digest functions output the message digest of a supplied file or files
38 in hexadecimal. The digest functions also generate and verify digital
39 signatures using message digests.
41 The generic name, B<dgst>, may be used with an option specifying the
43 The default digest is I<sha256>.
44 A supported I<digest> name may also be used as the command name.
45 To see the list of supported algorithms, use the I<list --digest-commands>
54 Print out a usage message.
58 Specifies name of a supported digest to be used. To see the list of
59 supported digests, use the command I<list --digest-commands>.
63 Print out the digest in two digit groups separated by colons, only relevant if
64 B<hex> format output is used.
68 Print out BIO debugging information.
72 Digest is to be output as a hex dump. This is the default case for a "normal"
73 digest as opposed to a digital signature. See NOTES below for digital
74 signatures using B<-hex>.
78 Output the digest or signature in binary form.
82 Output the digest in the "coreutils" format used by programs like B<sha1sum>.
84 =item B<-out filename>
86 Filename to output to, or standard output by default.
88 =item B<-sign filename>
90 Digitally sign the digest using the private key in "filename".
94 Specifies the key format to sign digest with. The DER, PEM, P12,
95 and ENGINE formats are supported.
99 Pass options to the signature algorithm during sign or verify operations.
100 Names and values of these options are algorithm-specific.
104 The private key password source. For more information about the format of B<arg>
105 see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)>.
107 =item B<-verify filename>
109 Verify the signature using the public key in "filename".
110 The output is either "Verification OK" or "Verification Failure".
112 =item B<-prverify filename>
114 Verify the signature using the private key in "filename".
116 =item B<-signature filename>
118 The actual signature to verify.
122 Create a hashed MAC using "key".
126 Create MAC (keyed Message Authentication Code). The most popular MAC
127 algorithm is HMAC (hash-based MAC), but there are other MAC algorithms
128 which are not based on hash, for instance B<gost-mac> algorithm,
129 supported by B<ccgost> engine. MAC keys and other options should be set
130 via B<-macopt> parameter.
132 =item B<-macopt nm:v>
134 Passes options to MAC algorithm, specified by B<-mac> key.
135 Following options are supported by both by B<HMAC> and B<gost-mac>:
141 Specifies MAC key as alphanumeric string (use if key contain printable
142 characters only). String length must conform to any restrictions of
143 the MAC algorithm for example exactly 32 chars for gost-mac.
145 =item B<hexkey:string>
147 Specifies MAC key in hexadecimal form (two hex digits per byte).
148 Key length must conform to any restrictions of the MAC algorithm
149 for example exactly 32 chars for gost-mac.
153 =item B<-rand file...>
155 A file or files containing random data used to seed the random number
157 Multiple files can be specified separated by an OS-dependent character.
158 The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for
161 =item [B<-writerand file>]
163 Writes random data to the specified I<file> upon exit.
164 This can be used with a subsequent B<-rand> flag.
166 =item B<-fips-fingerprint>
168 Compute HMAC using a specific key for certain OpenSSL-FIPS operations.
172 Use engine B<id> for operations (including private key storage).
173 This engine is not used as source for digest algorithms, unless it is
174 also specified in the configuration file or B<-engine_impl> is also
177 =item B<-engine_impl>
179 When used with the B<-engine> option, it specifies to also use
180 engine B<id> for digest operations.
184 File or files to digest. If no files are specified then standard input is
192 To create a hex-encoded message digest of a file:
193 openssl dgst -md5 -hex file.txt
195 To sign a file using SHA-256 with binary file output:
196 openssl dgst -sha256 -sign privatekey.pem -out signature.sign file.txt
198 To verify a signature:
199 openssl dgst -sha256 -verify publickey.pem \
200 -signature signature.sign \
206 The digest mechanisms that are available will depend on the options
207 used when building OpenSSL.
208 The B<list digest-commands> command can be used to list them.
210 New or agile applications should use probably use SHA-256. Other digests,
211 particularly SHA-1 and MD5, are still widely used for interoperating
212 with existing formats and protocols.
214 When signing a file, B<dgst> will automatically determine the algorithm
215 (RSA, ECC, etc) to use for signing based on the private key's ASN.1 info.
216 When verifying signatures, it only handles the RSA, DSA, or ECDSA signature
217 itself, not the related data to identify the signer and algorithm used in
218 formats such as x.509, CMS, and S/MIME.
220 A source of random numbers is required for certain signing algorithms, in
221 particular ECDSA and DSA.
223 The signing and verify options should only be used if a single file is
224 being signed or verified.
226 Hex signatures cannot be verified using B<openssl>. Instead, use "xxd -r"
227 or similar program to transform the hex signature into a binary signature
228 prior to verification.
232 The default digest was changed from MD5 to SHA256 in OpenSSL 1.1.0
233 The FIPS-related options were removed in OpenSSL 1.1.0
237 Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
239 Licensed under the OpenSSL license (the "License"). You may not use
240 this file except in compliance with the License. You can obtain a copy
241 in the file LICENSE in the source distribution or at
242 L<https://www.openssl.org/source/license.html>.