2 {- OpenSSL::safe::output_do_not_edit_headers(); -}
6 openssl-mac - perform Message Authentication Code operations
20 The message authentication code functions output the MAC of a supplied input
29 Print a usage message.
31 =item B<-in> I<filename>
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
38 =item B<-out> I<filename>
40 Filename to output to, or standard output by default.
44 Output the MAC in binary form. Uses hexadecimal text format if not specified.
46 =item B<-macopt> I<nm>:I<v>
48 Passes options to the MAC algorithm.
49 A comprehensive list of controls can be found in the EVP_MAC implementation
51 Common parameter names used by EVP_MAC_CTX_get_params() are:
55 =item B<key:>I<string>
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.
62 =item B<hexkey:>I<string>
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.
68 =item B<digest:>I<string>
70 Used by HMAC as an alphanumeric string (use if the key contains printable
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>.
75 =item B<cipher:>I<string>
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
80 For GMAC it should be a GCM mode cipher e.g. AES-128-GCM.
84 Used by GMAC to specify an IV as an alphanumeric string (use if the IV contains
85 printable characters only).
87 =item B<hexiv:>I<string>
89 Used by GMAC to specify an IV in hexadecimal form (two hex digits per byte).
93 Used by KMAC128 or KMAC256 to specify an output length.
94 The default sizes are 32 or 64 bytes respectively.
96 =item B<custom:>I<string>
98 Used by KMAC128 or KMAC256 to specify a customization string.
99 The default is the empty string "".
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
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 \
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
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 \
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
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
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.
151 L<EVP_MAC-Siphash(7)>,
152 L<EVP_MAC-Poly1305(7)>
156 Copyright 2018-2019 The OpenSSL Project Authors. All Rights Reserved.
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>.