xref: /freebsd/crypto/openssl/doc/man3/EVP_PKEY_check.pod (revision 44096ebd22ddd0081a357011714eff8963614b65)
1b077aed3SPierre Pronchery=pod
2b077aed3SPierre Pronchery
3b077aed3SPierre Pronchery=head1 NAME
4b077aed3SPierre Pronchery
5b077aed3SPierre ProncheryEVP_PKEY_check, EVP_PKEY_param_check, EVP_PKEY_param_check_quick,
6b077aed3SPierre ProncheryEVP_PKEY_public_check, EVP_PKEY_public_check_quick, EVP_PKEY_private_check,
7b077aed3SPierre ProncheryEVP_PKEY_pairwise_check
8b077aed3SPierre Pronchery- key and parameter validation functions
9b077aed3SPierre Pronchery
10b077aed3SPierre Pronchery=head1 SYNOPSIS
11b077aed3SPierre Pronchery
12b077aed3SPierre Pronchery #include <openssl/evp.h>
13b077aed3SPierre Pronchery
14b077aed3SPierre Pronchery int EVP_PKEY_check(EVP_PKEY_CTX *ctx);
15b077aed3SPierre Pronchery int EVP_PKEY_param_check(EVP_PKEY_CTX *ctx);
16b077aed3SPierre Pronchery int EVP_PKEY_param_check_quick(EVP_PKEY_CTX *ctx);
17b077aed3SPierre Pronchery int EVP_PKEY_public_check(EVP_PKEY_CTX *ctx);
18b077aed3SPierre Pronchery int EVP_PKEY_public_check_quick(EVP_PKEY_CTX *ctx);
19b077aed3SPierre Pronchery int EVP_PKEY_private_check(EVP_PKEY_CTX *ctx);
20b077aed3SPierre Pronchery int EVP_PKEY_pairwise_check(EVP_PKEY_CTX *ctx);
21b077aed3SPierre Pronchery
22b077aed3SPierre Pronchery=head1 DESCRIPTION
23b077aed3SPierre Pronchery
24b077aed3SPierre ProncheryEVP_PKEY_param_check() validates the parameters component of the key
25b077aed3SPierre Proncherygiven by B<ctx>. This check will always succeed for key types that do not have
26b077aed3SPierre Proncheryparameters.
27b077aed3SPierre Pronchery
28b077aed3SPierre ProncheryEVP_PKEY_param_check_quick() validates the parameters component of the key
29b077aed3SPierre Proncherygiven by B<ctx> like EVP_PKEY_param_check() does. However some algorithm
30b077aed3SPierre Proncheryimplementations may offer a quicker form of validation that omits some checks in
31b077aed3SPierre Proncheryorder to perform a lightweight sanity check of the key. If a quicker form is not
32b077aed3SPierre Proncheryprovided then this function call does the same thing as EVP_PKEY_param_check().
33b077aed3SPierre Pronchery
34b077aed3SPierre ProncheryEVP_PKEY_public_check() validates the public component of the key given by B<ctx>.
35b077aed3SPierre Pronchery
36b077aed3SPierre ProncheryEVP_PKEY_public_check_quick() validates the public component of the key
37b077aed3SPierre Proncherygiven by B<ctx> like EVP_PKEY_public_check() does. However some algorithm
38b077aed3SPierre Proncheryimplementations may offer a quicker form of validation that omits some checks in
39b077aed3SPierre Proncheryorder to perform a lightweight sanity check of the key. If a quicker form is not
40b077aed3SPierre Proncheryprovided then this function call does the same thing as EVP_PKEY_public_check().
41b077aed3SPierre Pronchery
42b077aed3SPierre ProncheryEVP_PKEY_private_check() validates the private component of the key given by B<ctx>.
43b077aed3SPierre Pronchery
44b077aed3SPierre ProncheryEVP_PKEY_pairwise_check() validates that the public and private components have
45b077aed3SPierre Proncherythe correct mathematical relationship to each other for the key given by B<ctx>.
46b077aed3SPierre Pronchery
47b077aed3SPierre ProncheryEVP_PKEY_check() is an alias for the EVP_PKEY_pairwise_check() function.
48b077aed3SPierre Pronchery
49b077aed3SPierre Pronchery=head1 NOTES
50b077aed3SPierre Pronchery
51b077aed3SPierre ProncheryKey validation used by the OpenSSL FIPS provider complies with the rules
52b077aed3SPierre Proncherywithin SP800-56A and SP800-56B. For backwards compatibility reasons the OpenSSL
53b077aed3SPierre Proncherydefault provider may use checks that are not as restrictive for certain key types.
54b077aed3SPierre ProncheryFor further information see L<EVP_PKEY-DSA(7)/DSA key validation>,
55b077aed3SPierre ProncheryL<EVP_PKEY-DH(7)/DH key validation>, L<EVP_PKEY-EC(7)/EC key validation> and
56b077aed3SPierre ProncheryL<EVP_PKEY-RSA(7)/RSA key validation>.
57b077aed3SPierre Pronchery
58b077aed3SPierre ProncheryRefer to SP800-56A and SP800-56B for rules relating to when these functions
59b077aed3SPierre Proncheryshould be called during key establishment.
60b077aed3SPierre ProncheryIt is not necessary to call these functions after locally calling an approved key
61b077aed3SPierre Proncherygeneration method, but may be required for assurance purposes when receiving
62b077aed3SPierre Proncherykeys from a third party.
63b077aed3SPierre Pronchery
64*44096ebdSEnji CooperThe EVP_PKEY_pairwise_check() and EVP_PKEY_private_check() might not be bounded
65*44096ebdSEnji Cooperby any key size limits as private keys are not expected to be supplied by
66*44096ebdSEnji Cooperattackers. For that reason they might take an unbounded time if run on
67*44096ebdSEnji Cooperarbitrarily large keys.
68*44096ebdSEnji Cooper
69b077aed3SPierre Pronchery=head1 RETURN VALUES
70b077aed3SPierre Pronchery
71b077aed3SPierre ProncheryAll functions return 1 for success or others for failure.
72b077aed3SPierre ProncheryThey return -2 if the operation is not supported for the specific algorithm.
73b077aed3SPierre Pronchery
74b077aed3SPierre Pronchery=head1 SEE ALSO
75b077aed3SPierre Pronchery
76b077aed3SPierre ProncheryL<EVP_PKEY_CTX_new(3)>,
77b077aed3SPierre ProncheryL<EVP_PKEY_fromdata(3)>,
78b077aed3SPierre ProncheryL<EVP_PKEY-DH(7)>,
79b077aed3SPierre ProncheryL<EVP_PKEY-FFC(7)>,
80b077aed3SPierre ProncheryL<EVP_PKEY-DSA(7)>,
81b077aed3SPierre ProncheryL<EVP_PKEY-EC(7)>,
82b077aed3SPierre ProncheryL<EVP_PKEY-RSA(7)>,
83b077aed3SPierre Pronchery
84b077aed3SPierre Pronchery=head1 HISTORY
85b077aed3SPierre Pronchery
86b077aed3SPierre ProncheryEVP_PKEY_check(), EVP_PKEY_public_check() and EVP_PKEY_param_check() were added
87b077aed3SPierre Proncheryin OpenSSL 1.1.1.
88b077aed3SPierre Pronchery
89b077aed3SPierre ProncheryEVP_PKEY_param_check_quick(), EVP_PKEY_public_check_quick(),
90b077aed3SPierre ProncheryEVP_PKEY_private_check() and EVP_PKEY_pairwise_check() were added in OpenSSL 3.0.
91b077aed3SPierre Pronchery
92b077aed3SPierre Pronchery=head1 COPYRIGHT
93b077aed3SPierre Pronchery
94*44096ebdSEnji CooperCopyright 2006-2024 The OpenSSL Project Authors. All Rights Reserved.
95b077aed3SPierre Pronchery
96b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
97b077aed3SPierre Proncherythis file except in compliance with the License.  You can obtain a copy
98b077aed3SPierre Proncheryin the file LICENSE in the source distribution or at
99b077aed3SPierre ProncheryL<https://www.openssl.org/source/license.html>.
100b077aed3SPierre Pronchery
101b077aed3SPierre Pronchery=cut
102