EVP_PKEY_CHECK(3ossl)
π EVP_PKEY_CHECK π
okay so this is a page from the OpenSSL manual (yes, that OpenSSL), and it's all about the key and parameter validation girlies. like, the functions that go "hmm bestie, is this key actually valid or are you lying to me" π΅οΈββοΈβ¨
β¨ 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 β key and parameter validation functions π
πΈ 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 π¦
so, quick vibe check on each one, no cap:
EVP_PKEY_param_check() validates the parameters component of the key given by ctx. and the iconique part? this check will always succeed for key types that don't have parameters. like, nothing to check, nothing to worry about, slay π
EVP_PKEY_param_check_quick() validates the parameters component of the key given by ctx the same way EVP_PKEY_param_check() does. but β plot twist β some algorithm implementations may offer a quicker form of validation that omits some checks, just to do a lightweight sanity check of the key. and if a quicker form isn't provided? then this function call does the exact same thing as EVP_PKEY_param_check(). no drama, no difference π«Ά
EVP_PKEY_public_check() validates the public component of the key given by ctx. main character energy, obviously.
EVP_PKEY_public_check_quick() validates the public component of the key given by ctx like EVP_PKEY_public_check() does. and again, some algorithm implementations may offer a quicker form of validation that omits some checks so you get a lightweight sanity check of the key. if a quicker form isn't provided, this function call does the same thing as EVP_PKEY_public_check(). same energy, possibly less work β‘
EVP_PKEY_private_check() validates the private component of the key given by ctx. keep that private, bestie π
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. it's giving "are you two actually dating or is this a situationship" ππ
EVP_PKEY_check() is literally 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. but for backwards compatibility reasons, the OpenSSL default provider may use checks that are not as restrictive for certain key types. for further information see "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 rules relating to when these functions should be called during key establishment. and here's the tea: 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. iykyk π€
also, fair warning 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. like, they will sit there and take forever and you will simply have to wait β³π
β 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. so check your return values, bestie, don't just assume it ate π₯
π 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. (an era β¨)
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. (the glow-up π¦)
π 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 was OpenSSL 3.5.0, dated 2026-09-25 β go forth and validate those keys, mwah ππ
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms