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