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