Command docs: fix ellipses, the easy cases
[openssl.git] / doc / man1 / openssl-mac.pod
1 =pod
2
3 =head1 NAME
4
5 openssl-mac - perform Message Authentication Code operations
6
7 =head1 SYNOPSIS
8
9 B<openssl mac>
10 [B<-help>]
11 [B<-macopt>]
12 [B<-in> I<filename>]
13 [B<-out> I<filename>]
14 [B<-binary>]
15 B<mac_name>
16
17 =head1 DESCRIPTION
18
19 The message authentication code functions output the MAC of a supplied input
20 file.
21
22 =head1 OPTIONS
23
24 =over 4
25
26 =item B<-help>
27
28 Print a usage message.
29
30 =item B<-in> I<filename>
31
32 Input filename to calculate a MAC for, or standard input by default.
33 Standard input is used if the filename is '-'.
34 Files are expected to be in binary format, standard input uses hexadecimal text
35 format.
36
37 =item B<-out> I<filename>
38
39 Filename to output to, or standard output by default.
40
41 =item B<-binary>
42
43 Output the MAC in binary form. Uses hexadecimal text format if not specified.
44
45 =item B<-macopt> I<nm>:I<v>
46
47 Passes options to the MAC algorithm.
48 A comprehensive list of controls can be found in the EVP_MAC implementation
49 documentation.
50 Common parameter names used by EVP_MAC_CTX_get_params() are:
51
52 =over 4
53
54 =item B<key:string>
55
56 Specifies the MAC key as an alphanumeric string (use if the key contains
57 printable characters only).
58 The string length must conform to any restrictions of the MAC algorithm.
59 A key must be specified for every MAC algorithm.
60
61 =item B<hexkey:string>
62
63 Specifies the MAC key in hexadecimal form (two hex digits per byte).
64 The key length must conform to any restrictions of the MAC algorithm.
65 A key must be specified for every MAC algorithm.
66
67 =item B<digest:string>
68
69 Used by HMAC as an alphanumeric string (use if the key contains printable
70 characters only).
71 The string length must conform to any restrictions of the MAC algorithm.
72 To see the list of supported digests, use the command I<list -digest-commands>.
73
74 =item B<cipher:string>
75
76 Used by CMAC and GMAC to specify the cipher algorithm.
77 For CMAC it must be one of AES-128-CBC, AES-192-CBC, AES-256-CBC or
78 DES-EDE3-CBC.
79 For GMAC it should be a GCM mode cipher e.g. AES-128-GCM.
80
81 =item B<iv:string>
82
83 Used by GMAC to specify an IV as an alphanumeric string (use if the IV contains
84 printable characters only).
85
86 =item B<hexiv:string>
87
88 Used by GMAC to specify an IV in hexadecimal form (two hex digits per byte).
89
90 =item B<outlen:int>
91
92 Used by KMAC128 or KMAC256 to specify an output length.
93 The default sizes are 32 or 64 bytes respectively.
94
95 =item B<custom:string>
96
97 Used by KMAC128 or KMAC256 to specify a customization string.
98 The default is the empty string "".
99
100 =back
101
102 =item B<mac_name>
103
104 Specifies the name of a supported MAC algorithm which will be used.
105 To see the list of supported MAC's use the command I<list -mac-algorithms>.
106
107 =back
108
109
110 =head1 EXAMPLES
111
112 To create a hex-encoded HMAC-SHA1 MAC of a file and write to stdout: \
113  openssl mac -macopt digest:SHA1 \
114          -macopt hexkey:000102030405060708090A0B0C0D0E0F10111213 \
115          -in msg.bin HMAC
116
117 To create a SipHash MAC from a file with a binary file output: \
118  openssl mac -macopt hexkey:000102030405060708090A0B0C0D0E0F \
119          -in msg.bin -out out.bin -binary SipHash
120
121 To create a hex-encoded CMAC-AES-128-CBC MAC from a file:\
122  openssl mac -macopt cipher:AES-128-CBC \
123          -macopt hexkey:77A77FAF290C1FA30C683DF16BA7A77B \
124          -in msg.bin CMAC
125
126 To create a hex-encoded KMAC128 MAC from a file with a Customisation String
127 'Tag' and output length of 16: \
128  openssl mac -macopt custom:Tag -macopt hexkey:40414243444546 \
129          -macopt outlen:16 -in msg.bin KMAC128
130
131 To create a hex-encoded GMAC-AES-128-GCM with a IV from a file: \
132  openssl mac -macopt cipher:AES-128-GCM -macopt hexiv:E0E00F19FED7BA0136A797F3 \
133          -macopt hexkey:77A77FAF290C1FA30C683DF16BA7A77B -in msg.bin GMAC
134
135 =head1 NOTES
136
137 The MAC mechanisms that are available will depend on the options
138 used when building OpenSSL.
139 The B<list -mac-algorithms> command can be used to list them.
140
141 =head1 SEE ALSO
142
143 L<openssl(1)>,
144 L<EVP_MAC(3)>,
145 L<EVP_MAC-CMAC(7)>,
146 L<EVP_MAC-GMAC(7)>,
147 L<EVP_MAC-HMAC(7)>,
148 L<EVP_MAC-KMAC(7)>,
149 L<EVP_MAC-SIPHASH(7)>,
150 L<EVP_MAC-POLY1305(7)>
151
152 =head1 COPYRIGHT
153
154 Copyright 2018-2019 The OpenSSL Project Authors. All Rights Reserved.
155
156 Licensed under the OpenSSL license (the "License").  You may not use
157 this file except in compliance with the License.  You can obtain a copy
158 in the file LICENSE in the source distribution or at
159 L<https://www.openssl.org/source/license.html>.
160
161 =cut