xref: /dflybsd-src/lib/libc/net/base64.3 (revision ea3dc9921401b579b2d0f2f0f8e226e392d468fb)
1*ea3dc992SAaron LI.\" Copyright (c) 2022 The DragonFly Project.  All rights reserved.
2*ea3dc992SAaron LI.\"
3*ea3dc992SAaron LI.\" Redistribution and use in source and binary forms, with or without
4*ea3dc992SAaron LI.\" modification, are permitted provided that the following conditions
5*ea3dc992SAaron LI.\" are met:
6*ea3dc992SAaron LI.\"
7*ea3dc992SAaron LI.\" 1. Redistributions of source code must retain the above copyright
8*ea3dc992SAaron LI.\"    notice, this list of conditions and the following disclaimer.
9*ea3dc992SAaron LI.\" 2. Redistributions in binary form must reproduce the above copyright
10*ea3dc992SAaron LI.\"    notice, this list of conditions and the following disclaimer in
11*ea3dc992SAaron LI.\"    the documentation and/or other materials provided with the
12*ea3dc992SAaron LI.\"    distribution.
13*ea3dc992SAaron LI.\" 3. Neither the name of The DragonFly Project nor the names of its
14*ea3dc992SAaron LI.\"    contributors may be used to endorse or promote products derived
15*ea3dc992SAaron LI.\"    from this software without specific, prior written permission.
16*ea3dc992SAaron LI.\"
17*ea3dc992SAaron LI.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18*ea3dc992SAaron LI.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19*ea3dc992SAaron LI.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20*ea3dc992SAaron LI.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
21*ea3dc992SAaron LI.\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22*ea3dc992SAaron LI.\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
23*ea3dc992SAaron LI.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24*ea3dc992SAaron LI.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25*ea3dc992SAaron LI.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26*ea3dc992SAaron LI.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
27*ea3dc992SAaron LI.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28*ea3dc992SAaron LI.\" SUCH DAMAGE.
29*ea3dc992SAaron LI.\"
30*ea3dc992SAaron LI.Dd May 1, 2022
31*ea3dc992SAaron LI.Dt BASE64 3
32*ea3dc992SAaron LI.Os
33*ea3dc992SAaron LI.Sh NAME
34*ea3dc992SAaron LI.Nm base64 ,
35*ea3dc992SAaron LI.Nm b64_ntop ,
36*ea3dc992SAaron LI.Nm b64_pton
37*ea3dc992SAaron LI.Nd base64 encode and decode
38*ea3dc992SAaron LI.Sh LIBRARY
39*ea3dc992SAaron LI.Lb libc
40*ea3dc992SAaron LI.Sh SYNOPSIS
41*ea3dc992SAaron LI.In resolv.h
42*ea3dc992SAaron LI.Ft int
43*ea3dc992SAaron LI.Fo b64_ntop
44*ea3dc992SAaron LI.Fa "const unsigned char *src"
45*ea3dc992SAaron LI.Fa "size_t srclength"
46*ea3dc992SAaron LI.Fa "char *target"
47*ea3dc992SAaron LI.Fa "size_t targsize"
48*ea3dc992SAaron LI.Fc
49*ea3dc992SAaron LI.Ft int
50*ea3dc992SAaron LI.Fo b64_pton
51*ea3dc992SAaron LI.Fa "const char *src"
52*ea3dc992SAaron LI.Fa "unsigned char *target"
53*ea3dc992SAaron LI.Fa "size_t targsize"
54*ea3dc992SAaron LI.Fc
55*ea3dc992SAaron LI.Sh DESCRIPTION
56*ea3dc992SAaron LI.Fn B64_ntop
57*ea3dc992SAaron LIencodes the input data
58*ea3dc992SAaron LI.Fa src
59*ea3dc992SAaron LIof length
60*ea3dc992SAaron LI.Fa srclength ,
61*ea3dc992SAaron LIand writes the encoded string to
62*ea3dc992SAaron LI.Fa target
63*ea3dc992SAaron LIof capacity
64*ea3dc992SAaron LI.Fa targsize .
65*ea3dc992SAaron LIThe output buffer
66*ea3dc992SAaron LI.Fa target
67*ea3dc992SAaron LIshould be big enough to hold the encoded string,
68*ea3dc992SAaron LIincluding the terminating NUL character.
69*ea3dc992SAaron LIOn success,
70*ea3dc992SAaron LI.Fa target
71*ea3dc992SAaron LIholds the encoded string and its length
72*ea3dc992SAaron LI(without accounting for the NUL terminator) is returned.
73*ea3dc992SAaron LIOtherwise, a value of \-1 is returned.
74*ea3dc992SAaron LI.Pp
75*ea3dc992SAaron LI.Fn B64_pton
76*ea3dc992SAaron LIdecodes the base64 string
77*ea3dc992SAaron LI.Fa src
78*ea3dc992SAaron LIand writes the decoded data to
79*ea3dc992SAaron LI.Fa target
80*ea3dc992SAaron LIof capacity
81*ea3dc992SAaron LI.Fa targsize .
82*ea3dc992SAaron LIOn success,
83*ea3dc992SAaron LI.Fa target
84*ea3dc992SAaron LIholds the decoded data and its length is returned.
85*ea3dc992SAaron LIOtherwise, a value of \-1 is returned.
86*ea3dc992SAaron LIIf the output buffer
87*ea3dc992SAaron LI.Fa target
88*ea3dc992SAaron LIis
89*ea3dc992SAaron LI.Dv NULL ,
90*ea3dc992SAaron LI.Fn b64_pton
91*ea3dc992SAaron LIreturns the required length to hold the decoded data.
92*ea3dc992SAaron LI.Sh RETURN VALUES
93*ea3dc992SAaron LIThe
94*ea3dc992SAaron LI.Nm base64
95*ea3dc992SAaron LIfunctions return the length of the result if successful;
96*ea3dc992SAaron LIotherwise the value \-1 is returned.
97*ea3dc992SAaron LI.Sh SEE ALSO
98*ea3dc992SAaron LI.Xr openssl 1
99*ea3dc992SAaron LI.Rs
100*ea3dc992SAaron LI.%R RFC
101*ea3dc992SAaron LI.%N 1521
102*ea3dc992SAaron LI.%D September 1993
103*ea3dc992SAaron LI.%T "MIME (Multipurpose Internet Mail Extensions) Part One"
104*ea3dc992SAaron LI.Re
105*ea3dc992SAaron LI.Sh HISTORY
106*ea3dc992SAaron LIThe
107*ea3dc992SAaron LI.Nm base64
108*ea3dc992SAaron LIfunctions appeared in
109*ea3dc992SAaron LI.Fx 3.0 .
110*ea3dc992SAaron LI.Sh AUTHORS
111*ea3dc992SAaron LI.An -nosplit
112*ea3dc992SAaron LIThis manual page was written by
113*ea3dc992SAaron LI.An Aaron LI Aq Mt aly@aaronly.me .
114