openssl-mac.pod.in 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. =pod
  2. {- OpenSSL::safe::output_do_not_edit_headers(); -}
  3. =head1 NAME
  4. openssl-mac - perform Message Authentication Code operations
  5. =head1 SYNOPSIS
  6. B<openssl mac>
  7. [B<-help>]
  8. [B<-cipher>]
  9. [B<-digest>]
  10. [B<-macopt>]
  11. [B<-in> I<filename>]
  12. [B<-out> I<filename>]
  13. [B<-binary>]
  14. {- $OpenSSL::safe::opt_provider_synopsis -}
  15. I<mac_name>
  16. =head1 DESCRIPTION
  17. The message authentication code functions output the MAC of a supplied input
  18. file.
  19. =head1 OPTIONS
  20. =over 4
  21. =item B<-help>
  22. Print a usage message.
  23. =item B<-in> I<filename>
  24. Input filename to calculate a MAC for, or standard input by default.
  25. Standard input is used if the filename is '-'.
  26. Files are expected to be in binary format, standard input uses hexadecimal text
  27. format.
  28. =item B<-out> I<filename>
  29. Filename to output to, or standard output by default.
  30. =item B<-binary>
  31. Output the MAC in binary form. Uses hexadecimal text format if not specified.
  32. =item B<-cipher> I<name>
  33. Used by CMAC and GMAC to specify the cipher algorithm.
  34. For CMAC it must be one of AES-128-CBC, AES-192-CBC, AES-256-CBC or
  35. DES-EDE3-CBC.
  36. For GMAC it should be a GCM mode cipher e.g. AES-128-GCM.
  37. =item B<-digest> I<name>
  38. Used by HMAC as an alphanumeric string (use if the key contains printable
  39. characters only).
  40. The string length must conform to any restrictions of the MAC algorithm.
  41. To see the list of supported digests, use C<openssl list -digest-commands>.
  42. =item B<-macopt> I<nm>:I<v>
  43. Passes options to the MAC algorithm.
  44. A comprehensive list of controls can be found in the EVP_MAC implementation
  45. documentation.
  46. Common parameter names used by EVP_MAC_CTX_get_params() are:
  47. =over 4
  48. =item B<key:>I<string>
  49. Specifies the MAC key as an alphanumeric string (use if the key contains
  50. printable characters only).
  51. The string length must conform to any restrictions of the MAC algorithm.
  52. A key must be specified for every MAC algorithm.
  53. =item B<hexkey:>I<string>
  54. Specifies the MAC key in hexadecimal form (two hex digits per byte).
  55. The key length must conform to any restrictions of the MAC algorithm.
  56. A key must be specified for every MAC algorithm.
  57. =item B<iv:>I<string>
  58. Used by GMAC to specify an IV as an alphanumeric string (use if the IV contains
  59. printable characters only).
  60. =item B<hexiv:>I<string>
  61. Used by GMAC to specify an IV in hexadecimal form (two hex digits per byte).
  62. =item B<size:>I<int>
  63. Used by KMAC128 or KMAC256 to specify an output length.
  64. The default sizes are 32 or 64 bytes respectively.
  65. =item B<custom:>I<string>
  66. Used by KMAC128 or KMAC256 to specify a customization string.
  67. The default is the empty string "".
  68. =item B<digest:>I<string>
  69. This option is identical to the B<-digest> option.
  70. =item B<cipher:>I<string>
  71. This option is identical to the B<-cipher> option.
  72. =back
  73. {- $OpenSSL::safe::opt_provider_item -}
  74. =item I<mac_name>
  75. Specifies the name of a supported MAC algorithm which will be used.
  76. To see the list of supported MAC's use the command C<opensssl list
  77. -mac-algorithms>.
  78. =back
  79. =head1 EXAMPLES
  80. To create a hex-encoded HMAC-SHA1 MAC of a file and write to stdout: \
  81. openssl mac -digest SHA1 \
  82. -macopt hexkey:000102030405060708090A0B0C0D0E0F10111213 \
  83. -in msg.bin HMAC
  84. To create a SipHash MAC from a file with a binary file output: \
  85. openssl mac -macopt hexkey:000102030405060708090A0B0C0D0E0F \
  86. -in msg.bin -out out.bin -binary SipHash
  87. To create a hex-encoded CMAC-AES-128-CBC MAC from a file:\
  88. openssl mac -cipher AES-128-CBC \
  89. -macopt hexkey:77A77FAF290C1FA30C683DF16BA7A77B \
  90. -in msg.bin CMAC
  91. To create a hex-encoded KMAC128 MAC from a file with a Customisation String
  92. 'Tag' and output length of 16: \
  93. openssl mac -macopt custom:Tag -macopt hexkey:40414243444546 \
  94. -macopt size:16 -in msg.bin KMAC128
  95. To create a hex-encoded GMAC-AES-128-GCM with a IV from a file: \
  96. openssl mac -cipher AES-128-GCM -macopt hexiv:E0E00F19FED7BA0136A797F3 \
  97. -macopt hexkey:77A77FAF290C1FA30C683DF16BA7A77B -in msg.bin GMAC
  98. =head1 NOTES
  99. The MAC mechanisms that are available will depend on the options
  100. used when building OpenSSL.
  101. Use C<openssl list -mac-algorithms> to list them.
  102. =head1 SEE ALSO
  103. L<openssl(1)>,
  104. L<EVP_MAC(3)>,
  105. L<EVP_MAC-CMAC(7)>,
  106. L<EVP_MAC-GMAC(7)>,
  107. L<EVP_MAC-HMAC(7)>,
  108. L<EVP_MAC-KMAC(7)>,
  109. L<EVP_MAC-Siphash(7)>,
  110. L<EVP_MAC-Poly1305(7)>
  111. =head1 COPYRIGHT
  112. Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.
  113. Licensed under the Apache License 2.0 (the "License"). You may not use
  114. this file except in compliance with the License. You can obtain a copy
  115. in the file LICENSE in the source distribution or at
  116. L<https://www.openssl.org/source/license.html>.
  117. =cut