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