1.\"	$OpenBSD: d2i_X509_ATTRIBUTE.3,v 1.3 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_ATTRIBUTE 3
19.Os
20.Sh NAME
21.Nm d2i_X509_ATTRIBUTE ,
22.Nm i2d_X509_ATTRIBUTE
23.\" In the following line, "X.501" and "Attribute" are not typos.
24.\" The "Attribute" type is defined in X.501, not in X.509.
25.\" The type in called "Attribute" with capital "A", not "attribute".
26.Nd decode and encode generic X.501 Attribute
27.Sh SYNOPSIS
28.In openssl/x509.h
29.Ft X509_ATTRIBUTE *
30.Fo d2i_X509_ATTRIBUTE
31.Fa "X509_ATTRIBUTE **val_out"
32.Fa "const unsigned char **der_in"
33.Fa "long length"
34.Fc
35.Ft int
36.Fo i2d_X509_ATTRIBUTE
37.Fa "X509_ATTRIBUTE *val_in"
38.Fa "unsigned char **der_out"
39.Fc
40.Sh DESCRIPTION
41.Fn d2i_X509_ATTRIBUTE
42and
43.Fn i2d_X509_ATTRIBUTE
44decode and encode a generic ASN.1
45.Vt Attribute
46structure defined in X.501 section 8.2.
47For details about the semantics, examples, caveats, and bugs, see
48.Xr ASN1_item_d2i 3 .
49.Sh RETURN VALUES
50.Fn d2i_X509_ATTRIBUTE
51returns an
52.Vt X509_ATTRIBUTE
53object or
54.Dv NULL
55if an error occurs.
56.Pp
57.Fn i2d_X509_ATTRIBUTE
58returns the number of bytes successfully encoded or a negative value
59if an error occurs.
60.Sh SEE ALSO
61.Xr ASN1_item_d2i 3 ,
62.Xr d2i_PKCS12 3 ,
63.Xr d2i_PKCS8_PRIV_KEY_INFO 3 ,
64.Xr d2i_X509_EXTENSION 3 ,
65.Xr d2i_X509_REQ 3 ,
66.Xr X509_ATTRIBUTE_new 3
67.Sh STANDARDS
68ITU-T Recommendation X.501, also known as ISO/IEC 9594-2: Information
69Technology  Open Systems Interconnection  The Directory: Models,
70section 8.2: Overall structure
71.Sh HISTORY
72.Fn d2i_X509_ATTRIBUTE
73and
74.Fn i2d_X509_ATTRIBUTE
75first appeared in SSLeay 0.5.1 and have been available since
76.Ox 2.4 .
77