opensc/doc/api/util/sc_base64_encode.xml

50 lines
1.4 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<refentry id="scbase64encode">
<refentryinfo><title>OpenSC API Reference</title></refentryinfo>
<refmeta>
<refentrytitle>sc_base64_encode</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>opensc</refmiscinfo>
</refmeta>
<refnamediv>
<refname>sc_base64_encode</refname>
<refpurpose>Encode a stream to base64</refpurpose>
</refnamediv>
<refsect1>
<title>Synopsis</title>
<para>
<programlisting>
#include &lt;opensc.h&gt;
int sc_base64_encode(const unsigned char *inbuf, size_t inlen,
unsigned char *outbuf, size_t outlen,
size_t linelength);
</programlisting>
</para>
</refsect1>
<refsect1>
<title>Description</title>
<para>
This function encodes the buffer pointed to by <emphasis>inbuf</emphasis> of size
<emphasis>inlen</emphasis> as base64, and stores the result in <emphasis>outbuf</emphasis>, which
is <emphasis>outlen</emphasis> bytes long. A linefeed (\n) will be inserted every
<emphasis>linelength</emphasis> bytes in the output buffer.
</para>
<para>
You must ensure <emphasis>outbuf</emphasis> has enough space to store the base64-encoded version
of <emphasis>inbuf</emphasis>.
</para>
</refsect1>
<refsect1>
<title>Return value</title>
<para>
Returns 0 if successful, or a negative value in case of error.
</para>
</refsect1>
</refentry>