EVP_PKEY_CHECK(3ossl)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1

πŸ’– EVP_PKEY_CHECK πŸ’– (3ossl)

Okay so bestie, welcome to the OpenSSL manual page for the key-and-parameter vibe check squad ✨ β€” this is the EVP_PKEY_CHECK family, living over in the 3ossl section of the manual. Buckle up, we're validating keys today πŸŽ€


🌸 NAME 🌸

EVP_PKEY_check, EVP_PKEY_param_check, EVP_PKEY_param_check_quick, EVP_PKEY_public_check, EVP_PKEY_public_check_quick, EVP_PKEY_private_check, EVP_PKEY_pairwise_check β€” these are the key and parameter validation functions, i.e. the friend group that makes sure your key isn't lying about who it is πŸ’…


✨ SYNOPSIS ✨

#include <openssl/evp.h>

int EVP_PKEY_check(EVP_PKEY_CTX *ctx);
int EVP_PKEY_param_check(EVP_PKEY_CTX *ctx);
int EVP_PKEY_param_check_quick(EVP_PKEY_CTX *ctx);
int EVP_PKEY_public_check(EVP_PKEY_CTX *ctx);
int EVP_PKEY_public_check_quick(EVP_PKEY_CTX *ctx);
int EVP_PKEY_private_check(EVP_PKEY_CTX *ctx);
int EVP_PKEY_pairwise_check(EVP_PKEY_CTX *ctx);

πŸ¦‹ DESCRIPTION πŸ¦‹

EVP_PKEY_param_check() validates the parameters component of the key given by ctx. And here's the cute part: for key types that literally don't have parameters, this check will always succeed 🫢 (nothing to check, nothing to worry about, slay).

EVP_PKEY_param_check_quick() validates the parameters component of the key given by ctx β€” same deal as EVP_PKEY_param_check() does. However, some algorithm implementations may offer a quicker form of validation that omits some checks, so it's basically a lightweight sanity check of the key 🧚 If a quicker form is not provided, then this function call does the exact same thing as EVP_PKEY_param_check().

EVP_PKEY_public_check() validates the public component of the key given by ctx.

EVP_PKEY_public_check_quick() validates the public component of the key given by ctx like EVP_PKEY_public_check() does. But again β€” some algorithm implementations may offer a quicker form of validation that omits some checks, purely for a lightweight sanity check of the key πŸ’« If a quicker form isn't provided, this call does the same thing as EVP_PKEY_public_check().

EVP_PKEY_private_check() validates the private component of the key given by ctx. 🀫

EVP_PKEY_pairwise_check() validates that the public and private components have the correct mathematical relationship to each other for the key given by ctx β€” like, do these two actually belong together or is this a situationship πŸ˜­πŸ’€

EVP_PKEY_check() is an alias for the EVP_PKEY_pairwise_check() function. Periodt.


πŸ”₯ NOTES πŸ”₯

Key validation used by the OpenSSL FIPS provider complies with the rules within SP800-56A and SP800-56B πŸ‘‘ For backwards compatibility reasons, the OpenSSL default provider may use checks that are not as restrictive for certain key types. For further info, go peek at "DSA key validation" in EVP_PKEY-DSA(7), "DH key validation" in EVP_PKEY-DH(7), "EC key validation" in EVP_PKEY-EC(7) and "RSA key validation" in EVP_PKEY-RSA(7) πŸ“š

Refer to SP800-56A and SP800-56B for the rules relating to when these functions should be called during key establishment. And ngl, it is not necessary to call these functions after locally calling an approved key generation method β€” but they may be required for assurance purposes when receiving keys from a third party 🫑 (stranger danger, basically).

⚠️ Heads up bestie: EVP_PKEY_pairwise_check() and EVP_PKEY_private_check() might not be bounded by any key size limits, because private keys are not expected to be supplied by attackers. For that reason they might take an unbounded time if run on arbitrarily large keys 😭⏳ So don't just yeet a giant key at them and expect it back instantly.

πŸ’œ RETURN VALUES πŸ’œ

All functions return 1 for success, or others for failure. They return -2 if the operation is not supported for the specific algorithm 🫠


⭐ SEE ALSO ⭐

EVP_PKEY_CTX_new(3), EVP_PKEY_fromdata(3), EVP_PKEY-DH(7), EVP_PKEY-FFC(7), EVP_PKEY-DSA(7), EVP_PKEY-EC(7), EVP_PKEY-RSA(7)


πŸŽ€ HISTORY πŸŽ€

  • EVP_PKEY_check(), EVP_PKEY_public_check() and EVP_PKEY_param_check() were added in OpenSSL 1.1.1 ✨
  • EVP_PKEY_param_check_quick(), EVP_PKEY_public_check_quick(), EVP_PKEY_private_check() and EVP_PKEY_pairwise_check() were added in OpenSSL 3.0 πŸ¦‹

Copyright 2006-2024 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 iconic lil' manpage is from OpenSSL 3.5.6, dated 2026-04-07 β€” go validate those keys, no cap πŸ«ΆπŸ’–

πŸ“¦ where this page comes from