#ifndef ASN1_H
#define ASN1_H


#include <vector>


class ASN1Object
{
public:
  ASN1Object(const std::vector<uint8_t>& asn1_encoded_data);
  void Print(int indent = 0) const;
private:
  // Type tags from documentation here:
  //   https://msdn.microsoft.com/en-us/library/windows/desktop/bb540791(v=vs.85).aspx
  //   https://msdn.microsoft.com/en-us/library/windows/desktop/bb648642(v=vs.85).aspx
  enum ASN1Type {
    ASN1_Invalid         = 0x00,
    ASN1_Boolean         = 0x01,
    ASN1_Integer         = 0x02,
    ASN1_BitString       = 0x03,
    ASN1_OctetString     = 0x04,
    ASN1_Null            = 0x05,
    ASN1_ObjectId        = 0x06,
    ASN1_UTF8String      = 0x0C,
    ASN1_PrintableString = 0x13,
    ASN1_TeletexString   = 0x14,
    ASN1_IA5String       = 0x16,
    ASN1_BMPString       = 0x1E,
    ASN1_Sequence        = 0x30,
    ASN1_Set             = 0x31
  };
  ASN1Type                m_type;
  std::vector<uint8_t>    m_data;
  std::vector<ASN1Object> m_children;
  size_t                  m_tmp;
};

#endif // ASN1_H

