diff options
Diffstat (limited to 'src/lib/libcrypto/man/BIO_f_base64.3')
-rw-r--r-- | src/lib/libcrypto/man/BIO_f_base64.3 | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/BIO_f_base64.3 b/src/lib/libcrypto/man/BIO_f_base64.3 new file mode 100644 index 0000000000..e08191b84a --- /dev/null +++ b/src/lib/libcrypto/man/BIO_f_base64.3 | |||
@@ -0,0 +1,80 @@ | |||
1 | .Dd July 17, 2014 | ||
2 | .Dt BIO_F_BASE64 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm BIO_f_base64 | ||
6 | .Nd base64 BIO filter | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/bio.h | ||
9 | .In openssl/evp.h | ||
10 | .Ft BIO_METHOD * | ||
11 | .Fo BIO_f_base64 | ||
12 | .Fa void | ||
13 | .Fc | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn BIO_f_base64 | ||
16 | returns the base64 BIO method. | ||
17 | This is a filter BIO that base64 encodes any data written through it | ||
18 | and decodes any data read through it. | ||
19 | .Pp | ||
20 | Base64 BIOs do not support | ||
21 | .Xr BIO_gets 3 | ||
22 | or | ||
23 | .Xr BIO_puts 3 . | ||
24 | .Pp | ||
25 | .Xr BIO_flush 3 | ||
26 | on a base64 BIO that is being written through | ||
27 | is used to signal that no more data is to be encoded: | ||
28 | this is used to flush the final block through the BIO. | ||
29 | .Pp | ||
30 | The flag | ||
31 | .Dv BIO_FLAGS_BASE64_NO_NL | ||
32 | can be set with | ||
33 | .Xr BIO_set_flags 3 | ||
34 | to encode the data all on one line | ||
35 | or expect the data to be all on one line. | ||
36 | .Sh NOTES | ||
37 | Because of the format of base64 encoding the end of the encoded | ||
38 | block cannot always be reliably determined. | ||
39 | .Sh RETURN VALUES | ||
40 | .Fn BIO_f_base64 | ||
41 | returns the base64 BIO method. | ||
42 | .Sh EXAMPLES | ||
43 | Base64 encode the string "Hello World\en" | ||
44 | and write the result to standard output: | ||
45 | .Bd -literal -offset indent | ||
46 | BIO *bio, *b64; | ||
47 | char message[] = "Hello World \en"; | ||
48 | |||
49 | b64 = BIO_new(BIO_f_base64()); | ||
50 | bio = BIO_new_fp(stdout, BIO_NOCLOSE); | ||
51 | BIO_push(b64, bio); | ||
52 | BIO_write(b64, message, strlen(message)); | ||
53 | BIO_flush(b64); | ||
54 | |||
55 | BIO_free_all(b64); | ||
56 | .Ed | ||
57 | .Pp | ||
58 | Read Base64 encoded data from standard input | ||
59 | and write the decoded data to standard output: | ||
60 | .Bd -literal -offset indent | ||
61 | BIO *bio, *b64, *bio_out; | ||
62 | char inbuf[512]; | ||
63 | int inlen; | ||
64 | |||
65 | b64 = BIO_new(BIO_f_base64()); | ||
66 | bio = BIO_new_fp(stdin, BIO_NOCLOSE); | ||
67 | bio_out = BIO_new_fp(stdout, BIO_NOCLOSE); | ||
68 | BIO_push(b64, bio); | ||
69 | while((inlen = BIO_read(b64, inbuf, 512)) > 0) | ||
70 | BIO_write(bio_out, inbuf, inlen); | ||
71 | |||
72 | BIO_flush(bio_out); | ||
73 | BIO_free_all(b64); | ||
74 | .Ed | ||
75 | .Sh BUGS | ||
76 | The ambiguity of EOF in base64 encoded data can cause additional | ||
77 | data following the base64 encoded block to be misinterpreted. | ||
78 | .Pp | ||
79 | There should be some way of specifying a test that the BIO can perform | ||
80 | to reliably determine EOF (for example a MIME boundary). | ||