1.\" $OpenBSD: d2i_CMS_ContentInfo.3,v 1.3 2019/11/02 15:39:46 schwarze Exp $ 2.\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> 3.\" 4.\" Permission to use, copy, modify, and distribute this software for any 5.\" purpose with or without fee is hereby granted, provided that the above 6.\" copyright notice and this permission notice appear in all copies. 7.\" 8.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15.\" 16.Dd $Mdocdate: November 2 2019 $ 17.Dt D2I_CMS_CONTENTINFO 3 18.Os 19.Sh NAME 20.Nm d2i_CMS_ContentInfo , 21.Nm i2d_CMS_ContentInfo , 22.Nm d2i_CMS_bio , 23.Nm i2d_CMS_bio , 24.Nm d2i_CMS_ReceiptRequest , 25.Nm i2d_CMS_ReceiptRequest 26.Nd decode and encode Cryptographic Message Syntax data 27.Sh SYNOPSIS 28.In openssl/cms.h 29.Ft CMS_ContentInfo * 30.Fo d2i_CMS_ContentInfo 31.Fa "CMS_ContentInfo **val_out" 32.Fa "const unsigned char **der_in" 33.Fa "long length" 34.Fc 35.Ft int 36.Fo i2d_CMS_ContentInfo 37.Fa "CMS_ContentInfo *val_in" 38.Fa "unsigned char **out" 39.Fc 40.Ft CMS_ContentInfo * 41.Fo d2i_CMS_bio 42.Fa "BIO *in_bio" 43.Fa "CMS_ContentInfo **val_out" 44.Fc 45.Ft int 46.Fo i2d_CMS_bio 47.Fa "BIO *out_bio" 48.Fa "CMS_ContentInfo *val_in" 49.Fc 50.Ft CMS_ReceiptRequest * 51.Fo d2i_CMS_ReceiptRequest 52.Fa "CMS_ReceiptRequest **val_out" 53.Fa "const unsigned char **der_in" 54.Fa "long length" 55.Fc 56.Ft int 57.Fo i2d_CMS_ReceiptRequest 58.Fa "CMS_ReceiptRequest *val_in" 59.Fa "unsigned char **out" 60.Fc 61.Sh DESCRIPTION 62These functions decode and encode Cryptographic Message Syntax 63data structures. 64For details about the semantics, examples, caveats, and bugs, see 65.Xr ASN1_item_d2i 3 . 66.Pp 67.Fn d2i_CMS_ContentInfo 68and 69.Fn i2d_CMS_ContentInfo 70decode and encode a 71.Vt CMS_ContentInfo 72structure defined in RFC 5652 section 3. 73.Fn d2i_CMS_bio 74and 75.Fn i2d_CMS_bio 76are similar except that they decode or encode using a 77.Vt BIO 78pointer. 79.Pp 80.Fn d2i_CMS_ReceiptRequest 81and 82.Fn i2d_CMS_ReceiptRequest 83decode and encode a 84.Vt CMS_ReceiptRequest 85structure defined in RFC 2634 section 2.7. 86.Sh RETURN VALUES 87.Fn d2i_CMS_ContentInfo 88and 89.Fn d2i_CMS_bio 90return a valid 91.Vt CMS_ContentInfo 92structure or 93.Dv NULL 94if an error occurs. 95.Pp 96.Fn d2i_CMS_ReceiptRequest 97returns a valid 98.Vt CMS_ReceiptRequest 99structure or 100.Dv NULL 101if an error occurs. 102.Pp 103.Fn i2d_CMS_ContentInfo 104and 105.Fn i2d_CMS_ReceiptRequest 106return the number of bytes successfully encoded 107or a negative value if an error occurs. 108.Pp 109.Fn i2d_CMS_bio 110returns 1 for success or 0 if an error occurs. 111.Pp 112For all functions, the error code can be obtained by 113.Xr ERR_get_error 3 . 114.Sh SEE ALSO 115.Xr ASN1_item_d2i 3 , 116.Xr CMS_ContentInfo_new 3 , 117.Xr CMS_get0_type 3 , 118.Xr CMS_ReceiptRequest_create0 3 , 119.Xr i2d_CMS_bio_stream 3 120.Sh STANDARDS 121RFC 5652: Cryptographic Message Syntax, section 3: General Syntax 122.Pp 123RFC 2634: Enhanced Security Services for S/MIME, 124section 2.7: Receipt Request Syntax 125.Sh HISTORY 126These functions first appeared in OpenSSL 0.9.8h 127and have been available since 128.Ox 6.7 . 129