37 #ifndef VIRGIL_CRYPTO_VIRGIL_ASN1_WRITER_H
38 #define VIRGIL_CRYPTO_VIRGIL_ASN1_WRITER_H
44 #include "../../VirgilByteArray.h"
46 namespace virgil {
namespace crypto {
namespace foundation {
namespace asn1 {
86 void reset(
size_t capacity);
153 size_t writeOID(
const std::string& oid);
171 size_t writeSet(
const std::vector<virgil::crypto::VirgilByteArray>& set);
191 static void makeOrderedSet(std::vector<virgil::crypto::VirgilByteArray>& set);
215 void dispose() noexcept;
222 void relocateBuffer(
size_t newBufLen);
230 void ensureBufferEnough(
size_t len);
234 unsigned char* start_;
VirgilAsn1Writer()
Initialize internal state for the first use.
VirgilAsn1Writer & operator=(VirgilAsn1Writer &&rhs)=default
Use default move operator.
size_t writeSequence(size_t len)
Write ASN.1 type: SEQUENCE.
This class provides methods for writing ASN.1 data structure.
Definition: VirgilAsn1Writer.h:54
size_t writeBool(bool value)
Write ASN.1 type: BOOLEAN.
size_t writeSet(const std::vector< virgil::crypto::VirgilByteArray > &set)
Write ASN.1 type: SET OF ANY.
virgil::crypto::VirgilByteArray finish()
Returns the result ASN.1 structure.
~VirgilAsn1Writer() noexcept
Dispose internal resources.
size_t writeContextTag(unsigned char tag, size_t len)
Write ASN.1 type: TAG.
std::vector< unsigned char > VirgilByteArray
This type represents a sequence of bytes.
Definition: VirgilByteArray.h:50
size_t writeNull()
Write ASN.1 type: NULL.
void reset()
Reset all internal states and prepare to new ASN.1 writing operations.
size_t writeInteger(int value)
Write ASN.1 type: INTEGER.
size_t writeData(const virgil::crypto::VirgilByteArray &data)
Write preformatted ASN.1 structure.
size_t writeUTF8String(const virgil::crypto::VirgilByteArray &data)
Write ASN.1 type: UTF8String.
size_t writeOctetString(const virgil::crypto::VirgilByteArray &data)
Write ASN.1 type: OCTET STRING.
size_t writeOID(const std::string &oid)
Write ASN.1 type: OID.