summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/BIO_f_base64.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/man/BIO_f_base64.3')
-rw-r--r--src/lib/libcrypto/man/BIO_f_base64.3148
1 files changed, 0 insertions, 148 deletions
diff --git a/src/lib/libcrypto/man/BIO_f_base64.3 b/src/lib/libcrypto/man/BIO_f_base64.3
deleted file mode 100644
index e4589de035..0000000000
--- a/src/lib/libcrypto/man/BIO_f_base64.3
+++ /dev/null
@@ -1,148 +0,0 @@
1.\" $OpenBSD: BIO_f_base64.3,v 1.15 2023/09/11 04:00:40 jsg Exp $
2.\" OpenSSL fc1d88f0 Wed Jul 2 22:42:40 2014 -0400
3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
5.\" Copyright (c) 2000, 2003, 2005, 2014 The OpenSSL Project.
6.\" All rights reserved.
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\"
12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer.
14.\"
15.\" 2. Redistributions in binary form must reproduce the above copyright
16.\" notice, this list of conditions and the following disclaimer in
17.\" the documentation and/or other materials provided with the
18.\" distribution.
19.\"
20.\" 3. All advertising materials mentioning features or use of this
21.\" software must display the following acknowledgment:
22.\" "This product includes software developed by the OpenSSL Project
23.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
24.\"
25.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26.\" endorse or promote products derived from this software without
27.\" prior written permission. For written permission, please contact
28.\" openssl-core@openssl.org.
29.\"
30.\" 5. Products derived from this software may not be called "OpenSSL"
31.\" nor may "OpenSSL" appear in their names without prior written
32.\" permission of the OpenSSL Project.
33.\"
34.\" 6. Redistributions of any form whatsoever must retain the following
35.\" acknowledgment:
36.\" "This product includes software developed by the OpenSSL Project
37.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
38.\"
39.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\"
52.Dd $Mdocdate: September 11 2023 $
53.Dt BIO_F_BASE64 3
54.Os
55.Sh NAME
56.Nm BIO_f_base64
57.\" .Nm EVP_ENCODE_LENGTH and
58.\" .Nm EVP_DECODE_LENGTH are intentionally undocumented
59.\" because they are internal implementation details of BIO_f_base64(3)
60.\" and practically unused outside evp/bio_b64.c.
61.Nd base64 BIO filter
62.Sh SYNOPSIS
63.In openssl/bio.h
64.In openssl/evp.h
65.Ft const BIO_METHOD *
66.Fo BIO_f_base64
67.Fa void
68.Fc
69.Sh DESCRIPTION
70.Fn BIO_f_base64
71returns the base64 BIO method.
72This is a filter BIO that base64 encodes any data written through it
73and decodes any data read through it.
74.Pp
75Base64 BIOs do not support
76.Xr BIO_gets 3
77or
78.Xr BIO_puts 3 .
79.Pp
80.Xr BIO_flush 3
81on a base64 BIO that is being written through
82is used to signal that no more data is to be encoded:
83this is used to flush the final block through the BIO.
84.Pp
85To encode the data all on one line and to expect the data to be all
86on one line, initialize the base64 BIO as follows:
87.Bd -literal -offset indent
88BIO *b64 = BIO_new(BIO_f_base64());
89BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
90.Ed
91.Sh RETURN VALUES
92.Fn BIO_f_base64
93returns the base64 BIO method.
94.Pp
95When called on a base64 BIO object,
96.Xr BIO_method_type 3
97returns the constant
98.Dv BIO_TYPE_BASE64
99and
100.Xr BIO_method_name 3
101returns a pointer to the static string
102.Qq base64 encoding .
103.Sh EXAMPLES
104Base64 encode the string "hello, world\en"
105and write the result to standard output:
106.Bd -literal -offset indent
107BIO *bio, *b64;
108char message[] = "hello, world\en";
109
110b64 = BIO_new(BIO_f_base64());
111bio = BIO_new_fp(stdout, BIO_NOCLOSE);
112BIO_push(b64, bio);
113BIO_write(b64, message, strlen(message));
114BIO_flush(b64);
115
116BIO_free_all(b64);
117.Ed
118.Pp
119Read Base64-encoded data from standard input
120and write the decoded data to standard output:
121.Bd -literal -offset indent
122BIO *bio, *b64, *bio_out;
123char inbuf[512];
124int inlen;
125
126b64 = BIO_new(BIO_f_base64());
127bio = BIO_new_fp(stdin, BIO_NOCLOSE);
128bio_out = BIO_new_fp(stdout, BIO_NOCLOSE);
129BIO_push(b64, bio);
130while((inlen = BIO_read(b64, inbuf, 512)) > 0)
131 BIO_write(bio_out, inbuf, inlen);
132
133BIO_flush(bio_out);
134BIO_free_all(b64);
135.Ed
136.Sh SEE ALSO
137.Xr BIO_new 3 ,
138.Xr EVP_EncodeInit 3
139.Sh HISTORY
140.Fn BIO_f_base64
141first appeared in SSLeay 0.6.5 and has been available since
142.Ox 2.4 .
143.Sh BUGS
144The ambiguity of EOF in base64-encoded data can cause additional
145data following the base64-encoded block to be misinterpreted.
146.Pp
147There should be some way of specifying a test that the BIO can perform
148to reliably determine EOF (for example a MIME boundary).