VirtualBox

source: vbox/trunk/src/libs/openssl-1.1.1g/doc/man1/dgst.pod@ 83916

Last change on this file since 83916 was 83916, checked in by vboxsync, 5 years ago

openssl-1.1.1g: Applied and adjusted our OpenSSL changes to 1.1.1g. bugref:9719

File size: 6.5 KB
Line 
1=pod
2
3=head1 NAME
4
5openssl-dgst,
6dgst - perform digest operations
7
8=head1 SYNOPSIS
9
10B<openssl dgst>
11[B<-I<digest>>]
12[B<-help>]
13[B<-c>]
14[B<-d>]
15[B<-list>]
16[B<-hex>]
17[B<-binary>]
18[B<-r>]
19[B<-out filename>]
20[B<-sign filename>]
21[B<-keyform arg>]
22[B<-passin arg>]
23[B<-verify filename>]
24[B<-prverify filename>]
25[B<-signature filename>]
26[B<-sigopt nm:v>]
27[B<-hmac key>]
28[B<-fips-fingerprint>]
29[B<-rand file...>]
30[B<-engine id>]
31[B<-engine_impl>]
32[B<file...>]
33
34B<openssl> I<digest> [B<...>]
35
36=head1 DESCRIPTION
37
38The digest functions output the message digest of a supplied file or files
39in hexadecimal. The digest functions also generate and verify digital
40signatures using message digests.
41
42The generic name, B<dgst>, may be used with an option specifying the
43algorithm to be used.
44The default digest is I<sha256>.
45A supported I<digest> name may also be used as the command name.
46To see the list of supported algorithms, use the I<list --digest-commands>
47command.
48
49=head1 OPTIONS
50
51=over 4
52
53=item B<-help>
54
55Print out a usage message.
56
57=item B<-I<digest>>
58
59Specifies name of a supported digest to be used. To see the list of
60supported digests, use the command I<list --digest-commands>.
61
62=item B<-c>
63
64Print out the digest in two digit groups separated by colons, only relevant if
65B<hex> format output is used.
66
67=item B<-d>
68
69Print out BIO debugging information.
70
71=item B<-list>
72
73Prints out a list of supported message digests.
74
75=item B<-hex>
76
77Digest is to be output as a hex dump. This is the default case for a "normal"
78digest as opposed to a digital signature. See NOTES below for digital
79signatures using B<-hex>.
80
81=item B<-binary>
82
83Output the digest or signature in binary form.
84
85=item B<-r>
86
87Output the digest in the "coreutils" format, including newlines.
88Used by programs like B<sha1sum>.
89
90=item B<-out filename>
91
92Filename to output to, or standard output by default.
93
94=item B<-sign filename>
95
96Digitally sign the digest using the private key in "filename". Note this option
97does not support Ed25519 or Ed448 private keys. Use the B<pkeyutl> command
98instead for this.
99
100=item B<-keyform arg>
101
102Specifies the key format to sign digest with. The DER, PEM, P12,
103and ENGINE formats are supported.
104
105=item B<-sigopt nm:v>
106
107Pass options to the signature algorithm during sign or verify operations.
108Names and values of these options are algorithm-specific.
109
110=item B<-passin arg>
111
112The private key password source. For more information about the format of B<arg>
113see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)>.
114
115=item B<-verify filename>
116
117Verify the signature using the public key in "filename".
118The output is either "Verification OK" or "Verification Failure".
119
120=item B<-prverify filename>
121
122Verify the signature using the private key in "filename".
123
124=item B<-signature filename>
125
126The actual signature to verify.
127
128=item B<-hmac key>
129
130Create a hashed MAC using "key".
131
132=item B<-mac alg>
133
134Create MAC (keyed Message Authentication Code). The most popular MAC
135algorithm is HMAC (hash-based MAC), but there are other MAC algorithms
136which are not based on hash, for instance B<gost-mac> algorithm,
137supported by B<ccgost> engine. MAC keys and other options should be set
138via B<-macopt> parameter.
139
140=item B<-macopt nm:v>
141
142Passes options to MAC algorithm, specified by B<-mac> key.
143Following options are supported by both by B<HMAC> and B<gost-mac>:
144
145=over 4
146
147=item B<key:string>
148
149Specifies MAC key as alphanumeric string (use if key contain printable
150characters only). String length must conform to any restrictions of
151the MAC algorithm for example exactly 32 chars for gost-mac.
152
153=item B<hexkey:string>
154
155Specifies MAC key in hexadecimal form (two hex digits per byte).
156Key length must conform to any restrictions of the MAC algorithm
157for example exactly 32 chars for gost-mac.
158
159=back
160
161=item B<-rand file...>
162
163A file or files containing random data used to seed the random number
164generator.
165Multiple files can be specified separated by an OS-dependent character.
166The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for
167all others.
168
169=item [B<-writerand file>]
170
171Writes random data to the specified I<file> upon exit.
172This can be used with a subsequent B<-rand> flag.
173
174=item B<-fips-fingerprint>
175
176Compute HMAC using a specific key for certain OpenSSL-FIPS operations.
177
178=item B<-engine id>
179
180Use engine B<id> for operations (including private key storage).
181This engine is not used as source for digest algorithms, unless it is
182also specified in the configuration file or B<-engine_impl> is also
183specified.
184
185=item B<-engine_impl>
186
187When used with the B<-engine> option, it specifies to also use
188engine B<id> for digest operations.
189
190=item B<file...>
191
192File or files to digest. If no files are specified then standard input is
193used.
194
195=back
196
197
198=head1 EXAMPLES
199
200To create a hex-encoded message digest of a file:
201 openssl dgst -md5 -hex file.txt
202
203To sign a file using SHA-256 with binary file output:
204 openssl dgst -sha256 -sign privatekey.pem -out signature.sign file.txt
205
206To verify a signature:
207 openssl dgst -sha256 -verify publickey.pem \
208 -signature signature.sign \
209 file.txt
210
211
212=head1 NOTES
213
214The digest mechanisms that are available will depend on the options
215used when building OpenSSL.
216The B<list digest-commands> command can be used to list them.
217
218New or agile applications should use probably use SHA-256. Other digests,
219particularly SHA-1 and MD5, are still widely used for interoperating
220with existing formats and protocols.
221
222When signing a file, B<dgst> will automatically determine the algorithm
223(RSA, ECC, etc) to use for signing based on the private key's ASN.1 info.
224When verifying signatures, it only handles the RSA, DSA, or ECDSA signature
225itself, not the related data to identify the signer and algorithm used in
226formats such as x.509, CMS, and S/MIME.
227
228A source of random numbers is required for certain signing algorithms, in
229particular ECDSA and DSA.
230
231The signing and verify options should only be used if a single file is
232being signed or verified.
233
234Hex signatures cannot be verified using B<openssl>. Instead, use "xxd -r"
235or similar program to transform the hex signature into a binary signature
236prior to verification.
237
238=head1 HISTORY
239
240The default digest was changed from MD5 to SHA256 in OpenSSL 1.1.0.
241The FIPS-related options were removed in OpenSSL 1.1.0.
242
243=head1 COPYRIGHT
244
245Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
246
247Licensed under the OpenSSL license (the "License"). You may not use
248this file except in compliance with the License. You can obtain a copy
249in the file LICENSE in the source distribution or at
250L<https://www.openssl.org/source/license.html>.
251
252=cut
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette