Sortix
Sortix Download Manual Development Source Code News Blog More
current nightly

Sortix cross-nightly manual

This manual documents Sortix cross-nightly. You can instead view this document in the latest official manual.

NAME

d2i_CMS_ContentInfo, i2d_CMS_ContentInfo, d2i_CMS_bio, i2d_CMS_bio, d2i_CMS_ReceiptRequest, i2d_CMS_ReceiptRequest — decode and encode Cryptographic Message Syntax data

SYNOPSIS

#include <openssl/cms.h>
CMS_ContentInfo *
d2i_CMS_ContentInfo(CMS_ContentInfo **val_out, const unsigned char **der_in, long length);
int
i2d_CMS_ContentInfo(CMS_ContentInfo *val_in, unsigned char **out);
CMS_ContentInfo *
d2i_CMS_bio(BIO *in_bio, CMS_ContentInfo **val_out);
int
i2d_CMS_bio(BIO *out_bio, CMS_ContentInfo *val_in);
CMS_ReceiptRequest *
d2i_CMS_ReceiptRequest(CMS_ReceiptRequest **val_out, const unsigned char **der_in, long length);
int
i2d_CMS_ReceiptRequest(CMS_ReceiptRequest *val_in, unsigned char **out);

DESCRIPTION

These functions decode and encode Cryptographic Message Syntax data structures. For details about the semantics, examples, caveats, and bugs, see ASN1_item_d2i(3).
d2i_CMS_ContentInfo() and i2d_CMS_ContentInfo() decode and encode a CMS_ContentInfo structure defined in RFC 5652 section 3. d2i_CMS_bio() and i2d_CMS_bio() are similar except that they decode or encode using a BIO pointer.
d2i_CMS_ReceiptRequest() and i2d_CMS_ReceiptRequest() decode and encode a CMS_ReceiptRequest structure defined in RFC 2634 section 2.7.

RETURN VALUES

d2i_CMS_ContentInfo() and d2i_CMS_bio() return a valid CMS_ContentInfo structure or NULL if an error occurs.
d2i_CMS_ReceiptRequest() returns a valid CMS_ReceiptRequest structure or NULL if an error occurs.
i2d_CMS_ContentInfo() and i2d_CMS_ReceiptRequest() return the number of bytes successfully encoded or a negative value if an error occurs.
i2d_CMS_bio() returns 1 for success or 0 if an error occurs.
For all functions, the error code can be obtained by ERR_get_error(3).

SEE ALSO

ASN1_item_d2i(3), CMS_ContentInfo_new(3), CMS_get0_type(3), CMS_ReceiptRequest_create0(3), i2d_CMS_bio_stream(3)

STANDARDS

RFC 5652: Cryptographic Message Syntax, section 3: General Syntax
RFC 2634: Enhanced Security Services for S/MIME, section 2.7: Receipt Request Syntax

HISTORY

These functions first appeared in OpenSSL 0.9.8h and have been available since OpenBSD 6.7.
Copyright 2011-2025 Jonas 'Sortie' Termansen and contributors.
Sortix's source code is free software under the ISC license.
#sortix on irc.sortix.org
@sortix_org