---
name: "sc_asn1_put_tag"
section: "3"
platform: "linux"
package: "libopensc2-dev"
version: "0.11.13-1.1"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/sc_asn1_put_tag"
---

# sc\_asn1\_put\_tag(3)

Construct an ASN.1 entry in a buffer

## NAME

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.
