1DGST(1)                             OpenSSL                            DGST(1)
2
3
4

NAME

6       dgst, sha, sha1, mdc2, ripemd160, sha224, sha256, sha384, sha512, md2,
7       md4, md5, dss1 - message digests
8

SYNOPSIS

10       openssl dgst
11       [-sha|-sha1|-mdc2|-ripemd160|-sha224|-sha256|-sha384|-sha512|-md2|-md4|-md5|-dss1]
12       [-c] [-d] [-hex] [-binary] [-r] [-non-fips-allow] [-out filename]
13       [-sign filename] [-keyform arg] [-passin arg] [-verify filename]
14       [-prverify filename] [-signature filename] [-hmac key]
15       [-non-fips-allow] [-fips-fingerprint] [file...]
16
17       openssl [digest] [...]
18

DESCRIPTION

20       The digest functions output the message digest of a supplied file or
21       files in hexadecimal.  The digest functions also generate and verify
22       digital signatures using message digests.
23

OPTIONS

25       -c  print out the digest in two digit groups separated by colons, only
26           relevant if hex format output is used.
27
28       -d  print out BIO debugging information.
29
30       -hex
31           digest is to be output as a hex dump. This is the default case for
32           a "normal" digest as opposed to a digital signature.  See NOTES
33           below for digital signatures using -hex.
34
35       -binary
36           output the digest or signature in binary form.
37
38       -r  output the digest in the "coreutils" format used by programs like
39           sha1sum.
40
41       -non-fips-allow
42           Allow use of non FIPS digest when in FIPS mode.  This has no effect
43           when not in FIPS mode.
44
45       -out filename
46           filename to output to, or standard output by default.
47
48       -sign filename
49           digitally sign the digest using the private key in "filename".
50
51       -keyform arg
52           Specifies the key format to sign digest with. The DER, PEM, P12,
53           and ENGINE formats are supported.
54
55       -engine id
56           Use engine id for operations (including private key storage).  This
57           engine is not used as source for digest algorithms, unless it is
58           also specified in the configuration file.
59
60       -sigopt nm:v
61           Pass options to the signature algorithm during sign or verify
62           operations.  Names and values of these options are algorithm-
63           specific.
64
65       -passin arg
66           the private key password source. For more information about the
67           format of arg see the PASS PHRASE ARGUMENTS section in openssl(1).
68
69       -verify filename
70           verify the signature using the the public key in "filename".  The
71           output is either "Verification OK" or "Verification Failure".
72
73       -prverify filename
74           verify the signature using the  the private key in "filename".
75
76       -signature filename
77           the actual signature to verify.
78
79       -hmac key
80           create a hashed MAC using "key".
81
82       -mac alg
83           create MAC (keyed Message Authentication Code). The most popular
84           MAC algorithm is HMAC (hash-based MAC), but there are other MAC
85           algorithms which are not based on hash, for instance gost-mac
86           algorithm, supported by ccgost engine. MAC keys and other options
87           should be set via -macopt parameter.
88
89       -macopt nm:v
90           Passes options to MAC algorithm, specified by -mac key.  Following
91           options are supported by both by HMAC and gost-mac:
92
93           key:string
94                   Specifies MAC key as alphnumeric string (use if key contain
95                   printable characters only). String length must conform to
96                   any restrictions of the MAC algorithm for example exactly
97                   32 chars for gost-mac.
98
99           hexkey:string
100                   Specifies MAC key in hexadecimal form (two hex digits per
101                   byte).  Key length must conform to any restrictions of the
102                   MAC algorithm for example exactly 32 chars for gost-mac.
103
104       -rand file(s)
105           a file or files containing random data used to seed the random
106           number generator, or an EGD socket (see RAND_egd(3)).  Multiple
107           files can be specified separated by a OS-dependent character.  The
108           separator is ; for MS-Windows, , for OpenVMS, and : for all others.
109
110       -non-fips-allow
111           enable use of non-FIPS algorithms such as MD5 even in FIPS mode.
112
113       -fips-fingerprint
114           compute HMAC using a specific key for certain OpenSSL-FIPS
115           operations.
116
117       file...
118           file or files to digest. If no files are specified then standard
119           input is used.
120

EXAMPLES

122       To create a hex-encoded message digest of a file:
123        openssl dgst -md5 -hex file.txt
124
125       To sign a file using SHA-256 with binary file output:
126        openssl dgst -sha256 -sign privatekey.pem -out signature.sign file.txt
127
128       To verify a signature:
129        openssl dgst -sha256 -verify publickey.pem \
130        -signature signature.sign \
131        file.txt
132

NOTES

134       The digest of choice for all new applications is SHA1. Other digests
135       are however still widely used.
136
137       When signing a file, dgst will automatically determine the algorithm
138       (RSA, ECC, etc) to use for signing based on the private key's ASN.1
139       info.  When verifying signatures, it only handles the RSA, DSA, or
140       ECDSA signature itself, not the related data to identify the signer and
141       algorithm used in formats such as x.509, CMS, and S/MIME.
142
143       A source of random numbers is required for certain signing algorithms,
144       in particular ECDSA and DSA.
145
146       The signing and verify options should only be used if a single file is
147       being signed or verified.
148
149       Hex signatures cannot be verified using openssl.  Instead, use "xxd -r"
150       or similar program to transform the hex signature into a binary
151       signature prior to verification.
152
153
154
1551.0.2k                            2017-01-26                           DGST(1)
Impressum