# OpenSC API Reference

sc_asn1_find_tag
3
opensc

# sc_asn1_find_tag

Find a tag in an ASN.1 stream

## Synopsis

    #include <opensc.h>

    const unsigned char *sc_asn1_find_tag(struct sc_context *ctx,
                                          const unsigned char *buf, size_t buflen,
                                          unsigned int tag_in, size_t *taglen_in);

## Description

This function tries to find an ASN.1 tag matching tag_in in the buffer pointed to by buf, which is of size buflen. The buffer should contain a series of ASN.1 entries.

## Return value

If the specified tag was not found, NULL is returned. If found, the address where it was found is returned, and taglen_in is set to the length of the found tag.