EVP_PKEY_CHECK(3ossl)

πŸ“¦ version 3.5.0, in opensuse-leap 16.0

πŸ’… 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 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