Virgil Security Crypto library  2.4.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
VirgilAsn1Compatible.h
1 
37 #ifndef VIRGIL_CRYPTO_VIRGIL_ASN1_COMPATIBLE_H
38 #define VIRGIL_CRYPTO_VIRGIL_ASN1_COMPATIBLE_H
39 
40 #include "../../VirgilByteArray.h"
41 
45 namespace virgil { namespace crypto { namespace foundation { namespace asn1 {
47 class VirgilAsn1Reader;
48 
49 class VirgilAsn1Writer;
50 }}}}
52 
53 
54 namespace virgil { namespace crypto { namespace foundation { namespace asn1 {
55 
60 public:
65 
69  void fromAsn1(const virgil::crypto::VirgilByteArray& asn1);
70 
74  virtual ~VirgilAsn1Compatible() noexcept { }
75 
82  virtual size_t asn1Write(VirgilAsn1Writer& asn1Writer, size_t childWrittenBytes = 0) const = 0;
83 
88  virtual void asn1Read(VirgilAsn1Reader& asn1Reader) = 0;
89 
90 protected:
95  virtual void checkRequiredField(const VirgilByteArray& param) const;
96 };
97 
98 }}}}
99 
100 #endif /* VIRGIL_CRYPTO_VIRGIL_ASN1_COMPATIBLE_H */
This class provides methods for reading ASN.1 data structure.
Definition: VirgilAsn1Reader.h:53
This class provides interface that allow to save and restore object state in the ASN.1 structure.
Definition: VirgilAsn1Compatible.h:59
This class provides methods for writing ASN.1 data structure.
Definition: VirgilAsn1Writer.h:54
virtual ~VirgilAsn1Compatible() noexcept
Polymorphic destructor.
Definition: VirgilAsn1Compatible.h:74
virtual void asn1Read(VirgilAsn1Reader &asn1Reader)=0
Read object state from the reader.
std::vector< unsigned char > VirgilByteArray
This type represents a sequence of bytes.
Definition: VirgilByteArray.h:50
void fromAsn1(const virgil::crypto::VirgilByteArray &asn1)
Restore object state from the ASN.1 structure.
virtual void checkRequiredField(const VirgilByteArray &param) const
If given parameter is empty exception will be thrown.
virgil::crypto::VirgilByteArray toAsn1() const
Save object state to the ASN.1 structure.
virtual size_t asn1Write(VirgilAsn1Writer &asn1Writer, size_t childWrittenBytes=0) const =0
Write object state to the writer.