]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/man3/EVP_PKEY_set_type.pod
Remove an unnecessary call to BN_CTX_free.
[thirdparty/openssl.git] / doc / man3 / EVP_PKEY_set_type.pod
CommitLineData
8243d8d1
RL
1=pod
2
3=head1 NAME
4
5EVP_PKEY_set_type, EVP_PKEY_set_type_str, EVP_PKEY_set_type_by_keymgmt
6- functions to change the EVP_PKEY type
7
8=head1 SYNOPSIS
9
10 #include <openssl/evp.h>
11
12 int EVP_PKEY_set_type(EVP_PKEY *pkey, int type);
13 int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len);
14 int EVP_PKEY_set_type_by_keymgmt(EVP_PKEY *pkey, EVP_KEYMGMT *keymgmt);
15
16=head1 DESCRIPTION
17
18All the functions described here behave the same in so far that they
19clear all the previous key data and methods from I<pkey>, and reset it
20to be of the type of key given by the different arguments. If
21I<pkey> is NULL, these functions will still return the same return
22values as if it wasn't.
23
24EVP_PKEY_set_type() initialises I<pkey> to contain an internal legacy
25key. When doing this, it finds a L<EVP_PKEY_ASN1_METHOD(3)>
26corresponding to I<type>, and associates I<pkey> with the findings.
27It is an error if no L<EVP_PKEY_ASN1_METHOD(3)> could be found for
28I<type>.
29
30EVP_PKEY_set_type_str() initialises I<pkey> to contain an internal legacy
31key. When doing this, it finds a L<EVP_PKEY_ASN1_METHOD(3)>
32corresponding to I<str> that has then length I<len>, and associates
33I<pkey> with the findings.
34It is an error if no L<EVP_PKEY_ASN1_METHOD(3)> could be found for
35I<type>.
36
37For both EVP_PKEY_set_type() and EVP_PKEY_set_type_str(), I<pkey> gets
38a numeric type, which can be retrieved with L<EVP_PKEY_id(3)>. This
39numeric type is taken from the L<EVP_PKEY_ASN1_METHOD(3)> that was
40found, and is equal to or closely related to I<type> in the case of
41EVP_PKEY_set_type(), or related to I<str> in the case of
42EVP_PKEY_set_type_str().
43
44EVP_PKEY_set_type_by_keymgmt() initialises I<pkey> to contain an
45internal provider side key. When doing this, it associates I<pkey>
46with I<keymgmt>. For keys initialised like this, the numeric type
47retrieved with L<EVP_PKEY_id(3)> will always be B<EVP_PKEY_NONE>.
48
49=head1 RETURN VALUES
50
51All functions described here return 1 if successful, or 0 on error.
52
53=head1 SEE ALSO
54
55L<EVP_PKEY_assign(3)>, L<EVP_PKEY_id(3)>, L<EVP_PKEY_get0_RSA(3)>,
56L<EVP_PKEY_copy_parameters(3)>, L<EVP_PKEY_ASN1_METHOD(3)>,
57L<EVP_KEYMGMT(3)>
58
59=head1 COPYRIGHT
60
61Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
62
63Licensed under the Apache License 2.0 (the "License"). You may not use
64this file except in compliance with the License. You can obtain a copy
65in the file LICENSE in the source distribution or at
66L<https://www.openssl.org/source/license.html>.
67
68=cut