1*2175Sjp161948=pod
2*2175Sjp161948
3*2175Sjp161948=head1 NAME
4*2175Sjp161948
5*2175Sjp161948EVP_PKEY_set1_RSA, EVP_PKEY_set1_DSA, EVP_PKEY_set1_DH, EVP_PKEY_set1_EC_KEY,
6*2175Sjp161948EVP_PKEY_get1_RSA, EVP_PKEY_get1_DSA, EVP_PKEY_get1_DH, EVP_PKEY_get1_EC_KEY,
7*2175Sjp161948EVP_PKEY_assign_RSA, EVP_PKEY_assign_DSA, EVP_PKEY_assign_DH, EVP_PKEY_assign_EC_KEY,
8*2175Sjp161948EVP_PKEY_type - EVP_PKEY assignment functions.
9*2175Sjp161948
10*2175Sjp161948=head1 SYNOPSIS
11*2175Sjp161948
12*2175Sjp161948 #include <openssl/evp.h>
13*2175Sjp161948
14*2175Sjp161948 int EVP_PKEY_set1_RSA(EVP_PKEY *pkey,RSA *key);
15*2175Sjp161948 int EVP_PKEY_set1_DSA(EVP_PKEY *pkey,DSA *key);
16*2175Sjp161948 int EVP_PKEY_set1_DH(EVP_PKEY *pkey,DH *key);
17*2175Sjp161948 int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey,EC_KEY *key);
18*2175Sjp161948
19*2175Sjp161948 RSA *EVP_PKEY_get1_RSA(EVP_PKEY *pkey);
20*2175Sjp161948 DSA *EVP_PKEY_get1_DSA(EVP_PKEY *pkey);
21*2175Sjp161948 DH *EVP_PKEY_get1_DH(EVP_PKEY *pkey);
22*2175Sjp161948 EC_KEY *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey);
23*2175Sjp161948
24*2175Sjp161948 int EVP_PKEY_assign_RSA(EVP_PKEY *pkey,RSA *key);
25*2175Sjp161948 int EVP_PKEY_assign_DSA(EVP_PKEY *pkey,DSA *key);
26*2175Sjp161948 int EVP_PKEY_assign_DH(EVP_PKEY *pkey,DH *key);
27*2175Sjp161948 int EVP_PKEY_assign_EC_KEY(EVP_PKEY *pkey,EC_KEY *key);
28*2175Sjp161948
29*2175Sjp161948 int EVP_PKEY_type(int type);
30*2175Sjp161948
31*2175Sjp161948=head1 DESCRIPTION
32*2175Sjp161948
33*2175Sjp161948EVP_PKEY_set1_RSA(), EVP_PKEY_set1_DSA(), EVP_PKEY_set1_DH() and
34*2175Sjp161948EVP_PKEY_set1_EC_KEY() set the key referenced by B<pkey> to B<key>.
35*2175Sjp161948
36*2175Sjp161948EVP_PKEY_get1_RSA(), EVP_PKEY_get1_DSA(), EVP_PKEY_get1_DH() and
37*2175Sjp161948EVP_PKEY_get1_EC_KEY() return the referenced key in B<pkey> or
38*2175Sjp161948B<NULL> if the key is not of the correct type.
39*2175Sjp161948
40*2175Sjp161948EVP_PKEY_assign_RSA() EVP_PKEY_assign_DSA(), EVP_PKEY_assign_DH()
41*2175Sjp161948and EVP_PKEY_assign_EC_KEY() also set the referenced key to B<key>
42*2175Sjp161948however these use the supplied B<key> internally and so B<key>
43*2175Sjp161948will be freed when the parent B<pkey> is freed.
44*2175Sjp161948
45*2175Sjp161948EVP_PKEY_type() returns the type of key corresponding to the value
46*2175Sjp161948B<type>. The type of a key can be obtained with
47*2175Sjp161948EVP_PKEY_type(pkey->type). The return value will be EVP_PKEY_RSA,
48*2175Sjp161948EVP_PKEY_DSA, EVP_PKEY_DH or EVP_PKEY_EC for the corresponding
49*2175Sjp161948key types or NID_undef if the key type is unassigned.
50*2175Sjp161948
51*2175Sjp161948=head1 NOTES
52*2175Sjp161948
53*2175Sjp161948In accordance with the OpenSSL naming convention the key obtained
54*2175Sjp161948from or assigned to the B<pkey> using the B<1> functions must be
55*2175Sjp161948freed as well as B<pkey>.
56*2175Sjp161948
57*2175Sjp161948EVP_PKEY_assign_RSA() EVP_PKEY_assign_DSA(), EVP_PKEY_assign_DH()
58*2175Sjp161948EVP_PKEY_assign_EC_KEY() are implemented as macros.
59*2175Sjp161948
60*2175Sjp161948=head1 RETURN VALUES
61*2175Sjp161948
62*2175Sjp161948EVP_PKEY_set1_RSA(), EVP_PKEY_set1_DSA(), EVP_PKEY_set1_DH() and
63*2175Sjp161948EVP_PKEY_set1_EC_KEY() return 1 for success or 0 for failure.
64*2175Sjp161948
65*2175Sjp161948EVP_PKEY_get1_RSA(), EVP_PKEY_get1_DSA(), EVP_PKEY_get1_DH() and
66*2175Sjp161948EVP_PKEY_get1_EC_KEY() return the referenced key or B<NULL> if
67*2175Sjp161948an error occurred.
68*2175Sjp161948
69*2175Sjp161948EVP_PKEY_assign_RSA() EVP_PKEY_assign_DSA(), EVP_PKEY_assign_DH()
70*2175Sjp161948and EVP_PKEY_assign_EC_KEY() return 1 for success and 0 for failure.
71*2175Sjp161948
72*2175Sjp161948=head1 SEE ALSO
73*2175Sjp161948
74*2175Sjp161948L<EVP_PKEY_new(3)|EVP_PKEY_new(3)>
75*2175Sjp161948
76*2175Sjp161948=head1 HISTORY
77*2175Sjp161948
78*2175Sjp161948TBA
79*2175Sjp161948
80*2175Sjp161948=cut
81