Virgil Security Crypto library  2.0.7
VirgilAsn1Reader.h
1 
37 #ifndef VIRGIL_CRYPTO_VIRGIL_ASN1_READER_H
38 #define VIRGIL_CRYPTO_VIRGIL_ASN1_READER_H
39 
40 #include <cstdlib>
41 #include <string>
42 
43 #include <virgil/crypto/VirgilByteArray.h>
44 
45 namespace virgil { namespace crypto { namespace foundation { namespace asn1 {
46 
54 public:
59 
65 
69  ~VirgilAsn1Reader() noexcept;
73 
78  void reset(const virgil::crypto::VirgilByteArray& data);
80 
83 
87  int readInteger();
88 
92  bool readBool();
93 
97  void readNull();
98 
103 
108 
113 
118  size_t readContextTag(unsigned char tag);
119 
125  std::string readOID();
127 
130 
135  size_t readSequence();
136 
141  size_t readSet();
143 public:
147  VirgilAsn1Reader(const VirgilAsn1Reader& other) = delete;
148 
152  VirgilAsn1Reader& operator=(const VirgilAsn1Reader& rhs) = delete;
153 
157  VirgilAsn1Reader(VirgilAsn1Reader&& other) = default;
158 
162  VirgilAsn1Reader& operator=(VirgilAsn1Reader&& rhs) = default;
163 
164 private:
169  void checkState();
170 
171 private:
172  unsigned char* p_;
173  const unsigned char* end_;
175 };
176 
177 }}}}
178 
179 #endif /* VIRGIL_CRYPTO_VIRGIL_ASN1_READER_H */
~VirgilAsn1Reader() noexcept
Dispose internal resources.
This class provides methods for reading ASN.1 data structure.
Definition: VirgilAsn1Reader.h:53
VirgilAsn1Reader & operator=(const VirgilAsn1Reader &rhs)=delete
Delete assignment operator.
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.
Root namespace for all Virgil Security libraries.
Definition: VirgilAsn1Compatible.h:46
std::vector< unsigned char > VirgilByteArray
This type represents a sequence of bytes.
Definition: VirgilByteArray.h:53
std::string readOID()
Read ASN.1 type: OID.
int readInteger()
Read ASN.1 type: INTEGER.
size_t readContextTag(unsigned char tag)
Read ASN.1 type: TAG.
virgil::crypto::VirgilByteArray readUTF8String()
Read ASN.1 type: UTF8String.