Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
GrayLib::cASNSets Class Reference

#include <cASNSets.h>

Inheritance diagram for GrayLib::cASNSets:
GrayLib::cASNSet1

Public Member Functions

 cASNSets ()
 
 ~cASNSets ()
 
void SetEmptySets ()
 
bool IsEqualSets (const cASNSets &rb) const
 
HRESULT GetDescriptionSets (StrBuilder &s) const
 
cASNSetsFindOIDInSets (const char *oid, size_t len) const
 
cASNSetsAddOIDToSets (const char *oid, size_t oid_len, const BYTE *val, size_t val_len)
 
HRESULT AddOIDToExtensionList (const char *oid, size_t oid_len, const BYTE *val, size_t val_len, bool bCritical=false)
 
HRESULT SetSetsFromStr (const char *name)
 
 UNITTEST_FRIEND (cASNSets)
 
- Public Member Functions inherited from GrayLib::cASNSet1
bool isEmptySet () const
 
void SetEmptySet ()
 
bool IsEqualSet (const cASNSet1 *b) const
 
HRESULT ReadSet2 (cASNReader &r)
 
HRESULT ReadSet1 (cASNReader &r)
 
HRESULT GetDescriptionSet (StrBuilder &s) const
 

Public Attributes

bool m_bNextMerged
 Merge next item into the current one? More...
 
cASNSetsm_pNextSet
 The next entry in the sequence. More...
 
- Public Attributes inherited from GrayLib::cASNSet1
cASNBufAlloc m_oid
 The object identifier. name. More...
 
cASNBufAlloc m_val
 The value. More...
 

Detailed Description

Element in a sequence or list of 'named' ASN.1 data items. List of ASNF_CONSTRUCTED | ASN_SET. List of ASN1 "named information objects". It allows for Relative Distinguished Names (e.g. cn=GrayLib,ou=code,etc.).

Constructor & Destructor Documentation

◆ cASNSets()

GrayLib::cASNSets::cASNSets ( )
inline

◆ ~cASNSets()

GrayLib::cASNSets::~cASNSets ( )
inline

Member Function Documentation

◆ AddOIDToExtensionList()

HRESULT GrayLib::cASNSets::AddOIDToExtensionList ( const char *  oid,
size_t  oid_len,
const BYTE *  val,
size_t  val_len,
bool  bCritical = false 
)

The first byte of the value in the cASNSets structure is reserved to store the bCritical boolean for us

  • bCritical = if the extension is critical (per the RFC's definition)

◆ AddOIDToSets()

cASNSets * GrayLib::cASNSets::AddOIDToSets ( const char *  oid,
size_t  oid_len,
const BYTE *  val,
size_t  val_len 
)

Create or find a specific named_data entry for writing in a sequence or list based on the OID. If not already in there, a new entry is added to the head of the list.

  • oid = The OID to look for
  • nSizeOID = Size of the OID
  • pVal = the value for OID. can be nullptr to fill in later.
  • nSizeVal = Minimum length of the data buffer needed
    Returns
    nullptr if there was a memory allocation error, or a pointer to the new / existing OID entry.

◆ FindOIDInSets()

cASNSets * GrayLib::cASNSets::FindOIDInSets ( const char *  oid,
size_t  len 
) const

Find a specific named_data entry in a sequence or list based on the OID.

  • oid = The OID to look for
  • len = Size of the OID
    Returns
    nullptr if not found, or a pointer to the existing entry.

◆ GetDescriptionSets()

HRESULT GrayLib::cASNSets::GetDescriptionSets ( StrBuilder s) const

Store the certificate DN in printable form into StrBuilder; for GetDescription() no more than nSizeMax characters will be written. The X509 name to represent

  • s = Buffer to write to
    Returns
    The amount of data written to the buffer, or -1 in case of an error.

◆ IsEqualSets()

bool GrayLib::cASNSets::IsEqualSets ( const cASNSets rb) const

Compare two X.509 Name sequences.

Note
See RFC 5280 section 7.1, though we don't implement the whole algorithm: we sometimes return unequal when the full algorithm would return equal, but never the other way. (Doesn't do Unicode normalization or space folding.)

◆ SetEmptySets()

void GrayLib::cASNSets::SetEmptySets ( )
inline

◆ SetSetsFromStr()

HRESULT GrayLib::cASNSets::SetSetsFromStr ( const char *  name)

Parse a list of OID attributes from string. Clear existing chain if present e.g. pszStr = "C=UK,O=ARM,CN=GrayLib TLS CA"

Returns
0 if subject name was parsed successfully, or a specific error code

◆ UNITTEST_FRIEND()

GrayLib::cASNSets::UNITTEST_FRIEND ( cASNSets  )

Member Data Documentation

◆ m_bNextMerged

bool GrayLib::cASNSets::m_bNextMerged

Merge next item into the current one?

◆ m_pNextSet

cASNSets* GrayLib::cASNSets::m_pNextSet

The next entry in the sequence.


The documentation for this class was generated from the following files: