# OpenSC API Reference

sc_asn1_put_tag
3
opensc

# sc_asn1_put_tag

Construct an ASN.1 entry in a buffer

## Synopsis

    #include <opensc.h>

    int sc_asn1_put_tag(int tag, const unsigned char *data, int datalen,
                        unsigned char *out, int outlen, unsigned char **nextbuf);

## Description

This function constructs a single entry in an ASN.1 stream, at the buffer pointed to by out (which is outlen bytes long). The tag to be used is in tag, and the entry payload is pointed to by data, which is datalen bytes long.

If nextbuf is not NULL, it will be filled in with a pointer to the buffer address immediately following the newly copied entry.

## Return value

Returns 0 if successful, or a negative value in case of error.