.\" $OpenBSD: PEM_write_bio_ASN1_stream.3,v 1.1 2021/12/13 18:55:22 schwarze Exp $ .\" .\" Copyright (c) 2021 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: December 13 2021 $ .Dt PEM_WRITE_BIO_ASN1_STREAM 3 .Os .Sh NAME .Nm PEM_write_bio_ASN1_stream .Nd generic PEM encoder .Sh SYNOPSIS .In openssl/asn1.h .Ft int .Fo PEM_write_bio_ASN1_stream .Fa "BIO *out_bio" .Fa "ASN1_VALUE *val_in" .Fa "BIO *in_bio" .Fa "int flags" .Fa "const char *hdr" .Fa "const ASN1_ITEM *it" .Fc .Sh DESCRIPTION .Fn PEM_write_bio_ASN1_stream writes the .Fa val_in argument of type .Fa it to .Fa out_bio in PEM format, that is, BER- and base64-encoded and surrounded by .Qq -----BEGIN ...----- and .Qq -----END ...----- lines with the .Fa hdr argument in place of the ellipses. .Pp The .Fa flags are passed through to .Xr i2d_ASN1_bio_stream 3 . In particular, if the bit .Dv SMIME_STREAM is set, streaming is performed, reading the content from .Fa in_bio . Streaming is only supported if .Fa val_in is of the type .Vt CMS_ContentInfo or .Vt PKCS7 . .Pp If the bit .Dv SMIME_STREAM is not set, the arguments .Fa in_bio and .Fa flags are ignored and distinguished encoding rules (DER) are used. .Sh RETURN VALUES .Fn PEM_write_bio_ASN1_stream is intended to return 1 on success or 0 on failure. .Sh SEE ALSO .Xr ASN1_item_i2d_bio 3 , .Xr BIO_f_base64 3 , .Xr BIO_new 3 , .Xr i2d_ASN1_bio_stream 3 , .Xr PEM_write_bio 3 , .Xr PEM_write_bio_CMS_stream 3 , .Xr PEM_write_bio_PKCS7_stream 3 .Sh HISTORY .Fn PEM_write_bio_ASN1_stream first appeared in OpenSSL 1.0.0 and has been available since .Ox 4.9 . .Sh BUGS Many kinds of errors are silently ignored. This function may return 1 even if it only produced partial output or no output at all.