summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/PEM_write_bio_ASN1_stream.3
blob: 7b965e7b764f1e6a9762467973f05fb885c579a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
.\" $OpenBSD: PEM_write_bio_ASN1_stream.3,v 1.1 2021/12/13 18:55:22 schwarze Exp $
.\"
.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" 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.