OpenSC API Reference sc_asn1_encode 3 opensc sc_asn1_encode Encode ASN.1 entries into a stream Synopsis #include <opensc.h> int sc_asn1_encode(struct sc_context *ctx, const struct sc_asn1_entry *asn1, unsigned char **newbuf, size_t *size); Description This function encodes an array of entries pointed to by asn1 and terminated by a NULL entry (i.e. where the name field of the entry is NULL) into a newly allocated buffer. The new buffer containing the ASN.1 stream will be stored in newbuf, and the size of this buffer is stored in size. The application must free this buffer after use. Return value Returns 0 if successful, or a negative value in case of error.