EVP_PKEY-HMAC(7ossl)

πŸ’– EVP_PKEY-HMAC, EVP_KEYMGMT-HMAC, EVP_PKEY-Siphash, EVP_KEYMGMT-Siphash, EVP_PKEY-Poly1305, EVP_KEYMGMT-Poly1305, EVP_PKEY-CMAC, EVP_KEYMGMT-CMAC πŸ’–

okay bestie, this is the 7ossl manual page and it's literally all about the EVP_PKEY legacy MAC keytypes and their algorithm support. pull up a chair, we're getting into it 🫢


🌸 NAME 🌸

EVP_PKEY-HMAC, EVP_KEYMGMT-HMAC, EVP_PKEY-Siphash, EVP_KEYMGMT-Siphash, EVP_PKEY-Poly1305, EVP_KEYMGMT-Poly1305, EVP_PKEY-CMAC, EVP_KEYMGMT-CMAC β€” the EVP_PKEY legacy MAC keytypes and their algorithm support, in one iconic little family ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the tea β˜•: the HMAC and CMAC key types are implemented in OpenSSL's default provider and its FIPS provider. And bonus β€” the Siphash and Poly1305 key types are implemented in the default provider too. Slay. πŸ’…

⚠️ But listen, bestie: performing MAC operations via an EVP_PKEY is considered legacy. It's only there for backwards compatibility purposes and for a restricted set of algorithms. No cap.

The preferred way of doing MAC operations is via the EVP_MAC APIs. Go look at EVP_MAC_init(3) β€” that's the main character now πŸ‘‘

For further details on using EVP_PKEY based MAC keys, check out EVP_SIGNATURE-HMAC(7), EVP_SIGNATURE-Siphash(7), EVP_SIGNATURE-Poly1305(7) or EVP_SIGNATURE-CMAC(7). iykyk 🌈

πŸ’œ Common MAC parameters

All the MAC keytypes support the following parameters, no exceptions, periodt:

  • "priv" (OSSL_PKEY_PARAM_PRIV_KEY) <octet string> β€” the MAC key value, aka the actual key itself πŸ”‘
  • "properties" (OSSL_PKEY_PARAM_PROPERTIES) <UTF8 string> β€” a property query string to be used when any algorithms are fetched πŸŽ€

πŸŽ€ CMAC parameters

As well as the parameters described above, the CMAC keytype additionally supports these babies:

  • "cipher" (OSSL_PKEY_PARAM_CIPHER) <UTF8 string> β€” the name of a cipher to be used when generating the MAC πŸ”₯
  • "engine" (OSSL_PKEY_PARAM_ENGINE) <UTF8 string> β€” the name of an engine to be used for the specified cipher (if any) βš™οΈ

🧚 Common MAC key generation parameters

Okay so MAC key generation is unusual β€” and the way that it's unusual is that no new key is actually generated. 😭 Instead, a new provider side key object is created with the supplied raw key value. Why? For backwards compatibility with previous versions of OpenSSL, of course. Classic.

  • "priv" (OSSL_PKEY_PARAM_PRIV_KEY) <octet string> β€” the MAC key value πŸ”‘

πŸ“ CMAC key generation parameters

In addition to the common MAC key generation parameters, CMAC key generation additionally recognises the following:

  • "cipher" (OSSL_PKEY_PARAM_CIPHER) <UTF8 string> β€” the name of a cipher to be used when generating the MAC πŸ”₯

πŸ‘‘ MAC key generation FIPS indicator

The following key generation parameter can be retrieved with EVP_PKEY_CTX_get_params(3) for HMAC and CMAC in the OpenSSL FIPS provider:

  • "fips-indicator" (OSSL_PKEY_PARAM_FIPS_APPROVED_INDICATOR) <integer> β€” returns 1 if the operation is FIPS approved, or 0 otherwise. See "FIPS indicators" in fips_module(7) for more info 🌟

⭐ SEE ALSO ⭐

EVP_KEYMGMT(3), EVP_PKEY(3), provider-keymgmt(7) β€” go read these next, bestie, they ate πŸ’…


Copyright 2020-2026 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>. πŸ“œ


and that's the whole page, bestie β€” this was version 3.5.9, dated 2026-09-29, and it's the EVP_PKEY-HMAC(7ossl) manual. mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from