Change DH_get_nid() to set the value of q if it is not already set
[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 I<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:>I<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:>I<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:>I<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 C<openssl list -digest-commands>.
73
74 =item B<cipher:>I<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:>I<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:>I<string>
87
88 Used by GMAC to specify an IV in hexadecimal form (two hex digits per byte).
89
90 =item B<size:>I<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:>I<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 I<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 C<opensssl list
106 -mac-algorithms>.
107
108 =back
109
110
111 =head1 EXAMPLES
112
113 To create a hex-encoded HMAC-SHA1 MAC of a file and write to stdout: \
114  openssl mac -macopt digest:SHA1 \
115          -macopt hexkey:000102030405060708090A0B0C0D0E0F10111213 \
116          -in msg.bin HMAC
117
118 To create a SipHash MAC from a file with a binary file output: \
119  openssl mac -macopt hexkey:000102030405060708090A0B0C0D0E0F \
120          -in msg.bin -out out.bin -binary SipHash
121
122 To create a hex-encoded CMAC-AES-128-CBC MAC from a file:\
123  openssl mac -macopt cipher:AES-128-CBC \
124          -macopt hexkey:77A77FAF290C1FA30C683DF16BA7A77B \
125          -in msg.bin CMAC
126
127 To create a hex-encoded KMAC128 MAC from a file with a Customisation String
128 'Tag' and output length of 16: \
129  openssl mac -macopt custom:Tag -macopt hexkey:40414243444546 \
130          -macopt size:16 -in msg.bin KMAC128
131
132 To create a hex-encoded GMAC-AES-128-GCM with a IV from a file: \
133  openssl mac -macopt cipher:AES-128-GCM -macopt hexiv:E0E00F19FED7BA0136A797F3 \
134          -macopt hexkey:77A77FAF290C1FA30C683DF16BA7A77B -in msg.bin GMAC
135
136 =head1 NOTES
137
138 The MAC mechanisms that are available will depend on the options
139 used when building OpenSSL.
140 Use C<openssl list -mac-algorithms> to list them.
141
142 =head1 SEE ALSO
143
144 L<openssl(1)>,
145 L<EVP_MAC(3)>,
146 L<EVP_MAC-CMAC(7)>,
147 L<EVP_MAC-GMAC(7)>,
148 L<EVP_MAC-HMAC(7)>,
149 L<EVP_MAC-KMAC(7)>,
150 L<EVP_MAC-Siphash(7)>,
151 L<EVP_MAC-Poly1305(7)>
152
153 =head1 COPYRIGHT
154
155 Copyright 2018-2019 The OpenSSL Project Authors. All Rights Reserved.
156
157 Licensed under the OpenSSL license (the "License").  You may not use
158 this file except in compliance with the License.  You can obtain a copy
159 in the file LICENSE in the source distribution or at
160 L<https://www.openssl.org/source/license.html>.
161
162 =cut