D2I_GENERAL_NAME(3) | Library Functions Manual | D2I_GENERAL_NAME(3)

# NAME

`d2i_GENERAL_NAME`, `i2d_GENERAL_NAME`, `d2i_GENERAL_NAMES`, `i2d_GENERAL_NAMES`, `d2i_EDIPARTYNAME`, `i2d_EDIPARTYNAME`, `d2i_OTHERNAME`, `i2d_OTHERNAME` — decode and encode names for use in X.509 extensions

# SYNOPSIS

library “libcrypto”
`#include <openssl/x509v3.h>`

GENERAL_NAME *
`d2i_GENERAL_NAME`(GENERAL_NAME **val_out, const unsigned char **der_in, long length);

int
`i2d_GENERAL_NAME`(GENERAL_NAME *val_in, unsigned char **der_out);

GENERAL_NAMES *
`d2i_GENERAL_NAMES`(GENERAL_NAMES **val_out, const unsigned char **der_in, long length);

int
`i2d_GENERAL_NAMES`(GENERAL_NAMES *val_in, unsigned char **der_out);

EDIPARTYNAME *
`d2i_EDIPARTYNAME`(EDIPARTYNAME **val_out, const unsigned char **der_in, long length);

int
`i2d_EDIPARTYNAME`(EDIPARTYNAME *val_in, unsigned char **der_out);

OTHERNAME *
`d2i_OTHERNAME`(OTHERNAME **val_out, const unsigned char **der_in, long length);

int
`i2d_OTHERNAME`(OTHERNAME *val_in, unsigned char **der_out);

# DESCRIPTION

These functions decode and encode names that can be used in X.509 extensions. For details about the semantics, examples, caveats, and bugs, see ASN1_item_d2i(3).

`d2i_GENERAL_NAME`() and `i2d_GENERAL_NAME`() decode and encode an ASN.1 GeneralName structure defined in RFC 5280 section 4.2.1.6.

`d2i_GENERAL_NAMES`() and `i2d_GENERAL_NAMES`() decode and encode an ASN.1 GeneralNames structure defined in RFC 5280 section 4.2.1.6.

`d2i_EDIPARTYNAME`() and `i2d_EDIPARTYNAME`() decode and encode an ASN.1 EDIPartyName structure defined in RFC 5280 section 4.2.1.6.

`d2i_OTHERNAME`() and `i2d_OTHERNAME`() decode and encode an ASN.1 OtherName structure defined in RFC 5280 section 4.2.1.6.

# RETURN VALUES

`d2i_GENERAL_NAME`(), `d2i_GENERAL_NAMES`(), `d2i_EDIPARTYNAME`(), and `d2i_OTHERNAME`() return a GENERAL_NAME, GENERAL_NAMES, EDIPARTYNAME, or OTHERNAME object, respectively, or `NULL` if an error occurs.

`i2d_GENERAL_NAME`(), `i2d_GENERAL_NAMES`(), `i2d_EDIPARTYNAME`(), and `i2d_OTHERNAME`() return the number of bytes successfully encoded or a negative value if an error occurs.

# SEE ALSO

ASN1_item_d2i(3), d2i_X509_NAME(3), GENERAL_NAME_new(3), X509_EXTENSION_new(3)

# STANDARDS

RFC 5280: Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile, section 4.2: Certificate Extensions

# HISTORY

`d2i_GENERAL_NAME`(), `i2d_GENERAL_NAME`(), `d2i_GENERAL_NAMES`(), and `i2d_GENERAL_NAMES`() first appeared in OpenSSL 0.9.2b and have been available since OpenBSD 2.6.

`d2i_OTHERNAME`() and `i2d_OTHERNAME`() first appeared in OpenSSL 0.9.5 and have been available since OpenBSD 2.7.

`d2i_EDIPARTYNAME`() and `i2d_EDIPARTYNAME`() first appeared in OpenSSL 0.9.7 and have been available since OpenBSD 3.2.

June 8, 2025 | Debian