This class provides methods for writing ASN.1 data structure.
More...
#include <VirgilAsn1Writer.h>
This class provides methods for writing ASN.1 data structure.
- Note
- All "write*" methods perform writing of ASN.1 structure sequentially.
-
Implementation is not complete yet, only minimum set of operations are supported.
virgil::crypto::foundation::asn1::VirgilAsn1Writer::VirgilAsn1Writer |
( |
| ) |
|
Initialize internal state for the first use.
- See also
- reset() method for reusing this class to create new ASN.1 stucture.
virgil::crypto::foundation::asn1::VirgilAsn1Writer::VirgilAsn1Writer |
( |
size_t |
capacity | ) |
|
Initialize internal state for the first use.
- Parameters
-
capacity | - expected ASN.1 final size |
- See also
- reset() method for reusing this class to create new ASN.1 stucture.
Returns the result ASN.1 structure.
- Returns
- ASN.1 structure that was written.
- Warning
- After call this method all attempts to write more data will cause exceptions.
void virgil::crypto::foundation::asn1::VirgilAsn1Writer::reset |
( |
size_t |
capacity | ) |
|
Reset all internal states and prepare to new ASN.1 writing operations.
- Parameters
-
capacity | - expected ASN.1 final size |
size_t virgil::crypto::foundation::asn1::VirgilAsn1Writer::writeBool |
( |
bool |
value | ) |
|
Write ASN.1 type: BOOLEAN.
- Parameters
-
value | - boolean value to be written. |
- Returns
- Written bytes.
size_t virgil::crypto::foundation::asn1::VirgilAsn1Writer::writeContextTag |
( |
unsigned char |
tag, |
|
|
size_t |
len |
|
) |
| |
Write ASN.1 type: TAG.
- Parameters
-
tag | - custom tag. |
len | - length of the taged element, use methods return value to calculate it. |
- Returns
- Written bytes.
Write preformatted ASN.1 structure.
- Parameters
-
- Returns
- Written bytes.
size_t virgil::crypto::foundation::asn1::VirgilAsn1Writer::writeInteger |
( |
int |
value | ) |
|
Write ASN.1 type: INTEGER.
- Parameters
-
value | - integer value to be written. |
- Returns
- Written bytes.
size_t virgil::crypto::foundation::asn1::VirgilAsn1Writer::writeNull |
( |
| ) |
|
Write ASN.1 type: NULL.
- Returns
- Written bytes.
Write ASN.1 type: OCTET STRING.
- Parameters
-
data | - octet string to be written. |
- Returns
- Written bytes.
size_t virgil::crypto::foundation::asn1::VirgilAsn1Writer::writeOID |
( |
const std::string & |
oid | ) |
|
Write ASN.1 type: OID.
- Parameters
-
- Returns
- Written bytes.
size_t virgil::crypto::foundation::asn1::VirgilAsn1Writer::writeSequence |
( |
size_t |
len | ) |
|
Write ASN.1 type: SEQUENCE.
- Parameters
-
len | - sequence length in bytes. |
- Returns
- Written bytes.
Write ASN.1 type: SET OF ANY.
- Parameters
-
set | - set of any data represented as byte sequence. |
- Returns
- Written bytes.
Write ASN.1 type: UTF8String.
- Parameters
-
data | - UTF8 string to be written. |
- Returns
- Written bytes.
The documentation for this class was generated from the following file: