1.\"	$OpenBSD: d2i_BASIC_CONSTRAINTS.3,v 1.3 2018/03/22 21:08:22 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 22 2018 $
18.Dt D2I_BASIC_CONSTRAINTS 3
19.Os
20.Sh NAME
21.Nm d2i_BASIC_CONSTRAINTS ,
22.Nm i2d_BASIC_CONSTRAINTS ,
23.Nm d2i_EXTENDED_KEY_USAGE ,
24.Nm i2d_EXTENDED_KEY_USAGE
25.Nd decode and encode X.509 key usage purposes
26.Sh SYNOPSIS
27.In openssl/x509v3.h
28.Ft BASIC_CONSTRAINTS *
29.Fo d2i_BASIC_CONSTRAINTS
30.Fa "BASIC_CONSTRAINTS **val_out"
31.Fa "const unsigned char **der_in"
32.Fa "long length"
33.Fc
34.Ft int
35.Fo i2d_BASIC_CONSTRAINTS
36.Fa "BASIC_CONSTRAINTS *val_in"
37.Fa "unsigned char **der_out"
38.Fc
39.Ft EXTENDED_KEY_USAGE *
40.Fo d2i_EXTENDED_KEY_USAGE
41.Fa "EXTENDED_KEY_USAGE **val_out"
42.Fa "const unsigned char **der_in"
43.Fa "long length"
44.Fc
45.Ft int
46.Fo i2d_EXTENDED_KEY_USAGE
47.Fa "EXTENDED_KEY_USAGE *val_in"
48.Fa "unsigned char **der_out"
49.Fc
50.Sh DESCRIPTION
51These functions decode and encode data structures describing the
52intended purposes that the key contained in an X.509 certificate
53is to be used for.
54For details about the semantics, examples, caveats, and bugs, see
55.Xr ASN1_item_d2i 3 .
56.Pp
57.Fn d2i_BASIC_CONSTRAINTS
58and
59.Fn i2d_BASIC_CONSTRAINTS
60decode and encode an ASN.1
61.Vt BasicConstraints
62structure defined in RFC 5280 section 4.2.1.9.
63.Pp
64.Fn d2i_EXTENDED_KEY_USAGE
65and
66.Fn i2d_EXTENDED_KEY_USAGE
67decode and encode an ASN.1
68.Vt ExtKeyUsageSyntax
69structure defined in RFC 5280 section 4.2.1.12.
70.Sh RETURN VALUES
71.Fn d2i_BASIC_CONSTRAINTS
72and
73.Fn d2i_EXTENDED_KEY_USAGE
74return a
75.Vt BASIC_CONSTRAINTS
76or
77.Vt EXTENDED_KEY_USAGE
78object, respectively, or
79.Dv NULL
80if an error occurs.
81.Pp
82.Fn i2d_BASIC_CONSTRAINTS
83and
84.Fn i2d_EXTENDED_KEY_USAGE
85return the number of bytes successfully encoded or a negative value
86if an error occurs.
87.Sh SEE ALSO
88.Xr ASN1_item_d2i 3 ,
89.Xr BASIC_CONSTRAINTS_new 3 ,
90.Xr EXTENDED_KEY_USAGE_new 3 ,
91.Xr X509_EXTENSION_new 3
92.Sh STANDARDS
93RFC 5280: Internet X.509 Public Key Infrastructure Certificate and
94Certificate Revocation List (CRL) Profile
95.Sh HISTORY
96.Fn d2i_BASIC_CONSTRAINTS
97and
98.Fn i2d_BASIC_CONSTRAINTS
99first appeared in OpenSSL 0.9.2b and have been available since
100.Ox 2.6 .
101.Pp
102.Fn d2i_EXTENDED_KEY_USAGE
103and
104.Fn i2d_EXTENDED_KEY_USAGE
105first appeared in OpenSSL 0.9.7 and have been available since
106.Ox 3.2 .
107