1.\"	$OpenBSD: d2i_X509_EXTENSION.3,v 1.4 2018/03/27 17:35:50 schwarze Exp $
2.\"
3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: March 27 2018 $
18.Dt D2I_X509_EXTENSION 3
19.Os
20.Sh NAME
21.Nm d2i_X509_EXTENSION ,
22.Nm i2d_X509_EXTENSION ,
23.Nm d2i_X509_EXTENSIONS ,
24.Nm i2d_X509_EXTENSIONS
25.\" In the next line, the capital "E" is not a typo.
26.\" The ASN.1 structure is called "Extensions", not "extensions".
27.Nd decode and encode X.509 Extensions
28.Sh SYNOPSIS
29.In openssl/x509.h
30.Ft X509_EXTENSION *
31.Fo d2i_X509_EXTENSION
32.Fa "X509_EXTENSION **val_out"
33.Fa "const unsigned char **der_in"
34.Fa "long length"
35.Fc
36.Ft int
37.Fo i2d_X509_EXTENSION
38.Fa "X509_EXTENSION *val_in"
39.Fa "unsigned char **der_out"
40.Fc
41.Ft X509_EXTENSIONS *
42.Fo d2i_X509_EXTENSIONS
43.Fa "X509_EXTENSIONS **val_out"
44.Fa "const unsigned char **der_in"
45.Fa "long length"
46.Fc
47.Ft int
48.Fo i2d_X509_EXTENSIONS
49.Fa "X509_EXTENSIONS *val_in"
50.Fa "unsigned char **der_out"
51.Fc
52.Sh DESCRIPTION
53.Fn d2i_X509_EXTENSION
54and
55.Fn i2d_X509_EXTENSION
56decode and encode an ASN.1
57.Vt Extension
58structure defined in RFC 5280 section 4.1.
59.Pp
60.Fn d2i_X509_EXTENSIONS
61and
62.Fn i2d_X509_EXTENSIONS
63decode and encode an ASN.1
64.Vt Extensions
65structure defined in RFC 5280 section 4.1,
66which is a SEQUENCE OF
67.Vt Extension .
68.Sh RETURN VALUES
69.Fn d2i_X509_EXTENSION
70and
71.Fn d2i_X509_EXTENSIONS
72return an
73.Vt X509_EXTENSION
74or
75.Vt X509_EXTENSIONS
76object, respectively, or
77.Dv NULL
78if an error occurs.
79.Pp
80.Fn i2d_X509_EXTENSION
81and
82.Fn i2d_X509_EXTENSIONS
83return the number of bytes successfully encoded or a negative value
84if an error occurs.
85.Sh SEE ALSO
86.Xr ASN1_item_d2i 3 ,
87.Xr X509_EXTENSION_new 3 ,
88.Xr X509V3_get_d2i 3 ,
89.Xr X509v3_get_ext_by_NID 3
90.Sh STANDARDS
91RFC 5280: Internet X.509 Public Key Infrastructure Certificate and
92Certificate Revocation List (CRL) Profile
93.Sh HISTORY
94.Fn d2i_X509_EXTENSION
95and
96.Fn i2d_X509_EXTENSION
97first appeared in SSLeay 0.6.2 and have been available since
98.Ox 2.4 .
99.Pp
100.Fn d2i_X509_EXTENSIONS
101and
102.Fn i2d_X509_EXTENSIONS
103first appeared in OpenSSL 0.9.8h and have been available since
104.Ox 4.5 .
105