![]() |
Gray C++ Libraries
0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
|
#include <cASNWriterRev.h>
Public Member Functions | |
cASNWriterRev (BYTE *pStart, size_t nLen) | |
cASNWriterRev (cMemBlock &m) | |
size_t | get_LenLeft () const |
size_t | get_LenWritten () const |
BYTE * | get_OutPtr () const |
void | AddOut (size_t nSize) |
void | WriteByteRaw (BYTE b) |
HRESULT | WriteByte (BYTE b) |
HRESULT | WriteRawData (const void *pBuffer, size_t size) |
HRESULT | WriteLengthCode (size_t len) |
HRESULT | WriteTag (ASN_t nTagExpected, size_t len) |
HRESULT | WriteTagNull () |
HRESULT | WriteTagBlock (ASN_t nTag, const void *pBuffer, size_t nSizeBuffer) |
HRESULT | WriteTagBoolean (bool bVal) |
HRESULT | WriteTagInt (int iVal) |
HRESULT | WriteTagInt (const BYTE *pData, size_t nSize, bool bNegativeOrNA) |
HRESULT | WriteTagInt (const cBitArray &X, bool bNegativeOrNA=false) |
HRESULT | WriteTagOID (const char *oid, size_t oid_len) |
HRESULT | WriteTagStringPrintable (const char *text, StrLen_t text_len=k_StrLen_UNK) |
HRESULT | WriteTagStringIA5 (const char *text, StrLen_t text_len=k_StrLen_UNK) |
HRESULT | WriteTagArrayBits (const BYTE *pBuffer, BIT_ENUM_t bits) |
HRESULT | WriteTagArrayBytes (const BYTE *pBuffer, size_t size) |
HRESULT | WriteTagTime (const cTimeUnits &Tu) |
HRESULT | WriteTagTime (const cTimeInt &time, TZ_TYPE nTimeZoneOffset=TZ_LOCAL) |
HRESULT | WriteSet1 (const cASNSet1 &s) |
HRESULT | WriteSets (const cASNSets &rNames) |
HRESULT | WriteExtensionList1 (const cASNSet1 *ext) |
HRESULT | WriteExtensionList (const cASNSets &rExtensions) |
HRESULT | WriteTagSeqAlg (const char *oid, size_t oid_len) |
HRESULT | WriteTagSeqAlg2 (const char *oid, size_t oid_len, BYTE *pSig, size_t size) |
![]() | |
cMemBlock () noexcept | |
cMemBlock (const void *pData, size_t nSize) noexcept | |
cMemBlock (const cMemBlock &block) noexcept | |
cMemBlock (const cMemBlock *pBlock) noexcept | |
size_t | get_DataSize () const noexcept |
void * | get_Data () const noexcept |
BYTE * | get_DataBytes () const noexcept |
char * | get_DataA () const noexcept |
operator const BYTE * () const noexcept | |
bool | isValidPtr () const noexcept |
bool | IsValidIndex (size_t i) const noexcept |
bool | IsValidIndex2 (size_t i) const noexcept |
bool | IsValidPtr (const void *p) const noexcept |
bool | IsValidPtr2 (const void *p) const noexcept |
bool | IsZeros () const noexcept |
bool | IsEqualData (const void *pData, size_t nSize) const noexcept |
bool | IsEqualData (const cMemBlock *pData) const noexcept |
bool | IsEqualData (const cMemBlock &data) const noexcept |
BYTE * | GetOffset (size_t nOffset) const |
const void * | get_DataEnd () const noexcept |
void | put_DataPtr (void *pStart) noexcept |
void | put_Size (size_t nSize) noexcept |
void | SetBlock (void *pData, size_t nSize) noexcept |
void | SetEmptyBlock () noexcept |
void | InitZeros () noexcept |
StrLen_t | ConvertToString (char *pszDst, StrLen_t iDstSizeMax) const |
Protected Member Functions | |
HRESULT | WriteSetsRev (const cASNSets *pCur) |
Protected Attributes | |
BYTE * | m_pOutCur |
current write position. Moves down. More... | |
![]() | |
size_t | m_nSize |
size_t of m_pData in bytes. May be determined at runtime. More... | |
void * | m_pData |
Additional Inherited Members | |
![]() | |
static COMPARE_t __stdcall | Compare (const void *pData1, size_t iLen1, const void *pData2, size_t iLen2) |
Helper class for writing an ASN blob in memory. Used for DER format. Similar to cStreamStatic Write BACKWARDS so we can prefix with calculated lengths. Weird. But since the length code itself is variable length I can't just leave an empty spot for it! similar to StrBuilder but backwards. Opposite to cASNReader Buffer ownership and delete responsibility is external.
|
inline |
|
inline |
|
inline |
|
inline |
Space left. intentionally backwards.
|
inline |
How much data written so far ? intentionally backwards.
|
inline |
get write position.
HRESULT GrayLib::cASNWriterRev::WriteByte | ( | BYTE | b | ) |
Write a ASN.1 tag in ASN.1 format
|
inline |
– contains the DER encoding of an ASN.1 value – corresponding to the extension type identified – by extnID
HRESULT GrayLib::cASNWriterRev::WriteLengthCode | ( | size_t | len | ) |
Write a variable length, length field in ASN.1 format Write encoded length backwards since it is variable length itself. Opposite of ReadLengthCode()
HRESULT GrayLib::cASNWriterRev::WriteRawData | ( | const void * | pBuffer, |
size_t | size | ||
) |
Write raw buffer data
RelativeDistinguishedName ::= SET OF AttributeTypeAndValue
AttributeTypeAndValue ::= SEQUENCE { type AttributeType, value AttributeValue }
AttributeType ::= OBJECT IDENTIFIER
AttributeValue ::= ANY DEFINED BY AttributeType
Opposite of ReadTag()
HRESULT GrayLib::cASNWriterRev::WriteTagArrayBits | ( | const BYTE * | pBuffer, |
BIT_ENUM_t | bits | ||
) |
Write a ASN_ArrayBits and value in ASN.1 format
HRESULT GrayLib::cASNWriterRev::WriteTagArrayBytes | ( | const BYTE * | pBuffer, |
size_t | size | ||
) |
Write an octet string tag (ASN_ArrayBytes) and value in ASN.1 format
HRESULT GrayLib::cASNWriterRev::WriteTagBlock | ( | ASN_t | nTag, |
const void * | pBuffer, | ||
size_t | nSizeBuffer | ||
) |
Write ASN Tag and data in ASN.1 format
HRESULT GrayLib::cASNWriterRev::WriteTagBoolean | ( | bool | bVal | ) |
Write a boolean tag (ASN_BOOLEAN) and value in ASN.1 format opposite of ReadTagBoolean()
HRESULT GrayLib::cASNWriterRev::WriteTagInt | ( | const BYTE * | pData, |
size_t | nSize, | ||
bool | bNegativeOrNA | ||
) |
DER format assumes 2s complement for numbers, the leftmost bit should be 0 for positive numbers and 1 for negative numbers.
Write a big number (ASN_INTEGER) in ASN.1 format
HRESULT GrayLib::cASNWriterRev::WriteTagInt | ( | int | iVal | ) |
Write an int tag (ASN_INTEGER) and value in ASN.1 format. Variable length.
HRESULT GrayLib::cASNWriterRev::WriteTagNull | ( | ) |
Write a ASN_NULL tag with zero data in ASN.1 format
HRESULT GrayLib::cASNWriterRev::WriteTagOID | ( | const char * | oid, |
size_t | oid_len | ||
) |
Write an OID tag (ASN_OID) and data in ASN.1 format
HRESULT GrayLib::cASNWriterRev::WriteTagSeqAlg | ( | const char * | oid, |
size_t | oid_len | ||
) |
Write an AlgorithmIdentifier sequence in ASN.1 format
HRESULT GrayLib::cASNWriterRev::WriteTagSeqAlg2 | ( | const char * | oid, |
size_t | oid_len, | ||
BYTE * | pSig, | ||
size_t | size | ||
) |
HRESULT GrayLib::cASNWriterRev::WriteTagStringIA5 | ( | const char * | text, |
StrLen_t | text_len = k_StrLen_UNK |
||
) |
Write an IA5 string tag (ASN_StringIA5) and value in ASN.1 format
HRESULT GrayLib::cASNWriterRev::WriteTagStringPrintable | ( | const char * | text, |
StrLen_t | text_len = k_StrLen_UNK |
||
) |
Write a ASN_StringPrintable tag and value in ASN.1 format
HRESULT GrayLib::cASNWriterRev::WriteTagTime | ( | const cTimeInt & | time, |
TZ_TYPE | nTimeZoneOffset = TZ_LOCAL |
||
) |
Write ASN_TimeUTC or ASN_TimeGeneral Compliment of ReadTagTime()
HRESULT GrayLib::cASNWriterRev::WriteTagTime | ( | const cTimeUnits & | Tu | ) |
Write ASN_TimeUTC or ASN_TimeGeneral Compliment of ReadTagTime() e.g. "20131231235959" for December 31st 2013 at 23:59:59
|
protected |
current write position. Moves down.