6 dgst, sha, sha1, mdc2, ripemd160, sha224, sha256, sha384, sha512, md2, md4, md5, dss1 - message digests
11 [B<-sha|-sha1|-mdc2|-ripemd160|-sha224|-sha256|-sha384|-sha512|-md2|-md4|-md5|-dss1>]
23 [B<-prverify filename>]
24 [B<-signature filename>]
27 [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.
46 print out the digest in two digit groups separated by colons, only relevant if
47 B<hex> format output is used.
51 print out BIO debugging information.
55 digest is to be output as a hex dump. This is the default case for a "normal"
56 digest as opposed to a digital signature. See NOTES below for digital
57 signatures using B<-hex>.
61 output the digest or signature in binary form.
65 output the digest in the "coreutils" format used by programs like B<sha1sum>.
67 =item B<-non-fips-allow>
69 Allow use of non FIPS digest when in FIPS mode. This has no effect when not in
72 =item B<-out filename>
74 filename to output to, or standard output by default.
76 =item B<-sign filename>
78 digitally sign the digest using the private key in "filename".
82 Specifies the key format to sign digest with. The DER, PEM, P12,
83 and ENGINE formats are supported.
87 Use engine B<id> for operations (including private key storage).
88 This engine is not used as source for digest algorithms, unless it is
89 also specified in the configuration file.
93 Pass options to the signature algorithm during sign or verify operations.
94 Names and values of these options are algorithm-specific.
99 the private key password source. For more information about the format of B<arg>
100 see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
102 =item B<-verify filename>
104 verify the signature using the public key in "filename".
105 The output is either "Verification OK" or "Verification Failure".
107 =item B<-prverify filename>
109 verify the signature using the private key in "filename".
111 =item B<-signature filename>
113 the actual signature to verify.
117 create a hashed MAC using "key".
121 create MAC (keyed Message Authentication Code). The most popular MAC
122 algorithm is HMAC (hash-based MAC), but there are other MAC algorithms
123 which are not based on hash, for instance B<gost-mac> algorithm,
124 supported by B<ccgost> engine. MAC keys and other options should be set
125 via B<-macopt> parameter.
127 =item B<-macopt nm:v>
129 Passes options to MAC algorithm, specified by B<-mac> key.
130 Following options are supported by both by B<HMAC> and B<gost-mac>:
136 Specifies MAC key as alphnumeric string (use if key contain printable
137 characters only). String length must conform to any restrictions of
138 the MAC algorithm for example exactly 32 chars for gost-mac.
140 =item B<hexkey:string>
142 Specifies MAC key in hexadecimal form (two hex digits per byte).
143 Key length must conform to any restrictions of the MAC algorithm
144 for example exactly 32 chars for gost-mac.
148 =item B<-rand file(s)>
150 a file or files containing random data used to seed the random number
151 generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>).
152 Multiple files can be specified separated by a OS-dependent character.
153 The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for
156 =item B<-non-fips-allow>
158 enable use of non-FIPS algorithms such as MD5 even in FIPS mode.
160 =item B<-fips-fingerprint>
162 compute HMAC using a specific key
163 for certain OpenSSL-FIPS operations.
167 file or files to digest. If no files are specified then standard input is
175 To create a hex-encoded message digest of a file:
176 openssl dgst -md5 -hex file.txt
178 To sign a file using SHA-256 with binary file output:
179 openssl dgst -sha256 -sign privatekey.pem -out signature.sign file.txt
181 To verify a signature:
182 openssl dgst -sha256 -verify publickey.pem \
183 -signature signature.sign \
189 The digest of choice for all new applications is SHA1. Other digests are
190 however still widely used.
192 When signing a file, B<dgst> will automatically determine the algorithm
193 (RSA, ECC, etc) to use for signing based on the private key's ASN.1 info.
194 When verifying signatures, it only handles the RSA, DSA, or ECDSA signature
195 itself, not the related data to identify the signer and algorithm used in
196 formats such as x.509, CMS, and S/MIME.
198 A source of random numbers is required for certain signing algorithms, in
199 particular ECDSA and DSA.
201 The signing and verify options should only be used if a single file is
202 being signed or verified.
204 Hex signatures cannot be verified using B<openssl>. Instead, use "xxd -r"
205 or similar program to transform the hex signature into a binary signature
206 prior to verification.