37 #ifndef VIRGIL_CRYPTO_VIRGIL_ASN1_WRITER_H
38 #define VIRGIL_CRYPTO_VIRGIL_ASN1_WRITER_H
44 #include <virgil/crypto/VirgilByteArray.h>
46 namespace virgil {
namespace crypto {
namespace foundation {
namespace asn1 {
86 void reset(
size_t capacity);
93 virgil::crypto::VirgilByteArray
finish();
146 size_t writeData(
const virgil::crypto::VirgilByteArray& data);
153 size_t writeOID(
const std::string& oid);
171 size_t writeSet(
const std::vector<virgil::crypto::VirgilByteArray>& set);
180 static virgil::crypto::VirgilByteArray
181 makeComparePadding(
const virgil::crypto::VirgilByteArray& asn1,
size_t finalSize);
186 static bool compare(
const virgil::crypto::VirgilByteArray& first,
const virgil::crypto::VirgilByteArray& second);
191 static void makeOrderedSet(std::vector<virgil::crypto::VirgilByteArray>& set);
203 void dispose()
throw();
210 void relocateBuffer(
size_t newBufLen);
218 void ensureBufferEnough(
size_t len);
232 unsigned char* start_;
VirgilAsn1Writer()
Initialize internal state for the first use.
~VirgilAsn1Writer()
Dispose internal resources.
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.
size_t writeContextTag(unsigned char tag, size_t len)
Write ASN.1 type: TAG.
Definition: VirgilAsn1Compatible.h:46
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.