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