Mixes for Privacy and Anonymity in the Internet
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
CACertStore Class Reference

Public Member Functions

 CACertStore ()
 
 ~CACertStore ()
 
SINT32 add (CACertificate *cert)
 Adds a COPY of a given certifcate to this CertStore. More...
 
CACertificategetFirst ()
 
CACertificategetNext ()
 
UINT32 getNumber ()
 
CACertificateverifyMixCert (DOMNode *mixNode)
 This function parses the certificates from a <Mix>-node and tries to build a certPath to the trusted root certificates loaded from the config file. More...
 
SINT32 encode (UINT8 *buff, UINT32 *bufflen, UINT32 type)
 
SINT32 encode (DOMElement *&elemnRoot, XERCES_CPP_NAMESPACE::DOMDocument *doc)
 Creates a XML DocumentFragment which represenst all the Certifcates in this CertStore. More...
 

Static Public Member Functions

static CACertStoredecode (UINT8 *buff, UINT32 bufflen, UINT32 type)
 
static CACertStoredecode (const DOMNode *node, UINT32 type)
 

Private Attributes

LP_CERTSTORE_ENTRY m_pCertList
 
UINT32 m_cCerts
 
LP_CERTSTORE_ENTRY m_pCurrent
 

Constructor & Destructor Documentation

◆ CACertStore()

CACertStore::CACertStore ( )

References m_cCerts, m_pCertList, and m_pCurrent.

Referenced by decode().

◆ ~CACertStore()

CACertStore::~CACertStore ( )

Member Function Documentation

◆ add()

SINT32 CACertStore::add ( CACertificate cert)

Adds a COPY of a given certifcate to this CertStore.

Parameters
certCertifcate of which a copy is added to this cert store
Return values
E_SUCCESSif successfull
E_UNKNOWNif not (for instance if cert==NULL)

References CACertificate::clone(), E_SUCCESS, E_UNKNOWN, m_cCerts, m_pCertList, __t_certstore_list::next, and __t_certstore_list::pCert.

Referenced by decode(), CACmdLnOptions::setOwnCertificate(), and CACmdLnOptions::setTrustedRootCertificates().

◆ decode() [1/2]

static CACertStore* CACertStore::decode ( UINT8 buff,
UINT32  bufflen,
UINT32  type 
)
static

Referenced by verifyMixCert().

◆ decode() [2/2]

CACertStore * CACertStore::decode ( const DOMNode *  node,
UINT32  type 
)
static

◆ encode() [1/2]

SINT32 CACertStore::encode ( UINT8 buff,
UINT32 bufflen,
UINT32  type 
)

◆ encode() [2/2]

SINT32 CACertStore::encode ( DOMElement *&  elemRoot,
XERCES_CPP_NAMESPACE::DOMDocument *  doc 
)

Creates a XML DocumentFragment which represenst all the Certifcates in this CertStore.

Parameters
docFragon ouput holds the created DOMElement
docowner document of the new DOM_DocumentFragment
Return values
E_SUCCESSif successful
E_UNKNOWNotherwise

References createDOMElement(), E_SUCCESS, CACertificate::encode(), m_pCertList, __t_certstore_list::next, and __t_certstore_list::pCert.

◆ getFirst()

CACertificate * CACertStore::getFirst ( )

◆ getNext()

CACertificate * CACertStore::getNext ( )

◆ getNumber()

UINT32 CACertStore::getNumber ( )

◆ verifyMixCert()

CACertificate * CACertStore::verifyMixCert ( DOMNode *  mixNode)

This function parses the certificates from a <Mix>-node and tries to build a certPath to the trusted root certificates loaded from the config file.

The certificates are parsed from any <Signature>-node that is a direct child of <Mix> (MultiSignature compatible). The function will return a certificate in the following cases:

  • The certificate is signed by a root CA and there is no other certificate in the <Signature>-element.
  • The certificate is signed by another ceritificate of the same <Signature>-element which itself was issued by a root CA.
Parameters
mixNode- a <Mix>-Node containing one or more signatures
Returns
the first end certificate that has a certPath to a trusted root certificate or NULL if no cert was found (or something went wrong)

References decode(), E_SUCCESS, getDOMChildByName(), getFirst(), getNext(), getSignatureElements(), m_cCerts, m_pCertList, MAX_SIGNATURE_ELEMENTS, CAMsg::printMsg(), CACertificate::verify(), and XML_X509DATA.

Referenced by CAMiddleMix::processKeyExchange(), CALastMix::processKeyExchange(), and CAFirstMix::processKeyExchange().

Member Data Documentation

◆ m_cCerts

UINT32 CACertStore::m_cCerts
private

Referenced by add(), CACertStore(), and verifyMixCert().

◆ m_pCertList

LP_CERTSTORE_ENTRY CACertStore::m_pCertList
private

◆ m_pCurrent

LP_CERTSTORE_ENTRY CACertStore::m_pCurrent
private

Referenced by CACertStore(), getFirst(), and getNext().