openssl-mac.1ossl 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. .\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42)
  2. .\"
  3. .\" Standard preamble:
  4. .\" ========================================================================
  5. .de Sp \" Vertical space (when we can't use .PP)
  6. .if t .sp .5v
  7. .if n .sp
  8. ..
  9. .de Vb \" Begin verbatim text
  10. .ft CW
  11. .nf
  12. .ne \\$1
  13. ..
  14. .de Ve \" End verbatim text
  15. .ft R
  16. .fi
  17. ..
  18. .\" Set up some character translations and predefined strings. \*(-- will
  19. .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
  20. .\" double quote, and \*(R" will give a right double quote. \*(C+ will
  21. .\" give a nicer C++. Capital omega is used to do unbreakable dashes and
  22. .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
  23. .\" nothing in troff, for use with C<>.
  24. .tr \(*W-
  25. .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
  26. .ie n \{\
  27. . ds -- \(*W-
  28. . ds PI pi
  29. . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
  30. . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
  31. . ds L" ""
  32. . ds R" ""
  33. . ds C` ""
  34. . ds C' ""
  35. 'br\}
  36. .el\{\
  37. . ds -- \|\(em\|
  38. . ds PI \(*p
  39. . ds L" ``
  40. . ds R" ''
  41. . ds C`
  42. . ds C'
  43. 'br\}
  44. .\"
  45. .\" Escape single quotes in literal strings from groff's Unicode transform.
  46. .ie \n(.g .ds Aq \(aq
  47. .el .ds Aq '
  48. .\"
  49. .\" If the F register is >0, we'll generate index entries on stderr for
  50. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  51. .\" entries marked with X<> in POD. Of course, you'll have to process the
  52. .\" output yourself in some meaningful fashion.
  53. .\"
  54. .\" Avoid warning from groff about undefined register 'F'.
  55. .de IX
  56. ..
  57. .nr rF 0
  58. .if \n(.g .if rF .nr rF 1
  59. .if (\n(rF:(\n(.g==0)) \{\
  60. . if \nF \{\
  61. . de IX
  62. . tm Index:\\$1\t\\n%\t"\\$2"
  63. ..
  64. . if !\nF==2 \{\
  65. . nr % 0
  66. . nr F 2
  67. . \}
  68. . \}
  69. .\}
  70. .rr rF
  71. .\"
  72. .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
  73. .\" Fear. Run. Save yourself. No user-serviceable parts.
  74. . \" fudge factors for nroff and troff
  75. .if n \{\
  76. . ds #H 0
  77. . ds #V .8m
  78. . ds #F .3m
  79. . ds #[ \f1
  80. . ds #] \fP
  81. .\}
  82. .if t \{\
  83. . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
  84. . ds #V .6m
  85. . ds #F 0
  86. . ds #[ \&
  87. . ds #] \&
  88. .\}
  89. . \" simple accents for nroff and troff
  90. .if n \{\
  91. . ds ' \&
  92. . ds ` \&
  93. . ds ^ \&
  94. . ds , \&
  95. . ds ~ ~
  96. . ds /
  97. .\}
  98. .if t \{\
  99. . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
  100. . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
  101. . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
  102. . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
  103. . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
  104. . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
  105. .\}
  106. . \" troff and (daisy-wheel) nroff accents
  107. .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  108. .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  109. .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  110. .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  111. .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  112. .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  113. .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  114. .ds ae a\h'-(\w'a'u*4/10)'e
  115. .ds Ae A\h'-(\w'A'u*4/10)'E
  116. . \" corrections for vroff
  117. .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  118. .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  119. . \" for low resolution devices (crt and lpr)
  120. .if \n(.H>23 .if \n(.V>19 \
  121. \{\
  122. . ds : e
  123. . ds 8 ss
  124. . ds o a
  125. . ds d- d\h'-1'\(ga
  126. . ds D- D\h'-1'\(hy
  127. . ds th \o'bp'
  128. . ds Th \o'LP'
  129. . ds ae ae
  130. . ds Ae AE
  131. .\}
  132. .rm #[ #] #H #V #F C
  133. .\" ========================================================================
  134. .\"
  135. .IX Title "OPENSSL-MAC 1ossl"
  136. .TH OPENSSL-MAC 1ossl "2025-06-29" "3.3.2" "OpenSSL"
  137. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  138. .\" way too many mistakes in technical documents.
  139. .if n .ad l
  140. .nh
  141. .SH "NAME"
  142. openssl\-mac \- perform Message Authentication Code operations
  143. .SH "SYNOPSIS"
  144. .IX Header "SYNOPSIS"
  145. \&\fBopenssl mac\fR
  146. [\fB\-help\fR]
  147. [\fB\-cipher\fR]
  148. [\fB\-digest\fR]
  149. [\fB\-macopt\fR]
  150. [\fB\-in\fR \fIfilename\fR]
  151. [\fB\-out\fR \fIfilename\fR]
  152. [\fB\-binary\fR]
  153. [\fB\-provider\fR \fIname\fR]
  154. [\fB\-provider\-path\fR \fIpath\fR]
  155. [\fB\-propquery\fR \fIpropq\fR]
  156. \&\fImac_name\fR
  157. .SH "DESCRIPTION"
  158. .IX Header "DESCRIPTION"
  159. The message authentication code functions output the \s-1MAC\s0 of a supplied input
  160. file.
  161. .SH "OPTIONS"
  162. .IX Header "OPTIONS"
  163. .IP "\fB\-help\fR" 4
  164. .IX Item "-help"
  165. Print a usage message.
  166. .IP "\fB\-in\fR \fIfilename\fR" 4
  167. .IX Item "-in filename"
  168. Input filename to calculate a \s-1MAC\s0 for, or standard input by default.
  169. Standard input is used if the filename is '\-'.
  170. Files and standard input are expected to be in binary format.
  171. .IP "\fB\-out\fR \fIfilename\fR" 4
  172. .IX Item "-out filename"
  173. Filename to output to, or standard output by default.
  174. .IP "\fB\-binary\fR" 4
  175. .IX Item "-binary"
  176. Output the \s-1MAC\s0 in binary form. Uses hexadecimal text format if not specified.
  177. .IP "\fB\-cipher\fR \fIname\fR" 4
  178. .IX Item "-cipher name"
  179. Used by \s-1CMAC\s0 and \s-1GMAC\s0 to specify the cipher algorithm.
  180. For \s-1CMAC\s0 it should be a \s-1CBC\s0 mode cipher e.g. \s-1AES\-128\-CBC.\s0
  181. For \s-1GMAC\s0 it should be a \s-1GCM\s0 mode cipher e.g. \s-1AES\-128\-GCM.\s0
  182. .IP "\fB\-digest\fR \fIname\fR" 4
  183. .IX Item "-digest name"
  184. Used by \s-1HMAC\s0 as an alphanumeric string (use if the key contains printable
  185. characters only).
  186. The string length must conform to any restrictions of the \s-1MAC\s0 algorithm.
  187. To see the list of supported digests, use \f(CW\*(C`openssl list \-digest\-commands\*(C'\fR.
  188. .IP "\fB\-macopt\fR \fInm\fR:\fIv\fR" 4
  189. .IX Item "-macopt nm:v"
  190. Passes options to the \s-1MAC\s0 algorithm.
  191. A comprehensive list of controls can be found in the \s-1EVP_MAC\s0 implementation
  192. documentation.
  193. Common parameter names used by \fBEVP_MAC_CTX_get_params()\fR are:
  194. .RS 4
  195. .IP "\fBkey:\fR\fIstring\fR" 4
  196. .IX Item "key:string"
  197. Specifies the \s-1MAC\s0 key as an alphanumeric string (use if the key contains
  198. printable characters only).
  199. The string length must conform to any restrictions of the \s-1MAC\s0 algorithm.
  200. A key must be specified for every \s-1MAC\s0 algorithm.
  201. .IP "\fBhexkey:\fR\fIstring\fR" 4
  202. .IX Item "hexkey:string"
  203. Specifies the \s-1MAC\s0 key in hexadecimal form (two hex digits per byte).
  204. The key length must conform to any restrictions of the \s-1MAC\s0 algorithm.
  205. A key must be specified for every \s-1MAC\s0 algorithm.
  206. .IP "\fBiv:\fR\fIstring\fR" 4
  207. .IX Item "iv:string"
  208. Used by \s-1GMAC\s0 to specify an \s-1IV\s0 as an alphanumeric string (use if the \s-1IV\s0 contains
  209. printable characters only).
  210. .IP "\fBhexiv:\fR\fIstring\fR" 4
  211. .IX Item "hexiv:string"
  212. Used by \s-1GMAC\s0 to specify an \s-1IV\s0 in hexadecimal form (two hex digits per byte).
  213. .IP "\fBsize:\fR\fIint\fR" 4
  214. .IX Item "size:int"
  215. Used by \s-1KMAC128\s0 or \s-1KMAC256\s0 to specify an output length.
  216. The default sizes are 32 or 64 bytes respectively.
  217. .IP "\fBcustom:\fR\fIstring\fR" 4
  218. .IX Item "custom:string"
  219. Used by \s-1KMAC128\s0 or \s-1KMAC256\s0 to specify a customization string.
  220. The default is the empty string "".
  221. .IP "\fBdigest:\fR\fIstring\fR" 4
  222. .IX Item "digest:string"
  223. This option is identical to the \fB\-digest\fR option.
  224. .IP "\fBcipher:\fR\fIstring\fR" 4
  225. .IX Item "cipher:string"
  226. This option is identical to the \fB\-cipher\fR option.
  227. .RE
  228. .RS 4
  229. .RE
  230. .IP "\fB\-provider\fR \fIname\fR" 4
  231. .IX Item "-provider name"
  232. .PD 0
  233. .IP "\fB\-provider\-path\fR \fIpath\fR" 4
  234. .IX Item "-provider-path path"
  235. .IP "\fB\-propquery\fR \fIpropq\fR" 4
  236. .IX Item "-propquery propq"
  237. .PD
  238. See \*(L"Provider Options\*(R" in \fBopenssl\fR\|(1), \fBprovider\fR\|(7), and \fBproperty\fR\|(7).
  239. .IP "\fImac_name\fR" 4
  240. .IX Item "mac_name"
  241. Specifies the name of a supported \s-1MAC\s0 algorithm which will be used.
  242. To see the list of supported \s-1MAC\s0's use the command \f(CW\*(C`openssl list
  243. \&\-mac\-algorithms\*(C'\fR.
  244. .SH "EXAMPLES"
  245. .IX Header "EXAMPLES"
  246. To create a hex-encoded \s-1HMAC\-SHA1 MAC\s0 of a file and write to stdout:
  247. .PP
  248. .Vb 3
  249. \& openssl mac \-digest SHA1 \e
  250. \& \-macopt hexkey:000102030405060708090A0B0C0D0E0F10111213 \e
  251. \& \-in msg.bin HMAC
  252. .Ve
  253. .PP
  254. To create a SipHash \s-1MAC\s0 from a file with a binary file output:
  255. .PP
  256. .Vb 2
  257. \& openssl mac \-macopt hexkey:000102030405060708090A0B0C0D0E0F \e
  258. \& \-in msg.bin \-out out.bin \-binary SipHash
  259. .Ve
  260. .PP
  261. To create a hex-encoded \s-1CMAC\-AES\-128\-CBC MAC\s0 from a file:
  262. .PP
  263. .Vb 3
  264. \& openssl mac \-cipher AES\-128\-CBC \e
  265. \& \-macopt hexkey:77A77FAF290C1FA30C683DF16BA7A77B \e
  266. \& \-in msg.bin CMAC
  267. .Ve
  268. .PP
  269. To create a hex-encoded \s-1KMAC128 MAC\s0 from a file with a Customisation String
  270. \&'Tag' and output length of 16:
  271. .PP
  272. .Vb 2
  273. \& openssl mac \-macopt custom:Tag \-macopt hexkey:40414243444546 \e
  274. \& \-macopt size:16 \-in msg.bin KMAC128
  275. .Ve
  276. .PP
  277. To create a hex-encoded \s-1GMAC\-AES\-128\-GCM\s0 with a \s-1IV\s0 from a file:
  278. .PP
  279. .Vb 2
  280. \& openssl mac \-cipher AES\-128\-GCM \-macopt hexiv:E0E00F19FED7BA0136A797F3 \e
  281. \& \-macopt hexkey:77A77FAF290C1FA30C683DF16BA7A77B \-in msg.bin GMAC
  282. .Ve
  283. .SH "NOTES"
  284. .IX Header "NOTES"
  285. The \s-1MAC\s0 mechanisms that are available will depend on the options
  286. used when building OpenSSL.
  287. Use \f(CW\*(C`openssl list \-mac\-algorithms\*(C'\fR to list them.
  288. .SH "SEE ALSO"
  289. .IX Header "SEE ALSO"
  290. \&\fBopenssl\fR\|(1),
  291. \&\s-1\fBEVP_MAC\s0\fR\|(3),
  292. \&\s-1\fBEVP_MAC\-CMAC\s0\fR\|(7),
  293. \&\s-1\fBEVP_MAC\-GMAC\s0\fR\|(7),
  294. \&\s-1\fBEVP_MAC\-HMAC\s0\fR\|(7),
  295. \&\s-1\fBEVP_MAC\-KMAC\s0\fR\|(7),
  296. \&\fBEVP_MAC\-Siphash\fR\|(7),
  297. \&\fBEVP_MAC\-Poly1305\fR\|(7)
  298. .SH "COPYRIGHT"
  299. .IX Header "COPYRIGHT"
  300. Copyright 2018\-2024 The OpenSSL Project Authors. All Rights Reserved.
  301. .PP
  302. Licensed under the Apache License 2.0 (the \*(L"License\*(R"). You may not use
  303. this file except in compliance with the License. You can obtain a copy
  304. in the file \s-1LICENSE\s0 in the source distribution or at
  305. <https://www.openssl.org/source/license.html>.