Virgil Security Crypto library  1.8.2
VirgilAsn1Reader.h
1 
37 #ifndef VIRGIL_CRYPTO_VIRGIL_ASN1_READER_H
38 #define VIRGIL_CRYPTO_VIRGIL_ASN1_READER_H
39 
40 #include <cstddef>
41 #include <string>
42 
43 #include <virgil/crypto/VirgilByteArray.h>
44 
45 namespace virgil { namespace crypto { namespace foundation { namespace asn1 {
46 
54 public:
59 
64  explicit VirgilAsn1Reader(const virgil::crypto::VirgilByteArray& data);
65 
69  ~VirgilAsn1Reader() throw();
73 
78  void reset(const virgil::crypto::VirgilByteArray& data);
80 
83 
87  int readInteger();
88 
92  bool readBool();
93 
97  void readNull();
98 
102  virgil::crypto::VirgilByteArray readOctetString();
103 
107  virgil::crypto::VirgilByteArray readUTF8String();
108 
112  virgil::crypto::VirgilByteArray readData();
113 
118  size_t readContextTag(unsigned char tag);
119 
124  std::string readOID();
126 
129 
134  size_t readSequence();
135 
140  size_t readSet();
142 private:
147  void checkState();
148 
152  VirgilAsn1Reader(const VirgilAsn1Reader& other);
153 
157  VirgilAsn1Reader& operator=(const VirgilAsn1Reader& rhs);
158 
159 private:
160  unsigned char* p_;
161  const unsigned char* end_;
162  virgil::crypto::VirgilByteArray data_;
163 };
164 
165 }}}}
166 
167 #endif /* VIRGIL_CRYPTO_VIRGIL_ASN1_READER_H */
This class provides methods for reading ASN.1 data structure.
Definition: VirgilAsn1Reader.h:53
bool readBool()
Read ASN.1 type: BOOLEAN.
void reset(const virgil::crypto::VirgilByteArray &data)
Reset all internal states and prepare to new ASN.1 reading operations.
size_t readSequence()
Read ASN.1 type: SEQUENCE.
virgil::crypto::VirgilByteArray readData()
Read preformatted ASN.1 structure.
virgil::crypto::VirgilByteArray readOctetString()
Read ASN.1 type: OCTET STRING.
Definition: VirgilAsn1Compatible.h:46
std::string readOID()
Read ASN.1 type: OID.
int readInteger()
Read ASN.1 type: INTEGER.
~VirgilAsn1Reader()
Dispose internal resources.
size_t readContextTag(unsigned char tag)
Read ASN.1 type: TAG.
virgil::crypto::VirgilByteArray readUTF8String()
Read ASN.1 type: UTF8String.