1OPENSSL-MAC(1ossl)                  OpenSSL                 OPENSSL-MAC(1ossl)
2
3
4

NAME

6       openssl-mac - perform Message Authentication Code operations
7

SYNOPSIS

9       openssl mac [-help] [-cipher] [-digest] [-macopt] [-in filename] [-out
10       filename] [-binary] [-provider name] [-provider-path path] [-propquery
11       propq] mac_name
12

DESCRIPTION

14       The message authentication code functions output the MAC of a supplied
15       input file.
16

OPTIONS

18       -help
19           Print a usage message.
20
21       -in filename
22           Input filename to calculate a MAC for, or standard input by
23           default.  Standard input is used if the filename is '-'.  Files and
24           standard input are expected to be in binary format.
25
26       -out filename
27           Filename to output to, or standard output by default.
28
29       -binary
30           Output the MAC in binary form. Uses hexadecimal text format if not
31           specified.
32
33       -cipher name
34           Used by CMAC and GMAC to specify the cipher algorithm.  For CMAC it
35           must be one of AES-128-CBC, AES-192-CBC, AES-256-CBC or
36           DES-EDE3-CBC.  For GMAC it should be a GCM mode cipher e.g.
37           AES-128-GCM.
38
39       -digest name
40           Used by HMAC as an alphanumeric string (use if the key contains
41           printable characters only).  The string length must conform to any
42           restrictions of the MAC algorithm.  To see the list of supported
43           digests, use "openssl list -digest-commands".
44
45       -macopt nm:v
46           Passes options to the MAC algorithm.  A comprehensive list of
47           controls can be found in the EVP_MAC implementation documentation.
48           Common parameter names used by EVP_MAC_CTX_get_params() are:
49
50           key:string
51               Specifies the MAC key as an alphanumeric string (use if the key
52               contains printable characters only).  The string length must
53               conform to any restrictions of the MAC algorithm.  A key must
54               be specified for every MAC algorithm.
55
56           hexkey:string
57               Specifies the MAC key in hexadecimal form (two hex digits per
58               byte).  The key length must conform to any restrictions of the
59               MAC algorithm.  A key must be specified for every MAC
60               algorithm.
61
62           iv:string
63               Used by GMAC to specify an IV as an alphanumeric string (use if
64               the IV contains printable characters only).
65
66           hexiv:string
67               Used by GMAC to specify an IV in hexadecimal form (two hex
68               digits per byte).
69
70           size:int
71               Used by KMAC128 or KMAC256 to specify an output length.  The
72               default sizes are 32 or 64 bytes respectively.
73
74           custom:string
75               Used by KMAC128 or KMAC256 to specify a customization string.
76               The default is the empty string "".
77
78           digest:string
79               This option is identical to the -digest option.
80
81           cipher:string
82               This option is identical to the -cipher option.
83
84       -provider name
85       -provider-path path
86       -propquery propq
87           See "Provider Options" in openssl(1), provider(7), and property(7).
88
89       mac_name
90           Specifies the name of a supported MAC algorithm which will be used.
91           To see the list of supported MAC's use the command "openssl list
92           -mac-algorithms".
93

EXAMPLES

95       To create a hex-encoded HMAC-SHA1 MAC of a file and write to stdout: \
96        openssl mac -digest SHA1 \
97                -macopt hexkey:000102030405060708090A0B0C0D0E0F10111213 \
98                -in msg.bin HMAC
99
100       To create a SipHash MAC from a file with a binary file output: \
101        openssl mac -macopt hexkey:000102030405060708090A0B0C0D0E0F \
102                -in msg.bin -out out.bin -binary SipHash
103
104       To create a hex-encoded CMAC-AES-128-CBC MAC from a file:\
105        openssl mac -cipher AES-128-CBC \
106                -macopt hexkey:77A77FAF290C1FA30C683DF16BA7A77B \
107                -in msg.bin CMAC
108
109       To create a hex-encoded KMAC128 MAC from a file with a Customisation
110       String 'Tag' and output length of 16: \
111        openssl mac -macopt custom:Tag -macopt hexkey:40414243444546 \
112                -macopt size:16 -in msg.bin KMAC128
113
114       To create a hex-encoded GMAC-AES-128-GCM with a IV from a file: \
115        openssl mac -cipher AES-128-GCM -macopt hexiv:E0E00F19FED7BA0136A797F3
116       \
117                -macopt hexkey:77A77FAF290C1FA30C683DF16BA7A77B -in msg.bin
118       GMAC
119

NOTES

121       The MAC mechanisms that are available will depend on the options used
122       when building OpenSSL.  Use "openssl list -mac-algorithms" to list
123       them.
124

SEE ALSO

126       openssl(1), EVP_MAC(3), EVP_MAC-CMAC(7), EVP_MAC-GMAC(7),
127       EVP_MAC-HMAC(7), EVP_MAC-KMAC(7), EVP_MAC-Siphash(7),
128       EVP_MAC-Poly1305(7)
129
131       Copyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved.
132
133       Licensed under the Apache License 2.0 (the "License").  You may not use
134       this file except in compliance with the License.  You can obtain a copy
135       in the file LICENSE in the source distribution or at
136       <https://www.openssl.org/source/license.html>.
137
138
139
1403.1.1                             2023-08-31                OPENSSL-MAC(1ossl)
Impressum