Virgil Security Crypto library  2.6.3
Public Member Functions | List of all members
virgil::crypto::foundation::asn1::VirgilAsn1Reader Class Reference

This class provides methods for reading ASN.1 data structure. More...

#include <VirgilAsn1Reader.h>

Public Member Functions

 VirgilAsn1Reader ()
 Initialize internal state.
 
 VirgilAsn1Reader (const virgil::crypto::VirgilByteArray &data)
 Initialize internal state with given ASN.1 structure. More...
 
 ~VirgilAsn1Reader () noexcept
 Dispose internal resources.
 
 VirgilAsn1Reader (const VirgilAsn1Reader &other)=delete
 Delete copy constructor.
 
VirgilAsn1Readeroperator= (const VirgilAsn1Reader &rhs)=delete
 Delete assignment operator.
 
 VirgilAsn1Reader (VirgilAsn1Reader &&other)=default
 Use default move constructor.
 
VirgilAsn1Readeroperator= (VirgilAsn1Reader &&rhs)=default
 Use default move operator.
 
Configure reading
void reset (const virgil::crypto::VirgilByteArray &data)
 Reset all internal states and prepare to new ASN.1 reading operations. More...
 
Read Simple ASN.1 Types
int readInteger ()
 Read ASN.1 type: INTEGER.
 
bool readBool ()
 Read ASN.1 type: BOOLEAN.
 
void readNull ()
 Read ASN.1 type: NULL.
 
virgil::crypto::VirgilByteArray readOctetString ()
 Read ASN.1 type: OCTET STRING.
 
virgil::crypto::VirgilByteArray readUTF8String ()
 Read ASN.1 type: UTF8String.
 
virgil::crypto::VirgilByteArray readData ()
 Read preformatted ASN.1 structure.
 
size_t readContextTag (unsigned char tag)
 Read ASN.1 type: TAG. More...
 
std::string readOID ()
 Read ASN.1 type: OID. More...
 
Read Structured ASN.1 Types
size_t readSequence ()
 Read ASN.1 type: SEQUENCE. More...
 
size_t readSet ()
 Read ASN.1 type: SET. More...
 

Detailed Description

This class provides methods for reading ASN.1 data structure.

Note
All "read*" methods perform reading of ASN.1 structure sequentially.
Implementation is not complete yet, only minimum set of operations are supported.

Constructor & Destructor Documentation

virgil::crypto::foundation::asn1::VirgilAsn1Reader::VirgilAsn1Reader ( const virgil::crypto::VirgilByteArray data)
explicit

Initialize internal state with given ASN.1 structure.

Note
The same as sequence VirgilAsn1Reader() and reset().

Member Function Documentation

size_t virgil::crypto::foundation::asn1::VirgilAsn1Reader::readContextTag ( unsigned char  tag)

Read ASN.1 type: TAG.

Returns
Tag length if given tag exist, 0 - otherwise.
std::string virgil::crypto::foundation::asn1::VirgilAsn1Reader::readOID ( )

Read ASN.1 type: OID.

Returns
OID. TODO: Change return type to VirgilByteArray
size_t virgil::crypto::foundation::asn1::VirgilAsn1Reader::readSequence ( )

Read ASN.1 type: SEQUENCE.

Returns
Sequence size in bytes.
size_t virgil::crypto::foundation::asn1::VirgilAsn1Reader::readSet ( )

Read ASN.1 type: SET.

Returns
Set size in bytes.
void virgil::crypto::foundation::asn1::VirgilAsn1Reader::reset ( const virgil::crypto::VirgilByteArray data)

Reset all internal states and prepare to new ASN.1 reading operations.

Parameters
data- ASN.1 structure to be read.

The documentation for this class was generated from the following file: