summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/X509_PUBKEY_new.3
diff options
context:
space:
mode:
authorcvs2svn <admin@example.com>2021-08-18 16:06:57 +0000
committercvs2svn <admin@example.com>2021-08-18 16:06:57 +0000
commitd56c8fa8260d226f98b26f017b45b9c2b135f38d (patch)
tree348178b41617813cc93787187984a734ef8379ca /src/lib/libcrypto/man/X509_PUBKEY_new.3
parent18b9c1bcab7c37d8c5bd05b8e0d14d0c59d96650 (diff)
downloadopenbsd-tb_20210818.tar.gz
openbsd-tb_20210818.tar.bz2
openbsd-tb_20210818.zip
This commit was manufactured by cvs2git to create tag 'tb_20210818'.tb_20210818
Diffstat (limited to 'src/lib/libcrypto/man/X509_PUBKEY_new.3')
-rw-r--r--src/lib/libcrypto/man/X509_PUBKEY_new.3368
1 files changed, 0 insertions, 368 deletions
diff --git a/src/lib/libcrypto/man/X509_PUBKEY_new.3 b/src/lib/libcrypto/man/X509_PUBKEY_new.3
deleted file mode 100644
index 69afcb5adb..0000000000
--- a/src/lib/libcrypto/man/X509_PUBKEY_new.3
+++ /dev/null
@@ -1,368 +0,0 @@
1.\" $OpenBSD: X509_PUBKEY_new.3,v 1.16 2020/06/19 14:04:25 schwarze Exp $
2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\"
4.\" This file is a derived work.
5.\" The changes are covered by the following Copyright and license:
6.\"
7.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org>
8.\"
9.\" Permission to use, copy, modify, and distribute this software for any
10.\" purpose with or without fee is hereby granted, provided that the above
11.\" copyright notice and this permission notice appear in all copies.
12.\"
13.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20.\"
21.\" The original file was written by Dr. Stephen Henson <steve@openssl.org>.
22.\" Copyright (c) 2016 The OpenSSL Project. All rights reserved.
23.\"
24.\" Redistribution and use in source and binary forms, with or without
25.\" modification, are permitted provided that the following conditions
26.\" are met:
27.\"
28.\" 1. Redistributions of source code must retain the above copyright
29.\" notice, this list of conditions and the following disclaimer.
30.\"
31.\" 2. Redistributions in binary form must reproduce the above copyright
32.\" notice, this list of conditions and the following disclaimer in
33.\" the documentation and/or other materials provided with the
34.\" distribution.
35.\"
36.\" 3. All advertising materials mentioning features or use of this
37.\" software must display the following acknowledgment:
38.\" "This product includes software developed by the OpenSSL Project
39.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
40.\"
41.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
42.\" endorse or promote products derived from this software without
43.\" prior written permission. For written permission, please contact
44.\" openssl-core@openssl.org.
45.\"
46.\" 5. Products derived from this software may not be called "OpenSSL"
47.\" nor may "OpenSSL" appear in their names without prior written
48.\" permission of the OpenSSL Project.
49.\"
50.\" 6. Redistributions of any form whatsoever must retain the following
51.\" acknowledgment:
52.\" "This product includes software developed by the OpenSSL Project
53.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
54.\"
55.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
56.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
57.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
58.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
59.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
60.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
61.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
62.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
63.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
64.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\"
68.Dd $Mdocdate: June 19 2020 $
69.Dt X509_PUBKEY_NEW 3
70.Os
71.Sh NAME
72.Nm X509_PUBKEY_new ,
73.Nm X509_PUBKEY_free ,
74.Nm X509_PUBKEY_set ,
75.Nm X509_PUBKEY_get0 ,
76.Nm X509_PUBKEY_get ,
77.Nm d2i_PUBKEY ,
78.Nm i2d_PUBKEY ,
79.Nm d2i_PUBKEY_bio ,
80.Nm d2i_PUBKEY_fp ,
81.Nm i2d_PUBKEY_fp ,
82.Nm i2d_PUBKEY_bio ,
83.Nm X509_PUBKEY_set0_param ,
84.Nm X509_PUBKEY_get0_param
85.Nd X.509 SubjectPublicKeyInfo structure
86.Sh SYNOPSIS
87.In openssl/x509.h
88.Ft X509_PUBKEY *
89.Fn X509_PUBKEY_new void
90.Ft void
91.Fo X509_PUBKEY_free
92.Fa "X509_PUBKEY *a"
93.Fc
94.Ft int
95.Fo X509_PUBKEY_set
96.Fa "X509_PUBKEY **x"
97.Fa "EVP_PKEY *pkey"
98.Fc
99.Ft EVP_PKEY *
100.Fo X509_PUBKEY_get0
101.Fa "X509_PUBKEY *key"
102.Fc
103.Ft EVP_PKEY *
104.Fo X509_PUBKEY_get
105.Fa "X509_PUBKEY *key"
106.Fc
107.Ft EVP_PKEY *
108.Fo d2i_PUBKEY
109.Fa "EVP_PKEY **a"
110.Fa "const unsigned char **pp"
111.Fa "long length"
112.Fc
113.Ft int
114.Fo i2d_PUBKEY
115.Fa "EVP_PKEY *a"
116.Fa "unsigned char **pp"
117.Fc
118.Ft EVP_PKEY *
119.Fo d2i_PUBKEY_bio
120.Fa "BIO *bp"
121.Fa "EVP_PKEY **a"
122.Fc
123.Ft EVP_PKEY *
124.Fo d2i_PUBKEY_fp
125.Fa "FILE *fp"
126.Fa "EVP_PKEY **a"
127.Fc
128.Ft int
129.Fo i2d_PUBKEY_fp
130.Fa "FILE *fp"
131.Fa "EVP_PKEY *pkey"
132.Fc
133.Ft int
134.Fo i2d_PUBKEY_bio
135.Fa "BIO *bp"
136.Fa "EVP_PKEY *pkey"
137.Fc
138.Ft int
139.Fo X509_PUBKEY_set0_param
140.Fa "X509_PUBKEY *pub"
141.Fa "ASN1_OBJECT *aobj"
142.Fa "int ptype"
143.Fa "void *pval"
144.Fa "unsigned char *penc"
145.Fa "int penclen"
146.Fc
147.Ft int
148.Fo X509_PUBKEY_get0_param
149.Fa "ASN1_OBJECT **ppkalg"
150.Fa "const unsigned char **pk"
151.Fa "int *ppklen"
152.Fa "X509_ALGOR **pa"
153.Fa "X509_PUBKEY *pub"
154.Fc
155.Sh DESCRIPTION
156The
157.Vt X509_PUBKEY
158structure represents the ASN.1
159.Vt SubjectPublicKeyInfo
160structure defined in RFC 5280 section 4.1 and used in certificates
161and certificate requests.
162.Pp
163.Fn X509_PUBKEY_new
164allocates and initializes an
165.Vt X509_PUBKEY
166structure.
167.Pp
168.Fn X509_PUBKEY_free
169frees up the
170.Vt X509_PUBKEY
171structure
172.Fa a .
173If
174.Fa a
175is a
176.Dv NULL
177pointer, no action occurs.
178.Pp
179.Fn X509_PUBKEY_set
180sets the public key in
181.Pf * Fa x
182to the public key contained in the
183.Vt EVP_PKEY
184structure
185.Fa pkey .
186If
187.Pf * Fa x
188is not
189.Dv NULL ,
190any existing public key structure will be freed.
191.Pp
192.Fn X509_PUBKEY_get0
193returns the public key contained in
194.Fa key .
195The returned value is an internal pointer which must not be freed after use.
196.Pp
197.Fn X509_PUBKEY_get
198is similar to
199.Fn X509_PUBKEY_get0
200except that the reference
201count on the returned key is incremented so it must be freed using
202.Xr EVP_PKEY_free 3
203after use.
204.Pp
205.Fn d2i_PUBKEY
206and
207.Fn i2d_PUBKEY
208decode and encode an
209.Vt EVP_PKEY
210structure using
211.Vt SubjectPublicKeyInfo
212format.
213For details about the semantics, examples, caveats, and bugs, see
214.Xr ASN1_item_d2i 3 .
215.Fn d2i_PUBKEY_bio ,
216.Fn d2i_PUBKEY_fp ,
217.Fn i2d_PUBKEY_bio
218and
219.Fn i2d_PUBKEY_fp
220are similar except they decode or encode using a
221.Vt BIO
222or
223.Vt FILE
224pointer.
225.Pp
226.Fn X509_PUBKEY_set0_param
227sets the public key parameters of
228.Fa pub .
229The OID associated with the algorithm is set to
230.Fa aobj .
231The type of the algorithm parameters is set to
232.Fa ptype
233using the structure
234.Fa pval .
235The encoding of the public key itself is set to the
236.Fa penclen
237bytes contained in buffer
238.Fa penc .
239On success ownership of all the supplied parameters is passed to
240.Fa pub
241so they must not be freed after the call.
242.Pp
243.Fn X509_PUBKEY_get0_param
244retrieves the public key parameters from
245.Fa pub ,
246.Pf * Fa ppkalg
247is set to the associated OID and the encoding consists of
248.Pf * Fa ppklen
249bytes at
250.Pf * Fa pk ,
251and
252.Pf * Fa pa
253is set to the associated
254.Vt AlgorithmIdentifier
255for the public key.
256If the value of any of these parameters is not required,
257it can be set to
258.Dv NULL .
259All of the retrieved pointers are internal and must not be freed after
260the call.
261.Sh RETURN VALUES
262If the allocation fails,
263.Fn X509_PUBKEY_new
264returns
265.Dv NULL
266and sets an error code that can be obtained by
267.Xr ERR_get_error 3 .
268Otherwise it returns a pointer to the newly allocated structure.
269.Pp
270.Fn X509_PUBKEY_get0 ,
271.Fn X509_PUBKEY_get ,
272.Fn d2i_PUBKEY ,
273.Fn d2i_PUBKEY_bio ,
274and
275.Fn d2i_PUBKEY_fp
276return a pointer to an
277.Vt EVP_PKEY
278structure or
279.Dv NULL
280if an error occurs.
281.Pp
282.Fn i2d_PUBKEY
283returns the number of bytes successfully encoded or a negative value
284if an error occurs.
285.Pp
286.Fn X509_PUBKEY_set ,
287.Fn X509_PUBKEY_set0_param ,
288.Fn X509_PUBKEY_get0_param ,
289.Fn i2d_PUBKEY_fp ,
290and
291.Fn i2d_PUBKEY_bio
292return 1 for success and 0 if an error occurred.
293.Sh ERRORS
294After failure of
295.Fn X509_PUBKEY_get0
296or
297.Fn X509_PUBKEY_get ,
298one of the following diagnostics can be retrieved with
299.Xr ERR_get_error 3 ,
300.Xr ERR_GET_REASON 3 ,
301and
302.Xr ERR_reason_error_string 3 :
303.Bl -tag -width Ds
304.It Dv X509_R_UNSUPPORTED_ALGORITHM Qq "unsupported algorithm"
305The public key uses an algorithm unsupported by
306.Xr EVP_PKEY_set_type 3 .
307.It X509_R_METHOD_NOT_SUPPORTED Qq "method not supported"
308While the algorithm is known to
309.Xr EVP_PKEY_set_type 3 ,
310using it for decoding is not supported.
311.It X509_R_PUBLIC_KEY_DECODE_ERROR Qq "public key decode error"
312Decoding the public key failed.
313.It Dv ERR_R_MALLOC_FAILURE Qq "malloc failure"
314Memory was exhausted when trying to allocate the new
315.Vt EVP_PKEY
316object.
317.El
318.Pp
319If
320.Fa key
321is
322.Dv NULL
323or does not contain a public key,
324these functions fail but no error is pushed onto the stack.
325.Sh SEE ALSO
326.Xr d2i_X509 3 ,
327.Xr EVP_PKEY_asn1_set_public 3 ,
328.Xr X509_ALGOR_new 3 ,
329.Xr X509_get_pubkey 3 ,
330.Xr X509_new 3
331.Sh STANDARDS
332RFC 5280: Internet X.509 Public Key Infrastructure Certificate and
333Certificate Revocation List (CRL) Profile
334.Sh HISTORY
335.Fn X509_PUBKEY_new
336and
337.Fn X509_PUBKEY_free
338appeared in SSLeay 0.4 or earlier.
339.Fn X509_PUBKEY_set
340and
341.Fn X509_PUBKEY_get
342first appeared in SSLeay 0.8.0.
343These functions have been available since
344.Ox 2.4 .
345.Pp
346.Fn d2i_PUBKEY
347and
348.Fn i2d_PUBKEY
349first appeared in OpenSSL 0.9.5 and have been available since
350.Ox 2.7 .
351.Pp
352.Fn d2i_PUBKEY_bio ,
353.Fn d2i_PUBKEY_fp ,
354.Fn i2d_PUBKEY_fp ,
355and
356.Fn i2d_PUBKEY_bio
357first appeared in OpenSSL 0.9.6 and have been available since
358.Ox 2.9 .
359.Pp
360.Fn X509_PUBKEY_set0_param
361and
362.Fn X509_PUBKEY_get0_param
363first appeared in OpenSSL 1.0.0 and have been available since
364.Ox 4.9 .
365.Pp
366.Fn X509_PUBKEY_get0
367first appeared in OpenSSL 1.1.0 and has been available since
368.Ox 6.3 .