.\" $OpenBSD: d2i_BASIC_CONSTRAINTS.3,v 1.2 2018/03/21 16:09:51 schwarze Exp $ .\" .\" Copyright (c) 2016 Ingo Schwarze .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above .\" copyright notice and this permission notice appear in all copies. .\" .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" .Dd $Mdocdate: March 21 2018 $ .Dt D2I_BASIC_CONSTRAINTS 3 .Os .Sh NAME .Nm d2i_BASIC_CONSTRAINTS , .Nm i2d_BASIC_CONSTRAINTS , .Nm d2i_EXTENDED_KEY_USAGE , .Nm i2d_EXTENDED_KEY_USAGE .Nd decode and encode X.509 key usage purposes .Sh SYNOPSIS .In openssl/x509v3.h .Ft BASIC_CONSTRAINTS * .Fo d2i_BASIC_CONSTRAINTS .Fa "BASIC_CONSTRAINTS **val_out" .Fa "const unsigned char **der_in" .Fa "long length" .Fc .Ft int .Fo i2d_BASIC_CONSTRAINTS .Fa "BASIC_CONSTRAINTS *val_in" .Fa "unsigned char **der_out" .Fc .Ft EXTENDED_KEY_USAGE * .Fo d2i_EXTENDED_KEY_USAGE .Fa "EXTENDED_KEY_USAGE **val_out" .Fa "const unsigned char **der_in" .Fa "long length" .Fc .Ft int .Fo i2d_EXTENDED_KEY_USAGE .Fa "EXTENDED_KEY_USAGE *val_in" .Fa "unsigned char **der_out" .Fc .Sh DESCRIPTION These functions decode and encode data structures describing the intended purposes that the key contained in an X.509 certificate is to be used for. For details about the semantics, examples, caveats, and bugs, see .Xr ASN1_item_d2i 3 . .Pp .Fn d2i_BASIC_CONSTRAINTS and .Fn i2d_BASIC_CONSTRAINTS decode and encode an ASN.1 .Vt BasicConstraints structure defined in RFC 5280 section 4.2.1.9. .Pp .Fn d2i_EXTENDED_KEY_USAGE and .Fn i2d_EXTENDED_KEY_USAGE decode and encode an ASN.1 .Vt ExtKeyUsageSyntax structure defined in RFC 5280 section 4.2.1.12. .Sh RETURN VALUES .Fn d2i_BASIC_CONSTRAINTS and .Fn d2i_EXTENDED_KEY_USAGE return a .Vt BASIC_CONSTRAINTS or .Vt EXTENDED_KEY_USAGE object, respectively, or .Dv NULL if an error occurs. .Pp .Fn i2d_BASIC_CONSTRAINTS and .Fn i2d_EXTENDED_KEY_USAGE return the number of bytes successfully encoded or a negative value if an error occurs. .Sh SEE ALSO .Xr ASN1_item_d2i 3 , .Xr BASIC_CONSTRAINTS_new 3 , .Xr EXTENDED_KEY_USAGE_new 3 , .Xr X509_EXTENSION_new 3 .Sh STANDARDS RFC 5280: Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile .Sh HISTORY .Fn d2i_BASIC_CONSTRAINTS and .Fn i2d_BASIC_CONSTRAINTS first appeared in OpenSSL 0.9.2b and have been available since .Ox 2.6 .