xref: /openbsd/lib/libcrypto/man/a2d_ASN1_OBJECT.3 (revision 5dea098c)
1.\" $OpenBSD: a2d_ASN1_OBJECT.3,v 1.3 2023/08/09 17:34:39 schwarze Exp $
2.\"
3.\" Copyright (c) 2021 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: August 9 2023 $
18.Dt A2D_ASN1_OBJECT 3
19.Os
20.Sh NAME
21.Nm a2d_ASN1_OBJECT
22.Nd DER content octets of an ASN.1 object identifier
23.Sh SYNOPSIS
24.In openssl/asn1.h
25.Ft int
26.Fo a2d_ASN1_OBJECT
27.Fa "unsigned char *der_out"
28.Fa "int olen"
29.Fa "const char *val_in"
30.Fa "int ilen"
31.Fc
32.Sh DESCRIPTION
33.Fn a2d_ASN1_OBJECT
34accepts an ASCII string
35.Fa val_in
36of
37.Fa ilen
38bytes and interprets it as the numerical form of an ASN.1 object identifier.
39It writes the content octets of the DER encoding of the object identifier
40to the buffer
41.Fa der_out
42which is
43.Fa olen
44bytes long.
45The identifier and length octets of the DER encoding are not written.
46.Pp
47If
48.Fa ilen
49is \-1, the
50.Xr strlen 3
51of
52.Fa val_in
53is used instead.
54.Pp
55If
56.Fa der_out
57is a
58.Dv NULL
59pointer, writing the content octets is skipped
60and only the return value is calculated.
61.Sh RETURN VALUES
62.Fn a2d_ASN1_OBJECT
63returns the number of content octets that were or would be written or 0 if
64.Fa ilen
65is 0, if
66.Fa val_in
67is not a valid representation of an object identifier,
68if memory allocation fails, or if the number of content octets
69would be larger than
70.Fa olen .
71.Sh SEE ALSO
72.Xr ASN1_OBJECT_new 3 ,
73.Xr i2d_ASN1_OBJECT 3 ,
74.Xr OBJ_create 3
75.Sh STANDARDS
76ITU-T Recommendation X.690, also known as ISO/IEC 8825-1:
77Information technology - ASN.1 encoding rules:
78Specification of Basic Encoding Rules (BER), Canonical Encoding
79Rules (CER) and Distinguished Encoding Rules (DER),
80section 8.19: Encoding of an object identifier value
81.Sh HISTORY
82.Fn a2d_ASN1_OBJECT
83first appeared in SSLeay 0.8.0 and has been available since
84.Ox 2.4 .
85