Debian Codegraph @

upstream/debian-unstable/man1/openssl-mac.1ssl

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\" ========================================================================
56 .\"
57 .IX Title "OPENSSL-MAC 1SSL"
58 .TH OPENSSL-MAC 1SSL 2026-04-07 3.6.2 OpenSSL
59 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
60 .\" way too many mistakes in technical documents.
61 .if n .ad l
62 .nh
63 .SH NAME
64 openssl\-mac \- perform Message Authentication Code operations
65 .SH SYNOPSIS
66 .IX Header "SYNOPSIS"
67 \&\fBopenssl mac\fR
68 [\fB\-help\fR]
69 [\fB\-cipher\fR]
70 [\fB\-digest\fR]
71 [\fB\-macopt\fR]
72 [\fB\-in\fR \fIfilename\fR]
73 [\fB\-out\fR \fIfilename\fR]
74 [\fB\-binary\fR]
75 [\fB\-provider\fR \fIname\fR]
76 [\fB\-provider\-path\fR \fIpath\fR]
77 [\fB\-provparam\fR \fI[name:]key=value\fR]
78 [\fB\-propquery\fR \fIpropq\fR]
79 \&\fImac_name\fR
80 .SH DESCRIPTION
81 .IX Header "DESCRIPTION"
82 The message authentication code functions output the MAC of a supplied input
83 file.
84 .SH OPTIONS
85 .IX Header "OPTIONS"
86 .IP \fB\-help\fR 4
87 .IX Item "-help"
88 Print a usage message.
89 .IP "\fB\-in\fR \fIfilename\fR" 4
90 .IX Item "-in filename"
91 Input filename to calculate a MAC for, or standard input by default.
92 Standard input is used if the filename is '\-'.
93 Files and standard input are expected to be in binary format.
94 .IP "\fB\-out\fR \fIfilename\fR" 4
95 .IX Item "-out filename"
96 Filename to output to, or standard output by default.
97 .IP \fB\-binary\fR 4
98 .IX Item "-binary"
99 Output the MAC in binary form. Uses hexadecimal text format if not specified.
100 .IP "\fB\-cipher\fR \fIname\fR" 4
101 .IX Item "-cipher name"
102 Used by CMAC and GMAC to specify the cipher algorithm.
103 For CMAC it should be a CBC mode cipher e.g. AES\-128\-CBC.
104 For GMAC it should be a GCM mode cipher e.g. AES\-128\-GCM.
105 .IP "\fB\-digest\fR \fIname\fR" 4
106 .IX Item "-digest name"
107 Used by HMAC as an alphanumeric string (use if the key contains printable
108 characters only).
109 The string length must conform to any restrictions of the MAC algorithm.
110 To see the list of supported digests, use \f(CW\*(C`openssl list \-digest\-commands\*(C'\fR.
111 .IP "\fB\-macopt\fR \fInm\fR:\fIv\fR" 4
112 .IX Item "-macopt nm:v"
113 Passes options to the MAC algorithm.
114 A comprehensive list of controls can be found in the EVP_MAC implementation
115 documentation.
116 Common parameter names used by \fBEVP_MAC_CTX_get_params()\fR are:
117 .RS 4
118 .IP \fBkey:\fR\fIstring\fR 4
119 .IX Item "key:string"
120 Specifies the MAC key as an alphanumeric string (use if the key contains
121 printable characters only).
122 The string length must conform to any restrictions of the MAC algorithm.
123 A key must be specified for every MAC algorithm.
124 .IP \fBhexkey:\fR\fIstring\fR 4
125 .IX Item "hexkey:string"
126 Specifies the MAC key in hexadecimal form (two hex digits per byte).
127 The key length must conform to any restrictions of the MAC algorithm.
128 A key must be specified for every MAC algorithm.
129 .IP \fBiv:\fR\fIstring\fR 4
130 .IX Item "iv:string"
131 Used by GMAC to specify an IV as an alphanumeric string (use if the IV contains
132 printable characters only).
133 .IP \fBhexiv:\fR\fIstring\fR 4
134 .IX Item "hexiv:string"
135 Used by GMAC to specify an IV in hexadecimal form (two hex digits per byte).
136 .IP \fBsize:\fR\fIint\fR 4
137 .IX Item "size:int"
138 Used by KMAC128 or KMAC256 to specify an output length.
139 The default sizes are 32 or 64 bytes respectively.
140 .IP \fBcustom:\fR\fIstring\fR 4
141 .IX Item "custom:string"
142 Used by KMAC128 or KMAC256 to specify a customization string.
143 The default is the empty string "".
144 .IP \fBdigest:\fR\fIstring\fR 4
145 .IX Item "digest:string"
146 This option is identical to the \fB\-digest\fR option.
147 .IP \fBcipher:\fR\fIstring\fR 4
148 .IX Item "cipher:string"
149 This option is identical to the \fB\-cipher\fR option.
150 .RE
151 .RS 4
152 .RE
153 .IP "\fB\-provider\fR \fIname\fR" 4
154 .IX Item "-provider name"
155 .PD 0
156 .IP "\fB\-provider\-path\fR \fIpath\fR" 4
157 .IX Item "-provider-path path"
158 .IP "\fB\-provparam\fR \fI[name:]key=value\fR" 4
159 .IX Item "-provparam [name:]key=value"
160 .IP "\fB\-propquery\fR \fIpropq\fR" 4
161 .IX Item "-propquery propq"
162 .PD
163 See "Provider Options" in \fBopenssl\fR\|(1), \fBprovider\fR\|(7), and \fBproperty\fR\|(7).
164 .IP \fImac_name\fR 4
165 .IX Item "mac_name"
166 Specifies the name of a supported MAC algorithm which will be used.
167 To see the list of supported MAC's use the command \f(CW\*(C`openssl list
168 \&\-mac\-algorithms\*(C'\fR.
169 .SH EXAMPLES
170 .IX Header "EXAMPLES"
171 To create a hex-encoded HMAC\-SHA1 MAC of a file and write to stdout:
172 .PP
173 .Vb 3
174 \& openssl mac \-digest SHA1 \e
175 \& \-macopt hexkey:000102030405060708090A0B0C0D0E0F10111213 \e
176 \& \-in msg.bin HMAC
177 .Ve
178 .PP
179 To create a SipHash MAC from a file with a binary file output:
180 .PP
181 .Vb 2
182 \& openssl mac \-macopt hexkey:000102030405060708090A0B0C0D0E0F \e
183 \& \-in msg.bin \-out out.bin \-binary SipHash
184 .Ve
185 .PP
186 To create a hex-encoded CMAC\-AES\-128\-CBC MAC from a file:
187 .PP
188 .Vb 3
189 \& openssl mac \-cipher AES\-128\-CBC \e
190 \& \-macopt hexkey:77A77FAF290C1FA30C683DF16BA7A77B \e
191 \& \-in msg.bin CMAC
192 .Ve
193 .PP
194 To create a hex-encoded KMAC128 MAC from a file with a Customisation String
195 \&'Tag' and output length of 16:
196 .PP
197 .Vb 2
198 \& openssl mac \-macopt custom:Tag \-macopt hexkey:40414243444546 \e
199 \& \-macopt size:16 \-in msg.bin KMAC128
200 .Ve
201 .PP
202 To create a hex-encoded GMAC\-AES\-128\-GCM with a IV from a file:
203 .PP
204 .Vb 2
205 \& openssl mac \-cipher AES\-128\-GCM \-macopt hexiv:E0E00F19FED7BA0136A797F3 \e
206 \& \-macopt hexkey:77A77FAF290C1FA30C683DF16BA7A77B \-in msg.bin GMAC
207 .Ve
208 .SH NOTES
209 .IX Header "NOTES"
210 The MAC mechanisms that are available will depend on the options
211 used when building OpenSSL.
212 Use \f(CW\*(C`openssl list \-mac\-algorithms\*(C'\fR to list them.
213 .SH "SEE ALSO"
214 .IX Header "SEE ALSO"
215 \&\fBopenssl\fR\|(1),
216 \&\fBEVP_MAC\fR\|(3),
217 \&\fBEVP_MAC\-CMAC\fR\|(7),
218 \&\fBEVP_MAC\-GMAC\fR\|(7),
219 \&\fBEVP_MAC\-HMAC\fR\|(7),
220 \&\fBEVP_MAC\-KMAC\fR\|(7),
221 \&\fBEVP_MAC\-Siphash\fR\|(7),
222 \&\fBEVP_MAC\-Poly1305\fR\|(7)
223 .SH COPYRIGHT
224 .IX Header "COPYRIGHT"
225 Copyright 2018\-2024 The OpenSSL Project Authors. All Rights Reserved.
226 .PP
227 Licensed under the Apache License 2.0 (the "License"). You may not use
228 this file except in compliance with the License. You can obtain a copy
229 in the file LICENSE in the source distribution or at
230 <https://www.openssl.org/source/license.html>.