5 dgst, sha, sha1, mdc2, ripemd160, sha224, sha256, sha384, sha512, md4, md5, blake2b, blake2s - message digests
22 [B<-prverify filename>]
23 [B<-signature filename>]
24 [B<-fips-fingerprint>]
35 The digest functions output the message digest of a supplied file or files
36 in hexadecimal. The digest functions also generate and verify digital
37 signatures using message digests.
39 The generic name, B<dgst>, may be used with an option specifying the
41 The default digest is I<sha256>.
42 A supported I<digest> name may also be used as the command name.
43 To see the list of supported algorithms, use the I<list --digest-commands>
52 Print out a usage message.
56 Specifies name of a supported digest to be used. To see the list of
57 supported digests, use the command I<list --digest-commands>.
61 Print out the digest in two digit groups separated by colons, only relevant if
62 B<hex> format output is used.
66 Print out BIO debugging information.
70 Digest is to be output as a hex dump. This is the default case for a "normal"
71 digest as opposed to a digital signature. See NOTES below for digital
72 signatures using B<-hex>.
76 Output the digest or signature in binary form.
80 Output the digest in the "coreutils" format used by programs like B<sha1sum>.
82 =item B<-out filename>
84 Filename to output to, or standard output by default.
86 =item B<-sign filename>
88 Digitally sign the digest using the private key in "filename".
92 Specifies the key format to sign digest with. The DER, PEM, P12,
93 and ENGINE formats are supported.
97 Pass options to the signature algorithm during sign or verify operations.
98 Names and values of these options are algorithm-specific.
102 The private key password source. For more information about the format of B<arg>
103 see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)>.
105 =item B<-verify filename>
107 Verify the signature using the public key in "filename".
108 The output is either "Verification OK" or "Verification Failure".
110 =item B<-prverify filename>
112 Verify the signature using the private key in "filename".
114 =item B<-signature filename>
116 The actual signature to verify.
120 Create MAC (keyed Message Authentication Code). The most popular MAC
121 algorithm is HMAC (hash-based MAC), but there are other MAC algorithms
122 which are not based on hash, for instance B<gost-mac> algorithm,
123 supported by B<ccgost> engine. MAC keys and other options should be set
124 via B<-macopt> parameter.
126 =item B<-macopt nm:v>
128 Passes options to MAC algorithm, specified by B<-mac> key.
129 Following options are supported by both by B<HMAC> and B<gost-mac>:
135 Specifies MAC key as alphanumeric string (use if key contain printable
136 characters only). String length must conform to any restrictions of
137 the MAC algorithm for example exactly 32 chars for gost-mac.
139 =item B<hexkey:string>
141 Specifies MAC key in hexadecimal form (two hex digits per byte).
142 Key length must conform to any restrictions of the MAC algorithm
143 for example exactly 32 chars for gost-mac.
147 =item B<-rand file(s)>
149 A file or files containing random data used to seed the random number
150 generator, or an EGD socket (see L<RAND_egd(3)>).
151 Multiple files can be specified separated by an OS-dependent character.
152 The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for
155 =item B<-fips-fingerprint>
157 Compute HMAC using a specific key for certain OpenSSL-FIPS operations.
161 Use engine B<id> for operations (including private key storage).
162 This engine is not used as source for digest algorithms, unless it is
163 also specified in the configuration file or B<-engine_impl> is also
166 =item B<-engine_impl>
168 When used with the B<-engine> option, it specifies to also use
169 engine B<id> for digest operations.
173 File or files to digest. If no files are specified then standard input is
181 To create a hex-encoded message digest of a file:
182 openssl dgst -md5 -hex file.txt
184 To sign a file using SHA-256 with binary file output:
185 openssl dgst -sha256 -sign privatekey.pem -out signature.sign file.txt
187 To verify a signature:
188 openssl dgst -sha256 -verify publickey.pem \
189 -signature signature.sign \
195 The digest mechanisms that are available will depend on the options
196 used when building OpenSSL.
197 The B<list digest-commands> command can be used to list them.
199 New or agile applications should use probably use SHA-256. Other digests,
200 particularly SHA-1 and MD5, are still widely used for interoperating
201 with existing formats and protocols.
203 When signing a file, B<dgst> will automatically determine the algorithm
204 (RSA, ECC, etc) to use for signing based on the private key's ASN.1 info.
205 When verifying signatures, it only handles the RSA, DSA, or ECDSA signature
206 itself, not the related data to identify the signer and algorithm used in
207 formats such as x.509, CMS, and S/MIME.
209 A source of random numbers is required for certain signing algorithms, in
210 particular ECDSA and DSA.
212 The signing and verify options should only be used if a single file is
213 being signed or verified.
215 Hex signatures cannot be verified using B<openssl>. Instead, use "xxd -r"
216 or similar program to transform the hex signature into a binary signature
217 prior to verification.
221 The default digest was changed from MD5 to SHA256 in OpenSSL 1.1.0
222 The FIPS-related options were removed in OpenSSL 1.1.0
226 Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
228 Licensed under the OpenSSL license (the "License"). You may not use
229 this file except in compliance with the License. You can obtain a copy
230 in the file LICENSE in the source distribution or at
231 L<https://www.openssl.org/source/license.html>.