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
|
<?xml version="1.0" encoding="UTF-8"?>
<refentry id="scasn1encode">
<refentryinfo><title>OpenSC API Reference</title></refentryinfo>
<refmeta>
<refentrytitle>sc_asn1_encode</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>opensc</refmiscinfo>
</refmeta>
<refnamediv>
<refname>sc_asn1_encode</refname>
<refpurpose>Encode ASN.1 entries into a stream</refpurpose>
</refnamediv>
<refsect1>
<title>Synopsis</title>
<para>
<programlisting>
#include <opensc.h>
int sc_asn1_encode(struct sc_context *ctx, const struct sc_asn1_entry *asn1,
unsigned char **newbuf, size_t *size);
</programlisting>
</para>
</refsect1>
<refsect1>
<title>Description</title>
<para>
This function encodes an array of entries pointed to by <emphasis>asn1</emphasis> and terminated
by a NULL entry (i.e. where the <structfield>name</structfield> field of the entry is NULL) into
a newly allocated buffer.
</para>
<para>
The new buffer containing the ASN.1 stream will be stored in <emphasis>newbuf</emphasis>, and the
size of this buffer is stored in <emphasis>size</emphasis>. The application must free this buffer
after use.
</para>
</refsect1>
<refsect1>
<title>Return value</title>
<para>
Returns 0 if successful, or a negative value in case of error.
</para>
</refsect1>
</refentry>
|