5 dgst, sha, sha1, mdc2, ripemd160, sha224, sha256, sha384, sha512, md2, md4, md5, dss1 - message digests
10 [B<-sha|-sha1|-mdc2|-ripemd160|-sha224|-sha256|-sha384|-sha512|-md2|-md4|-md5|-dss1>]
21 [B<-prverify filename>]
22 [B<-signature filename>]
25 [B<-fips-fingerprint>]
34 The digest functions output the message digest of a supplied file or files
35 in hexadecimal. The digest functions also generate and verify digital
36 signatures using message digests.
44 print out the digest in two digit groups separated by colons, only relevant if
45 B<hex> format output is used.
49 print out BIO debugging information.
53 digest is to be output as a hex dump. This is the default case for a "normal"
54 digest as opposed to a digital signature. See NOTES below for digital
55 signatures using B<-hex>.
59 output the digest or signature in binary form.
63 output the digest in the "coreutils" format used by programs like B<sha1sum>.
65 =item B<-out filename>
67 filename to output to, or standard output by default.
69 =item B<-sign filename>
71 digitally sign the digest using the private key in "filename".
75 Specifies the key format to sign digest with. The DER, PEM, P12,
76 and ENGINE formats are supported.
80 Use engine B<id> for operations (including private key storage).
81 This engine is not used as source for digest algorithms, unless it is
82 also specified in the configuration file.
86 Pass options to the signature algorithm during sign or verify operations.
87 Names and values of these options are algorithm-specific.
92 the private key password source. For more information about the format of B<arg>
93 see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
95 =item B<-verify filename>
97 verify the signature using the the public key in "filename".
98 The output is either "Verification OK" or "Verification Failure".
100 =item B<-prverify filename>
102 verify the signature using the the private key in "filename".
104 =item B<-signature filename>
106 the actual signature to verify.
110 create a hashed MAC using "key".
114 create MAC (keyed Message Authentication Code). The most popular MAC
115 algorithm is HMAC (hash-based MAC), but there are other MAC algorithms
116 which are not based on hash, for instance B<gost-mac> algorithm,
117 supported by B<ccgost> engine. MAC keys and other options should be set
118 via B<-macopt> parameter.
120 =item B<-macopt nm:v>
122 Passes options to MAC algorithm, specified by B<-mac> key.
123 Following options are supported by both by B<HMAC> and B<gost-mac>:
129 Specifies MAC key as alphnumeric string (use if key contain printable
130 characters only). String length must conform to any restrictions of
131 the MAC algorithm for example exactly 32 chars for gost-mac.
133 =item B<hexkey:string>
135 Specifies MAC key in hexadecimal form (two hex digits per byte).
136 Key length must conform to any restrictions of the MAC algorithm
137 for example exactly 32 chars for gost-mac.
141 =item B<-rand file(s)>
143 a file or files containing random data used to seed the random number
144 generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>).
145 Multiple files can be specified separated by a OS-dependent character.
146 The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for
149 =item B<-non-fips-allow>
151 enable use of non-FIPS algorithms such as MD5 even in FIPS mode.
153 =item B<-fips-fingerprint>
155 compute HMAC using a specific key
156 for certain OpenSSL-FIPS operations.
160 file or files to digest. If no files are specified then standard input is
168 To create a hex-encoded message digest of a file:
169 openssl dgst -md5 -hex file.txt
171 To sign a file using SHA-256 with binary file output:
172 openssl dgst -sha256 -sign privatekey.pem -out signature.sign file.txt
174 To verify a signature:
175 openssl dgst -sha256 -verify publickey.pem \
176 -signature signature.sign \
182 The digest of choice for all new applications is SHA1. Other digests are
183 however still widely used.
185 When signing a file, B<dgst> will automatically determine the algorithm
186 (RSA, ECC, etc) to use for signing based on the private key's ASN.1 info.
187 When verifying signatures, it only handles the RSA, DSA, or ECDSA signature
188 itself, not the related data to identify the signer and algorithm used in
189 formats such as x.509, CMS, and S/MIME.
191 A source of random numbers is required for certain signing algorithms, in
192 particular ECDSA and DSA.
194 The signing and verify options should only be used if a single file is
195 being signed or verified.
197 Hex signatures cannot be verified using B<openssl>. Instead, use "xxd -r"
198 or similar program to transform the hex signature into a binary signature
199 prior to verification.