EVP_PKEY_CHECK(3ossl)
π 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()andEVP_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()andEVP_PKEY_param_check()were added in OpenSSL 1.1.1 β¨EVP_PKEY_param_check_quick(),EVP_PKEY_public_check_quick(),EVP_PKEY_private_check()andEVP_PKEY_pairwise_check()were added in OpenSSL 3.0 π¦
π COPYRIGHT π
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
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms