PEM_WRITE_BIO_ASN1_STREAM(3)

NAME
PEM_write_bio_ASN1_stream - generic PEM encoder

SYNOPSIS
#include <openssl/asn1.h>
int
PEM_write_bio_ASN1_stream(BIO *out_bio, ASN1_VALUE *val_in, BIO *in_bio, int flags, const char *hdr, const ASN1_ITEM *it);

DESCRIPTION
PEM_write_bio_ASN1_stream() writes the val_in argument of type it to out_bio in PEM format, that is, BER- and base64-encoded and surrounded by "-----BEGIN ...-----" and "-----END ...-----" lines with the hdr argument in place of the ellipses.

The flags are passed through to i2d_ASN1_bio_stream(3). In particular, if the bit SMIME_STREAM is set, streaming is performed, reading the content from in_bio. Streaming is only supported if val_in is of the type CMS_ContentInfo or PKCS7.

If the bit SMIME_STREAM is not set, the arguments in_bio and flags are ignored and distinguished encoding rules (DER) are used.

RETURN VALUES
PEM_write_bio_ASN1_stream() is intended to return 1 on success or 0 on failure.

SEE ALSO
ASN1_item_i2d_bio(3), BIO_f_base64(3), BIO_new(3), i2d_ASN1_bio_stream(3), PEM_write_bio(3), PEM_write_bio_CMS_stream(3), PEM_write_bio_PKCS7_stream(3)

HISTORY
PEM_write_bio_ASN1_stream() first appeared in OpenSSL 1.0.0 and has been available since OpenBSD 4.9.

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.