.\" $OpenBSD: d2i_ASN1_NULL.3,v 1.2 2018/03/22 16:06:33 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 22 2018 $ .Dt D2I_ASN1_NULL 3 .Os .Sh NAME .Nm d2i_ASN1_NULL , .Nm i2d_ASN1_NULL .Nd decode and encode an ASN.1 NULL type .Sh SYNOPSIS .In openssl/asn1.h .Ft ASN1_NULL * .Fo d2i_ASN1_NULL .Fa "ASN1_NULL **val_out" .Fa "const unsigned char **der_in" .Fa "long length" .Fc .Ft int .Fo i2d_ASN1_NULL .Fa "ASN1_NULL *val_in" .Fa "unsigned char **der_out" .Fc .Sh DESCRIPTION These functions decode and encode the ASN.1 value NULL of type NULL. For details about the semantics, examples, caveats, and bugs, see .Xr ASN1_item_d2i 3 . .Pp .Fn d2i_ASN1_NULL verifies that the BER-encoded value at .Pf * Fa der_in is NULL and of type NULL. It fails if .Fa length is less than 2 or if the first two bytes of .Pf * Fa der_in differ from 0x05 and 0x00. In case of success, .Pf * Fa der_in is advanced by two bytes and .Pf * Fa val_out is set to a specific invalid pointer representing the unique .Vt ASN1_NULL object. .Pp .Fn i2d_ASN1_NULL ignores .Fa val_in and encodes the ASN.1 value NULL of type NULL using DER. Specifically, it writes the identifier octet for the type NULL, 0x05, followed by the length octet 0x00, and no content or end-of-content octets. .Sh RETURN VALUES .Fn d2i_ASN1_NULL returns a specific invalid pointer representing the unique .Vt ASN1_NULL object or .Dv NULL if an error occurs. .Pp .Fn i2d_ASN1_NULL returns 2 if successful or 0 if an error occurs. .Sh SEE ALSO .Xr ASN1_item_d2i 3 , .Xr ASN1_item_new 3 .Sh STANDARDS ITU-T Recommendation X.690, also known as ISO/IEC 8825-1: Information technology - ASN.1 encoding rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER), section 8.8: Encoding of null value .Sh HISTORY .Fn d2i_ASN1_NULL and .Fn i2d_ASN1_NULL first appeared in OpenSSL 0.9.5 and have been available since .Ox 2.7 .