Update DTLSv1_listen documentation
[openssl.git] / doc / crypto / EVP_PKEY_set1_RSA.pod
1 =pod
2
3 =head1 NAME
4
5 EVP_PKEY_set1_RSA, EVP_PKEY_set1_DSA, EVP_PKEY_set1_DH, EVP_PKEY_set1_EC_KEY,
6 EVP_PKEY_get1_RSA, EVP_PKEY_get1_DSA, EVP_PKEY_get1_DH, EVP_PKEY_get1_EC_KEY,
7 EVP_PKEY_get0_RSA, EVP_PKEY_get0_DSA, EVP_PKEY_get0_DH, EVP_PKEY_get0_EC_KEY,
8 EVP_PKEY_assign_RSA, EVP_PKEY_assign_DSA, EVP_PKEY_assign_DH, EVP_PKEY_assign_EC_KEY,
9 EVP_PKEY_type - EVP_PKEY assignment functions.
10
11 =head1 SYNOPSIS
12
13  #include <openssl/evp.h>
14
15  int EVP_PKEY_set1_RSA(EVP_PKEY *pkey,RSA *key);
16  int EVP_PKEY_set1_DSA(EVP_PKEY *pkey,DSA *key);
17  int EVP_PKEY_set1_DH(EVP_PKEY *pkey,DH *key);
18  int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey,EC_KEY *key);
19
20  RSA *EVP_PKEY_get1_RSA(EVP_PKEY *pkey);
21  DSA *EVP_PKEY_get1_DSA(EVP_PKEY *pkey);
22  DH *EVP_PKEY_get1_DH(EVP_PKEY *pkey);
23  EC_KEY *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey);
24
25  RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey);
26  DSA *EVP_PKEY_get0_DSA(EVP_PKEY *pkey);
27  DH *EVP_PKEY_get0_DH(EVP_PKEY *pkey);
28  EC_KEY *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey);
29
30  int EVP_PKEY_assign_RSA(EVP_PKEY *pkey,RSA *key);
31  int EVP_PKEY_assign_DSA(EVP_PKEY *pkey,DSA *key);
32  int EVP_PKEY_assign_DH(EVP_PKEY *pkey,DH *key);
33  int EVP_PKEY_assign_EC_KEY(EVP_PKEY *pkey,EC_KEY *key);
34
35  int EVP_PKEY_type(int type);
36
37 =head1 DESCRIPTION
38
39 EVP_PKEY_set1_RSA(), EVP_PKEY_set1_DSA(), EVP_PKEY_set1_DH() and
40 EVP_PKEY_set1_EC_KEY() set the key referenced by B<pkey> to B<key>.
41
42 EVP_PKEY_get1_RSA(), EVP_PKEY_get1_DSA(), EVP_PKEY_get1_DH() and
43 EVP_PKEY_get1_EC_KEY() return the referenced key in B<pkey> or
44 B<NULL> if the key is not of the correct type.
45
46 EVP_PKEY_get0_RSA(), EVP_PKEY_get0_DSA(), EVP_PKEY_get0_DH() and
47 EVP_PKEY_get0_EC_KEY() also return the referenced key in B<pkey> or
48 B<NULL> if the key is not of the correct type but the reference
49 count of the returned key is B<not> incremented and so must not
50 be freed up after use.
51
52 EVP_PKEY_assign_RSA(), EVP_PKEY_assign_DSA(), EVP_PKEY_assign_DH()
53 and EVP_PKEY_assign_EC_KEY() also set the referenced key to B<key>
54 however these use the supplied B<key> internally and so B<key>
55 will be freed when the parent B<pkey> is freed.
56
57 EVP_PKEY_type() returns the type of key corresponding to the value
58 B<type>. The type of a key can be obtained with
59 EVP_PKEY_type(pkey->type). The return value will be EVP_PKEY_RSA,
60 EVP_PKEY_DSA, EVP_PKEY_DH or EVP_PKEY_EC for the corresponding
61 key types or NID_undef if the key type is unassigned.
62
63 =head1 NOTES
64
65 In accordance with the OpenSSL naming convention the key obtained
66 from or assigned to the B<pkey> using the B<1> functions must be
67 freed as well as B<pkey>.
68
69 EVP_PKEY_assign_RSA(), EVP_PKEY_assign_DSA(), EVP_PKEY_assign_DH()
70 and EVP_PKEY_assign_EC_KEY() are implemented as macros.
71
72 =head1 RETURN VALUES
73
74 EVP_PKEY_set1_RSA(), EVP_PKEY_set1_DSA(), EVP_PKEY_set1_DH() and
75 EVP_PKEY_set1_EC_KEY() return 1 for success or 0 for failure.
76
77 EVP_PKEY_get1_RSA(), EVP_PKEY_get1_DSA(), EVP_PKEY_get1_DH() and
78 EVP_PKEY_get1_EC_KEY() return the referenced key or B<NULL> if 
79 an error occurred.
80
81 EVP_PKEY_assign_RSA(), EVP_PKEY_assign_DSA(), EVP_PKEY_assign_DH()
82 and EVP_PKEY_assign_EC_KEY() return 1 for success and 0 for failure.
83
84 =head1 SEE ALSO
85
86 L<EVP_PKEY_new(3)>
87
88 =head1 HISTORY
89
90 TBA
91
92 =cut