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>]
36 The digest functions output the message digest of a supplied file or files
37 in hexadecimal. The digest functions also generate and verify digital
38 signatures using message digests.
40 The generic name, B<dgst>, may be used with an option specifying the
42 The default digest is I<sha256>.
43 A supported I<digest> name may also be used as the command name.
44 To see the list of supported algorithms, use the I<list --digest-commands>
53 Print out a usage message.
57 Specifies name of a supported digest to be used. To see the list of
58 supported digests, use the command I<list --digest-commands>.
62 Print out the digest in two digit groups separated by colons, only relevant if
63 B<hex> format output is used.
67 Print out BIO debugging information.
71 Digest is to be output as a hex dump. This is the default case for a "normal"
72 digest as opposed to a digital signature. See NOTES below for digital
73 signatures using B<-hex>.
77 Output the digest or signature in binary form.
81 Output the digest in the "coreutils" format used by programs like B<sha1sum>.
83 =item B<-out filename>
85 Filename to output to, or standard output by default.
87 =item B<-sign filename>
89 Digitally sign the digest using the private key in "filename".
93 Specifies the key format to sign digest with. The DER, PEM, P12,
94 and ENGINE formats are supported.
98 Pass options to the signature algorithm during sign or verify operations.
99 Names and values of these options are algorithm-specific.
103 The private key password source. For more information about the format of B<arg>
104 see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)>.
106 =item B<-verify filename>
108 Verify the signature using the public key in "filename".
109 The output is either "Verification OK" or "Verification Failure".
111 =item B<-prverify filename>
113 Verify the signature using the private key in "filename".
115 =item B<-signature filename>
117 The actual signature to verify.
121 Create a hashed MAC using "key".
125 Create MAC (keyed Message Authentication Code). The most popular MAC
126 algorithm is HMAC (hash-based MAC), but there are other MAC algorithms
127 which are not based on hash, for instance B<gost-mac> algorithm,
128 supported by B<ccgost> engine. MAC keys and other options should be set
129 via B<-macopt> parameter.
131 =item B<-macopt nm:v>
133 Passes options to MAC algorithm, specified by B<-mac> key.
134 Following options are supported by both by B<HMAC> and B<gost-mac>:
140 Specifies MAC key as alphanumeric string (use if key contain printable
141 characters only). String length must conform to any restrictions of
142 the MAC algorithm for example exactly 32 chars for gost-mac.
144 =item B<hexkey:string>
146 Specifies MAC key in hexadecimal form (two hex digits per byte).
147 Key length must conform to any restrictions of the MAC algorithm
148 for example exactly 32 chars for gost-mac.
152 =item B<-rand file(s)>
154 A file or files containing random data used to seed the random number
155 generator, or an EGD socket (see L<RAND_egd(3)>).
156 Multiple files can be specified separated by an OS-dependent character.
157 The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for
160 =item B<-fips-fingerprint>
162 Compute HMAC using a specific key for certain OpenSSL-FIPS operations.
166 Use engine B<id> for operations (including private key storage).
167 This engine is not used as source for digest algorithms, unless it is
168 also specified in the configuration file or B<-engine_impl> is also
171 =item B<-engine_impl>
173 When used with the B<-engine> option, it specifies to also use
174 engine B<id> for digest operations.
178 File or files to digest. If no files are specified then standard input is
186 To create a hex-encoded message digest of a file:
187 openssl dgst -md5 -hex file.txt
189 To sign a file using SHA-256 with binary file output:
190 openssl dgst -sha256 -sign privatekey.pem -out signature.sign file.txt
192 To verify a signature:
193 openssl dgst -sha256 -verify publickey.pem \
194 -signature signature.sign \
200 The digest mechanisms that are available will depend on the options
201 used when building OpenSSL.
202 The B<list digest-commands> command can be used to list them.
204 New or agile applications should use probably use SHA-256. Other digests,
205 particularly SHA-1 and MD5, are still widely used for interoperating
206 with existing formats and protocols.
208 When signing a file, B<dgst> will automatically determine the algorithm
209 (RSA, ECC, etc) to use for signing based on the private key's ASN.1 info.
210 When verifying signatures, it only handles the RSA, DSA, or ECDSA signature
211 itself, not the related data to identify the signer and algorithm used in
212 formats such as x.509, CMS, and S/MIME.
214 A source of random numbers is required for certain signing algorithms, in
215 particular ECDSA and DSA.
217 The signing and verify options should only be used if a single file is
218 being signed or verified.
220 Hex signatures cannot be verified using B<openssl>. Instead, use "xxd -r"
221 or similar program to transform the hex signature into a binary signature
222 prior to verification.
226 The default digest was changed from MD5 to SHA256 in OpenSSL 1.1.0
227 The FIPS-related options were removed in OpenSSL 1.1.0
231 Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
233 Licensed under the OpenSSL license (the "License"). You may not use
234 this file except in compliance with the License. You can obtain a copy
235 in the file LICENSE in the source distribution or at
236 L<https://www.openssl.org/source/license.html>.