1DGST(1)                             OpenSSL                            DGST(1)
2
3
4

NAME

6       openssl-dgst, dgst - perform digest operations
7

SYNOPSIS

9       openssl dgst [-digest] [-help] [-c] [-d] [-list] [-hex] [-binary] [-r]
10       [-out filename] [-sign filename] [-keyform arg] [-passin arg] [-verify
11       filename] [-prverify filename] [-signature filename] [-sigopt nm:v]
12       [-hmac key] [-fips-fingerprint] [-rand file...]  [-engine id]
13       [-engine_impl] [file...]
14
15       openssl digest [...]
16

DESCRIPTION

18       The digest functions output the message digest of a supplied file or
19       files in hexadecimal.  The digest functions also generate and verify
20       digital signatures using message digests.
21
22       The generic name, dgst, may be used with an option specifying the
23       algorithm to be used.  The default digest is sha256.  A supported
24       digest name may also be used as the command name.  To see the list of
25       supported algorithms, use the list --digest-commands command.
26

OPTIONS

28       -help
29           Print out a usage message.
30
31       -digest
32           Specifies name of a supported digest to be used. To see the list of
33           supported digests, use the command list --digest-commands.
34
35       -c  Print out the digest in two digit groups separated by colons, only
36           relevant if hex format output is used.
37
38       -d  Print out BIO debugging information.
39
40       -list
41           Prints out a list of supported message digests.
42
43       -hex
44           Digest is to be output as a hex dump. This is the default case for
45           a "normal" digest as opposed to a digital signature.  See NOTES
46           below for digital signatures using -hex.
47
48       -binary
49           Output the digest or signature in binary form.
50
51       -r  Output the digest in the "coreutils" format, including newlines.
52           Used by programs like sha1sum.
53
54       -out filename
55           Filename to output to, or standard output by default.
56
57       -sign filename
58           Digitally sign the digest using the private key in "filename". Note
59           this option does not support Ed25519 or Ed448 private keys. Use the
60           pkeyutl command instead for this.
61
62       -keyform arg
63           Specifies the key format to sign digest with. The DER, PEM, P12,
64           and ENGINE formats are supported.
65
66       -sigopt nm:v
67           Pass options to the signature algorithm during sign or verify
68           operations.  Names and values of these options are algorithm-
69           specific.
70
71       -passin arg
72           The private key password source. For more information about the
73           format of arg see the PASS PHRASE ARGUMENTS section in openssl(1).
74
75       -verify filename
76           Verify the signature using the public key in "filename".  The
77           output is either "Verification OK" or "Verification Failure".
78
79       -prverify filename
80           Verify the signature using the private key in "filename".
81
82       -signature filename
83           The actual signature to verify.
84
85       -hmac key
86           Create a hashed MAC using "key".
87
88       -mac alg
89           Create MAC (keyed Message Authentication Code). The most popular
90           MAC algorithm is HMAC (hash-based MAC), but there are other MAC
91           algorithms which are not based on hash, for instance gost-mac
92           algorithm, supported by ccgost engine. MAC keys and other options
93           should be set via -macopt parameter.
94
95       -macopt nm:v
96           Passes options to MAC algorithm, specified by -mac key.  Following
97           options are supported by both by HMAC and gost-mac:
98
99           key:string
100               Specifies MAC key as alphanumeric string (use if key contain
101               printable characters only). String length must conform to any
102               restrictions of the MAC algorithm for example exactly 32 chars
103               for gost-mac.
104
105           hexkey:string
106               Specifies MAC key in hexadecimal form (two hex digits per
107               byte).  Key length must conform to any restrictions of the MAC
108               algorithm for example exactly 32 chars for gost-mac.
109
110       -rand file...
111           A file or files containing random data used to seed the random
112           number generator.  Multiple files can be specified separated by an
113           OS-dependent character.  The separator is ; for MS-Windows, , for
114           OpenVMS, and : for all others.
115
116       [-writerand file]
117           Writes random data to the specified file upon exit.  This can be
118           used with a subsequent -rand flag.
119
120       -fips-fingerprint
121           Compute HMAC using a specific key for certain OpenSSL-FIPS
122           operations.
123
124       -engine id
125           Use engine id for operations (including private key storage).  This
126           engine is not used as source for digest algorithms, unless it is
127           also specified in the configuration file or -engine_impl is also
128           specified.
129
130       -engine_impl
131           When used with the -engine option, it specifies to also use engine
132           id for digest operations.
133
134       file...
135           File or files to digest. If no files are specified then standard
136           input is used.
137

EXAMPLES

139       To create a hex-encoded message digest of a file:
140        openssl dgst -md5 -hex file.txt
141
142       To sign a file using SHA-256 with binary file output:
143        openssl dgst -sha256 -sign privatekey.pem -out signature.sign file.txt
144
145       To verify a signature:
146        openssl dgst -sha256 -verify publickey.pem \
147        -signature signature.sign \
148        file.txt
149

NOTES

151       The digest mechanisms that are available will depend on the options
152       used when building OpenSSL.  The list digest-commands command can be
153       used to list them.
154
155       New or agile applications should use probably use SHA-256. Other
156       digests, particularly SHA-1 and MD5, are still widely used for
157       interoperating with existing formats and protocols.
158
159       When signing a file, dgst will automatically determine the algorithm
160       (RSA, ECC, etc) to use for signing based on the private key's ASN.1
161       info.  When verifying signatures, it only handles the RSA, DSA, or
162       ECDSA signature itself, not the related data to identify the signer and
163       algorithm used in formats such as x.509, CMS, and S/MIME.
164
165       A source of random numbers is required for certain signing algorithms,
166       in particular ECDSA and DSA.
167
168       The signing and verify options should only be used if a single file is
169       being signed or verified.
170
171       Hex signatures cannot be verified using openssl.  Instead, use "xxd -r"
172       or similar program to transform the hex signature into a binary
173       signature prior to verification.
174

HISTORY

176       The default digest was changed from MD5 to SHA256 in OpenSSL 1.1.0.
177       The FIPS-related options were removed in OpenSSL 1.1.0.
178
180       Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
181
182       Licensed under the OpenSSL license (the "License").  You may not use
183       this file except in compliance with the License.  You can obtain a copy
184       in the file LICENSE in the source distribution or at
185       <https://www.openssl.org/source/license.html>.
186
187
188
1891.1.1g                            2020-04-23                           DGST(1)
Impressum