{
    "content": [
        {
            "type": "text",
            "text": "# OPENSSL-MAC (man)\n\n## NAME\n\nopenssl-mac - perform Message Authentication Code operations\n\n## SYNOPSIS\n\nopenssl mac [-help] [-cipher] [-digest] [-macopt] [-in filename] [-out filename] [-binary]\n[-provider name] [-provider-path path] [-propquery propq] macname\n\n## DESCRIPTION\n\nThe message authentication code functions output the MAC of a supplied input file.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (10 subsections)\n- **EXAMPLES**\n- **NOTES**\n- **SEE ALSO**\n- **COPYRIGHT**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "OPENSSL-MAC",
        "section": "",
        "mode": "man",
        "summary": "openssl-mac - perform Message Authentication Code operations",
        "synopsis": "openssl mac [-help] [-cipher] [-digest] [-macopt] [-in filename] [-out filename] [-binary]\n[-provider name] [-provider-path path] [-propquery propq] macname",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Print a usage message."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Input filename to calculate a MAC for, or standard input by default. Standard input is used if the filename is '-'. Files and standard input are expected to be in binary format."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Filename to output to, or standard output by default."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Output the MAC in binary form. Uses hexadecimal text format if not specified."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Used by CMAC and GMAC to specify the cipher algorithm. For CMAC it must be one of AES-128-CBC, AES-192-CBC, AES-256-CBC or DES-EDE3-CBC. For GMAC it should be a GCM mode cipher e.g. AES-128-GCM."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Used by HMAC as an alphanumeric string (use if the key contains printable characters only). The string length must conform to any restrictions of the MAC algorithm. To see the list of supported digests, use \"openssl list -digest-commands\"."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Passes options to the MAC algorithm. A comprehensive list of controls can be found in the EVPMAC implementation documentation. Common parameter names used by EVPMACCTXgetparams() are: key:string Specifies the MAC key as an alphanumeric string (use if the key contains printable characters only). The string length must conform to any restrictions of the MAC algorithm. A key must be specified for every MAC algorithm. hexkey:string Specifies the MAC key in hexadecimal form (two hex digits per byte). The key length must conform to any restrictions of the MAC algorithm. A key must be specified for every MAC algorithm. iv:string Used by GMAC to specify an IV as an alphanumeric string (use if the IV contains printable characters only). hexiv:string Used by GMAC to specify an IV in hexadecimal form (two hex digits per byte). size:int Used by KMAC128 or KMAC256 to specify an output length. The default sizes are 32 or 64 bytes respectively. custom:string Used by KMAC128 or KMAC256 to specify a customization string. The default is the empty string \"\". digest:string This option is identical to the -digest option. cipher:string This option is identical to the -cipher option."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "See \"Provider Options\" in openssl(1), provider(7), and property(7). macname Specifies the name of a supported MAC algorithm which will be used. To see the list of supported MAC's use the command \"openssl list -mac-algorithms\"."
            }
        ],
        "examples": [
            "To create a hex-encoded HMAC-SHA1 MAC of a file and write to stdout: \\",
            "openssl mac -digest SHA1 \\",
            "-macopt hexkey:000102030405060708090A0B0C0D0E0F10111213 \\",
            "-in msg.bin HMAC",
            "To create a SipHash MAC from a file with a binary file output: \\",
            "openssl mac -macopt hexkey:000102030405060708090A0B0C0D0E0F \\",
            "-in msg.bin -out out.bin -binary SipHash",
            "To create a hex-encoded CMAC-AES-128-CBC MAC from a file:\\",
            "openssl mac -cipher AES-128-CBC \\",
            "-macopt hexkey:77A77FAF290C1FA30C683DF16BA7A77B \\",
            "-in msg.bin CMAC",
            "To  create a hex-encoded KMAC128 MAC from a file with a Customisation String 'Tag' and output",
            "length of 16: \\",
            "openssl mac -macopt custom:Tag -macopt hexkey:40414243444546 \\",
            "-macopt size:16 -in msg.bin KMAC128",
            "To create a hex-encoded GMAC-AES-128-GCM with a IV from a file: \\",
            "openssl mac -cipher AES-128-GCM -macopt hexiv:E0E00F19FED7BA0136A797F3 \\",
            "-macopt hexkey:77A77FAF290C1FA30C683DF16BA7A77B -in msg.bin GMAC"
        ],
        "see_also": [
            {
                "name": "openssl",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/openssl/1/json"
            },
            {
                "name": "EVPMAC",
                "section": "3",
                "url": "https://www.chedong.com/phpMan.php/man/EVPMAC/3/json"
            },
            {
                "name": "EVPMAC-CMAC",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/EVPMAC-CMAC/7/json"
            },
            {
                "name": "EVPMAC-GMAC",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/EVPMAC-GMAC/7/json"
            },
            {
                "name": "EVPMAC-HMAC",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/EVPMAC-HMAC/7/json"
            },
            {
                "name": "EVPMAC-KMAC",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/EVPMAC-KMAC/7/json"
            },
            {
                "name": "EVPMAC-Siphash",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/EVPMAC-Siphash/7/json"
            },
            {
                "name": "EVPMAC-Poly1305",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/EVPMAC-Poly1305/7/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-help",
                        "lines": 2
                    },
                    {
                        "name": "-in _",
                        "lines": 4
                    },
                    {
                        "name": "-out _",
                        "lines": 2
                    },
                    {
                        "name": "-binary",
                        "lines": 2
                    },
                    {
                        "name": "-cipher _",
                        "lines": 4
                    },
                    {
                        "name": "-digest _",
                        "lines": 4
                    },
                    {
                        "name": "-macopt _",
                        "lines": 35
                    },
                    {
                        "name": "-provider _",
                        "lines": 1
                    },
                    {
                        "name": "-provider-path _",
                        "lines": 1
                    },
                    {
                        "name": "-propquery _",
                        "lines": 6
                    }
                ]
            },
            {
                "name": "EXAMPLES",
                "lines": 23,
                "subsections": []
            },
            {
                "name": "NOTES",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 7,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "openssl-mac - perform Message Authentication Code operations\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "openssl mac [-help] [-cipher] [-digest] [-macopt] [-in filename] [-out filename] [-binary]\n[-provider name] [-provider-path path] [-propquery propq] macname\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "The message authentication code functions output the MAC of a supplied input file.\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-help",
                        "content": "Print a usage message.\n"
                    },
                    {
                        "name": "-in _",
                        "content": "Input  filename  to calculate a MAC for, or standard input by default.  Standard input is\nused if the filename is '-'.  Files and standard input  are  expected  to  be  in  binary\nformat.\n"
                    },
                    {
                        "name": "-out _",
                        "content": "Filename to output to, or standard output by default.\n"
                    },
                    {
                        "name": "-binary",
                        "content": "Output the MAC in binary form. Uses hexadecimal text format if not specified.\n"
                    },
                    {
                        "name": "-cipher _",
                        "content": "Used  by  CMAC  and  GMAC  to  specify  the cipher algorithm.  For CMAC it must be one of\nAES-128-CBC, AES-192-CBC, AES-256-CBC or DES-EDE3-CBC.  For GMAC it should be a GCM  mode\ncipher e.g. AES-128-GCM.\n"
                    },
                    {
                        "name": "-digest _",
                        "content": "Used  by  HMAC  as  an  alphanumeric string (use if the key contains printable characters\nonly).  The string length must conform to any restrictions of the MAC algorithm.  To  see\nthe list of supported digests, use \"openssl list -digest-commands\".\n"
                    },
                    {
                        "name": "-macopt _",
                        "content": "Passes  options  to  the MAC algorithm.  A comprehensive list of controls can be found in\nthe   EVPMAC   implementation   documentation.    Common   parameter   names   used   by\nEVPMACCTXgetparams() are:\n\nkey:string\nSpecifies  the  MAC  key as an alphanumeric string (use if the key contains printable\ncharacters only).  The string length must conform to  any  restrictions  of  the  MAC\nalgorithm.  A key must be specified for every MAC algorithm.\n\nhexkey:string\nSpecifies  the MAC key in hexadecimal form (two hex digits per byte).  The key length\nmust conform to any restrictions of the MAC algorithm.  A key must be  specified  for\nevery MAC algorithm.\n\niv:string\nUsed  by  GMAC  to  specify  an  IV as an alphanumeric string (use if the IV contains\nprintable characters only).\n\nhexiv:string\nUsed by GMAC to specify an IV in hexadecimal form (two hex digits per byte).\n\nsize:int\nUsed by KMAC128 or KMAC256 to specify an output length.  The default sizes are 32  or\n64 bytes respectively.\n\ncustom:string\nUsed  by  KMAC128  or  KMAC256 to specify a customization string.  The default is the\nempty string \"\".\n\ndigest:string\nThis option is identical to the -digest option.\n\ncipher:string\nThis option is identical to the -cipher option.\n"
                    },
                    {
                        "name": "-provider _",
                        "content": ""
                    },
                    {
                        "name": "-provider-path _",
                        "content": ""
                    },
                    {
                        "name": "-propquery _",
                        "content": "See \"Provider Options\" in openssl(1), provider(7), and property(7).\n\nmacname\nSpecifies the name of a supported MAC algorithm which will be used.  To see the  list  of\nsupported MAC's use the command \"openssl list -mac-algorithms\".\n"
                    }
                ]
            },
            "EXAMPLES": {
                "content": "To create a hex-encoded HMAC-SHA1 MAC of a file and write to stdout: \\\nopenssl mac -digest SHA1 \\\n-macopt hexkey:000102030405060708090A0B0C0D0E0F10111213 \\\n-in msg.bin HMAC\n\nTo create a SipHash MAC from a file with a binary file output: \\\nopenssl mac -macopt hexkey:000102030405060708090A0B0C0D0E0F \\\n-in msg.bin -out out.bin -binary SipHash\n\nTo create a hex-encoded CMAC-AES-128-CBC MAC from a file:\\\nopenssl mac -cipher AES-128-CBC \\\n-macopt hexkey:77A77FAF290C1FA30C683DF16BA7A77B \\\n-in msg.bin CMAC\n\nTo  create a hex-encoded KMAC128 MAC from a file with a Customisation String 'Tag' and output\nlength of 16: \\\nopenssl mac -macopt custom:Tag -macopt hexkey:40414243444546 \\\n-macopt size:16 -in msg.bin KMAC128\n\nTo create a hex-encoded GMAC-AES-128-GCM with a IV from a file: \\\nopenssl mac -cipher AES-128-GCM -macopt hexiv:E0E00F19FED7BA0136A797F3 \\\n-macopt hexkey:77A77FAF290C1FA30C683DF16BA7A77B -in msg.bin GMAC\n",
                "subsections": []
            },
            "NOTES": {
                "content": "The MAC mechanisms that are available will depend on the options used when building  OpenSSL.\nUse \"openssl list -mac-algorithms\" to list them.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "openssl(1),  EVPMAC(3),  EVPMAC-CMAC(7), EVPMAC-GMAC(7), EVPMAC-HMAC(7), EVPMAC-KMAC(7),\nEVPMAC-Siphash(7), EVPMAC-Poly1305(7)\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved.\n\nLicensed under the Apache License 2.0 (the \"License\").  You may not use this file  except  in\ncompliance  with  the  License.   You  can  obtain  a  copy in the file LICENSE in the source\ndistribution or at <https://www.openssl.org/source/license.html>.\n\n3.0.13                                       2026-07-29                            OPENSSL-MAC(1SSL)",
                "subsections": []
            }
        }
    }
}