dgst.pod (246771) | dgst.pod (273144) |
---|---|
1=pod 2 3=head1 NAME 4 | 1=pod 2 3=head1 NAME 4 |
5dgst, md5, md4, md2, sha1, sha, mdc2, ripemd160 - message digests | 5dgst, sha, sha1, mdc2, ripemd160, sha224, sha256, sha384, sha512, md2, md4, md5, dss1 - message digests |
6 7=head1 SYNOPSIS 8 9B<openssl> B<dgst> | 6 7=head1 SYNOPSIS 8 9B<openssl> B<dgst> |
10[B<-md5|-md4|-md2|-sha1|-sha|-mdc2|-ripemd160|-dss1>] | 10[B<-sha|-sha1|-mdc2|-ripemd160|-sha224|-sha256|-sha384|-sha512|-md2|-md4|-md5|-dss1>] |
11[B<-c>] 12[B<-d>] 13[B<-hex>] 14[B<-binary>] | 11[B<-c>] 12[B<-d>] 13[B<-hex>] 14[B<-binary>] |
15[B<-r>] |
|
15[B<-out filename>] 16[B<-sign filename>] 17[B<-keyform arg>] 18[B<-passin arg>] 19[B<-verify filename>] 20[B<-prverify filename>] 21[B<-signature filename>] 22[B<-hmac key>] | 16[B<-out filename>] 17[B<-sign filename>] 18[B<-keyform arg>] 19[B<-passin arg>] 20[B<-verify filename>] 21[B<-prverify filename>] 22[B<-signature filename>] 23[B<-hmac key>] |
24[B<-non-fips-allow>] 25[B<-fips-fingerprint>] |
|
23[B<file...>] 24 | 26[B<file...>] 27 |
25[B<md5|md4|md2|sha1|sha|mdc2|ripemd160>] 26[B<-c>] 27[B<-d>] 28[B<file...>] | 28B<openssl> 29[I<digest>] 30[B<...>] |
29 30=head1 DESCRIPTION 31 32The digest functions output the message digest of a supplied file or files | 31 32=head1 DESCRIPTION 33 34The digest functions output the message digest of a supplied file or files |
33in hexadecimal form. They can also be used for digital signing and verification. | 35in hexadecimal. The digest functions also generate and verify digital 36signatures using message digests. |
34 35=head1 OPTIONS 36 37=over 4 38 39=item B<-c> 40 41print out the digest in two digit groups separated by colons, only relevant if 42B<hex> format output is used. 43 44=item B<-d> 45 46print out BIO debugging information. 47 48=item B<-hex> 49 50digest is to be output as a hex dump. This is the default case for a "normal" | 37 38=head1 OPTIONS 39 40=over 4 41 42=item B<-c> 43 44print out the digest in two digit groups separated by colons, only relevant if 45B<hex> format output is used. 46 47=item B<-d> 48 49print out BIO debugging information. 50 51=item B<-hex> 52 53digest is to be output as a hex dump. This is the default case for a "normal" |
51digest as opposed to a digital signature. | 54digest as opposed to a digital signature. See NOTES below for digital 55signatures using B<-hex>. |
52 53=item B<-binary> 54 55output the digest or signature in binary form. 56 | 56 57=item B<-binary> 58 59output the digest or signature in binary form. 60 |
61=item B<-r> 62 63output the digest in the "coreutils" format used by programs like B<sha1sum>. 64 |
|
57=item B<-out filename> 58 59filename to output to, or standard output by default. 60 61=item B<-sign filename> 62 63digitally sign the digest using the private key in "filename". 64 65=item B<-keyform arg> 66 | 65=item B<-out filename> 66 67filename to output to, or standard output by default. 68 69=item B<-sign filename> 70 71digitally sign the digest using the private key in "filename". 72 73=item B<-keyform arg> 74 |
67Specifies the key format to sign digest with. Only PEM and ENGINE 68formats are supported by the B<dgst> command. | 75Specifies the key format to sign digest with. The DER, PEM, P12, 76and ENGINE formats are supported. |
69 70=item B<-engine id> 71 72Use engine B<id> for operations (including private key storage). 73This engine is not used as source for digest algorithms, unless it is 74also specified in the configuration file. 75 76=item B<-sigopt nm:v> --- 35 unchanged lines hidden (view full) --- 112=item B<-macopt nm:v> 113 114Passes options to MAC algorithm, specified by B<-mac> key. 115Following options are supported by both by B<HMAC> and B<gost-mac>: 116 117=over 8 118 119=item B<key:string> | 77 78=item B<-engine id> 79 80Use engine B<id> for operations (including private key storage). 81This engine is not used as source for digest algorithms, unless it is 82also specified in the configuration file. 83 84=item B<-sigopt nm:v> --- 35 unchanged lines hidden (view full) --- 120=item B<-macopt nm:v> 121 122Passes options to MAC algorithm, specified by B<-mac> key. 123Following options are supported by both by B<HMAC> and B<gost-mac>: 124 125=over 8 126 127=item B<key:string> |
120 | 128 |
121Specifies MAC key as alphnumeric string (use if key contain printable 122characters only). String length must conform to any restrictions of 123the MAC algorithm for example exactly 32 chars for gost-mac. 124 125=item B<hexkey:string> 126 127Specifies MAC key in hexadecimal form (two hex digits per byte). 128Key length must conform to any restrictions of the MAC algorithm --- 4 unchanged lines hidden (view full) --- 133=item B<-rand file(s)> 134 135a file or files containing random data used to seed the random number 136generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). 137Multiple files can be specified separated by a OS-dependent character. 138The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for 139all others. 140 | 129Specifies MAC key as alphnumeric string (use if key contain printable 130characters only). String length must conform to any restrictions of 131the MAC algorithm for example exactly 32 chars for gost-mac. 132 133=item B<hexkey:string> 134 135Specifies MAC key in hexadecimal form (two hex digits per byte). 136Key length must conform to any restrictions of the MAC algorithm --- 4 unchanged lines hidden (view full) --- 141=item B<-rand file(s)> 142 143a file or files containing random data used to seed the random number 144generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). 145Multiple files can be specified separated by a OS-dependent character. 146The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for 147all others. 148 |
149=item B<-non-fips-allow> 150 151enable use of non-FIPS algorithms such as MD5 even in FIPS mode. 152 153=item B<-fips-fingerprint> 154 155compute HMAC using a specific key 156for certain OpenSSL-FIPS operations. 157 |
|
141=item B<file...> 142 143file or files to digest. If no files are specified then standard input is 144used. 145 146=back 147 | 158=item B<file...> 159 160file or files to digest. If no files are specified then standard input is 161used. 162 163=back 164 |
165 166=head1 EXAMPLES 167 168To create a hex-encoded message digest of a file: 169 openssl dgst -md5 -hex file.txt 170 171To sign a file using SHA-256 with binary file output: 172 openssl dgst -sha256 -sign privatekey.pem -out signature.sign file.txt 173 174To verify a signature: 175 openssl dgst -sha256 -verify publickey.pem \ 176 -signature signature.sign \ 177 file.txt 178 179 |
|
148=head1 NOTES 149 150The digest of choice for all new applications is SHA1. Other digests are 151however still widely used. 152 | 180=head1 NOTES 181 182The digest of choice for all new applications is SHA1. Other digests are 183however still widely used. 184 |
153If you wish to sign or verify data using the DSA algorithm then the dss1 154digest must be used. | 185When 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. 187When verifying signatures, it only handles the RSA, DSA, or ECDSA signature 188itself, not the related data to identify the signer and algorithm used in 189formats such as x.509, CMS, and S/MIME. |
155 156A source of random numbers is required for certain signing algorithms, in | 190 191A source of random numbers is required for certain signing algorithms, in |
157particular DSA. | 192particular ECDSA and DSA. |
158 159The signing and verify options should only be used if a single file is 160being signed or verified. 161 | 193 194The signing and verify options should only be used if a single file is 195being signed or verified. 196 |
197Hex signatures cannot be verified using B<openssl>. Instead, use "xxd -r" 198or similar program to transform the hex signature into a binary signature 199prior to verification. 200 201 |
|
162=cut | 202=cut |