Home > Articles > Programming > C/C++

  • Print
  • + Share This
Like this article? We recommend

Like this article? We recommend

A Sequence Parser

Listing 5 illustrates the parsing code for a sequence type.

Listing 5 Sequence Parser

    case SEQ_CLASS:
      printf("ASN element type is SEQUENCE 0x%x\n", dataSetType);
      printf("ASN element length is %d\n", elementLength);
      *offset += 2;
      parseAsnElement(dataSet, offset, elementLength, overallLength);
      break;

As before, we extract the sequence data. Move the offset along and then recursively call into parseAsnElement(). If you look at the data in Listing 2, you’ll see that the sequence ASN.1 element actually contains the other data items. The program starts by processing the sequence element and then looks inside it recursively to extract the other data items.

  • + Share This
  • 🔖 Save To Your Account