D2I_POLICYINFO(3) | Library Functions Manual | D2I_POLICYINFO(3)

# NAME

`d2i_POLICYINFO`, `i2d_POLICYINFO`, `d2i_CERTIFICATEPOLICIES`, `i2d_CERTIFICATEPOLICIES`, `d2i_POLICYQUALINFO`, `i2d_POLICYQUALINFO`, `d2i_USERNOTICE`, `i2d_USERNOTICE`, `d2i_NOTICEREF`, `i2d_NOTICEREF` — decode and encode X.509 certificate policies

# SYNOPSIS

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

POLICYINFO *
`d2i_POLICYINFO`(POLICYINFO **val_out, const unsigned char **der_in, long length);

int
`i2d_POLICYINFO`(POLICYINFO *val_in, unsigned char **der_out);

CERTIFICATEPOLICIES *
`d2i_CERTIFICATEPOLICIES`(CERTIFICATEPOLICIES **val_out, const unsigned char **der_in, long length);

int
`i2d_CERTIFICATEPOLICIES`(CERTIFICATEPOLICIES *val_in, unsigned char **der_out);

POLICYQUALINFO *
`d2i_POLICYQUALINFO`(POLICYQUALINFO **val_out, const unsigned char **der_in, long length);

int
`i2d_POLICYQUALINFO`(POLICYQUALINFO *val_in, unsigned char **der_out);

USERNOTICE *
`d2i_USERNOTICE`(USERNOTICE **val_out, const unsigned char **der_in, long length);

int
`i2d_USERNOTICE`(USERNOTICE *val_in, unsigned char **der_out);

NOTICEREF *
`d2i_NOTICEREF`(NOTICEREF **val_out, const unsigned char **der_in, long length);

int
`i2d_NOTICEREF`(NOTICEREF *val_in, unsigned char **der_out);

# DESCRIPTION

These functions decode and encode X.509 certificate policies. For details about the semantics, examples, caveats, and bugs, see ASN1_item_d2i(3).

`d2i_POLICYINFO`() and `i2d_POLICYINFO`() decode and encode an ASN.1 PolicyInformation structure defined in RFC 5280 section 4.2.1.4.

`d2i_CERTIFICATEPOLICIES`() and `i2d_CERTIFICATEPOLICIES`() decode and encode an ASN.1 CertificatePolicies structure defined in RFC 5280 section 4.2.1.4.

`d2i_POLICYQUALINFO`() and `i2d_POLICYQUALINFO`() decode and encode an ASN.1 PolicyQualifierInfo structure defined in RFC 5280 section 4.2.1.4.

`d2i_USERNOTICE`() and `i2d_USERNOTICE`() decode and encode an ASN.1 UserNotice structure defined in RFC 5280 section 4.2.1.4.

`d2i_NOTICEREF`() and `i2d_NOTICEREF`() decode and encode an ASN.1 NoticeReference structure defined in RFC 5280 section 4.2.1.4.

# RETURN VALUES

`d2i_POLICYINFO`(), `d2i_CERTIFICATEPOLICIES`(), `d2i_POLICYQUALINFO`(), `d2i_USERNOTICE`(), and `d2i_NOTICEREF`() return a POLICYINFO, CERTIFICATEPOLICIES, POLICYQUALINFO, USERNOTICE, or NOTICEREF object, respectively, or `NULL` if an error occurs.

`i2d_POLICYINFO`(), `i2d_CERTIFICATEPOLICIES`(), `i2d_POLICYQUALINFO`(), `i2d_USERNOTICE`(), and `i2d_NOTICEREF`() return the number of bytes successfully encoded or a negative value if an error occurs.

# SEE ALSO

ASN1_item_d2i(3), POLICYINFO_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.1.4: Certificate Policies

# HISTORY

These functions first appeared in OpenSSL 0.9.3 and have been available since OpenBSD 2.6.

June 8, 2025 | Debian