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