summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/X509_get_pubkey.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/man/X509_get_pubkey.3')
-rw-r--r--src/lib/libcrypto/man/X509_get_pubkey.3147
1 files changed, 147 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/X509_get_pubkey.3 b/src/lib/libcrypto/man/X509_get_pubkey.3
new file mode 100644
index 0000000000..8948f5cfda
--- /dev/null
+++ b/src/lib/libcrypto/man/X509_get_pubkey.3
@@ -0,0 +1,147 @@
1.\" $OpenBSD: X509_get_pubkey.3,v 1.1 2016/12/05 18:24:08 schwarze Exp $
2.\" OpenSSL e7fabc5e Sep 7 13:41:20 2015 +0100
3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
5.\" Copyright (c) 2015 The OpenSSL Project. All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\"
11.\" 1. Redistributions of source code must retain the above copyright
12.\" notice, this list of conditions and the following disclaimer.
13.\"
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\" notice, this list of conditions and the following disclaimer in
16.\" the documentation and/or other materials provided with the
17.\" distribution.
18.\"
19.\" 3. All advertising materials mentioning features or use of this
20.\" software must display the following acknowledgment:
21.\" "This product includes software developed by the OpenSSL Project
22.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
23.\"
24.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
25.\" endorse or promote products derived from this software without
26.\" prior written permission. For written permission, please contact
27.\" openssl-core@openssl.org.
28.\"
29.\" 5. Products derived from this software may not be called "OpenSSL"
30.\" nor may "OpenSSL" appear in their names without prior written
31.\" permission of the OpenSSL Project.
32.\"
33.\" 6. Redistributions of any form whatsoever must retain the following
34.\" acknowledgment:
35.\" "This product includes software developed by the OpenSSL Project
36.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
37.\"
38.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
39.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
41.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
42.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
44.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
45.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
46.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
47.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\"
51.Dd $Mdocdate: December 5 2016 $
52.Dt X509_GET_PUBKEY 3
53.Os
54.Sh NAME
55.Nm X509_get_pubkey ,
56.Nm X509_set_pubkey ,
57.Nm X509_get_X509_PUBKEY ,
58.Nm X509_REQ_get_pubkey ,
59.Nm X509_REQ_set_pubkey
60.Nd get or set certificate or certificate request public key
61.Sh SYNOPSIS
62.In openssl/x509.h
63.Ft EVP_PKEY *
64.Fo X509_get_pubkey
65.Fa "X509 *x"
66.Fc
67.Ft int
68.Fo X509_set_pubkey
69.Fa "X509 *x"
70.Fa "EVP_PKEY *pkey"
71.Fc
72.Ft X509_PUBKEY *
73.Fo X509_get_X509_PUBKEY
74.Fa "X509 *x"
75.Fc
76.Ft EVP_PKEY *
77.Fo X509_REQ_get_pubkey
78.Fa "X509_REQ *req"
79.Fc
80.Ft int
81.Fo X509_REQ_set_pubkey
82.Fa "X509_REQ *x"
83.Fa "EVP_PKEY *pkey"
84.Fc
85.Sh DESCRIPTION
86.Fn X509_get_pubkey
87attempts to decode the public key for certificate
88.Fa x .
89If successful it returns the public key as an
90.Vt EVP_PKEY
91pointer with its reference count incremented: this means the returned
92key must be freed up after use.
93.Pp
94.Fn X509_get_X509_PUBKEY
95returns an internal pointer to the
96.Vt X509_PUBKEY
97structure which encodes the certificate of
98.Fa x .
99The returned value must not be freed up after use.
100.Fn X509_get_X509_PUBKEY
101is implemented as a macro.
102.Pp
103.Fn X509_set_pubkey
104attempts to set the public key for certificate
105.Fa x
106to
107.Fa pkey .
108The key
109.Fa pkey
110should be freed up after use.
111.Pp
112.Fn X509_REQ_get_pubkey
113and
114.Fn X509_REQ_set_pubkey
115are similar but operate on certificate request
116.Fa req .
117.Pp
118The first time a public key is decoded, the
119.Vt EVP_PKEY
120structure is cached in the certificate or certificate request itself.
121Subsequent calls return the cached structure with its reference count
122incremented to improve performance.
123.Sh RETURN VALUES
124.Fn X509_get_pubkey ,
125.Fn X509_get_X509_PUBKEY ,
126and
127.Fn X509_REQ_get_pubkey
128return a public key or
129.Dv NULL
130if an error occurred.
131.Pp
132.Fn X509_set_pubkey
133and
134.Fn X509_REQ_set_pubkey
135return 1 for success or 0 for failure.
136.Sh SEE ALSO
137.Xr d2i_X509 3 ,
138.Xr ERR_get_error 3 ,
139.Xr X509_CRL_get0_by_serial 3 ,
140.Xr X509_NAME_add_entry_by_txt 3 ,
141.Xr X509_NAME_ENTRY_get_object 3 ,
142.Xr X509_NAME_get_index_by_NID 3 ,
143.Xr X509_NAME_print_ex 3 ,
144.Xr X509_new 3 ,
145.Xr X509_sign 3 ,
146.Xr X509_verify_cert 3 ,
147.Xr X509V3_get_d2i 3