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