openssl-mac.pod.in 4.4 KB

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