Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Member Functions | Private Attributes
nsNSSCertTrust Class Reference

#include <nsNSSCertTrust.h>

List of all members.

Public Member Functions

 nsNSSCertTrust ()
 nsNSSCertTrust (unsigned int ssl, unsigned int email, unsigned int objsign)
 nsNSSCertTrust (CERTCertTrust *t)
virtual ~nsNSSCertTrust ()
PRBool HasAnyCA ()
PRBool HasAnyUser ()
PRBool HasCA (PRBool checkSSL=PR_TRUE, PRBool checkEmail=PR_TRUE, PRBool checkObjSign=PR_TRUE)
PRBool HasPeer (PRBool checkSSL=PR_TRUE, PRBool checkEmail=PR_TRUE, PRBool checkObjSign=PR_TRUE)
PRBool HasUser (PRBool checkSSL=PR_TRUE, PRBool checkEmail=PR_TRUE, PRBool checkObjSign=PR_TRUE)
PRBool HasTrustedCA (PRBool checkSSL=PR_TRUE, PRBool checkEmail=PR_TRUE, PRBool checkObjSign=PR_TRUE)
PRBool HasTrustedPeer (PRBool checkSSL=PR_TRUE, PRBool checkEmail=PR_TRUE, PRBool checkObjSign=PR_TRUE)
void SetValidCA ()
void SetTrustedServerCA ()
void SetTrustedCA ()
void SetValidServerPeer ()
void SetValidPeer ()
void SetTrustedPeer ()
void SetUser ()
void SetSSLTrust (PRBool peer, PRBool tPeer, PRBool ca, PRBool tCA, PRBool tClientCA, PRBool user, PRBool warn)
void SetEmailTrust (PRBool peer, PRBool tPeer, PRBool ca, PRBool tCA, PRBool tClientCA, PRBool user, PRBool warn)
void SetObjSignTrust (PRBool peer, PRBool tPeer, PRBool ca, PRBool tCA, PRBool tClientCA, PRBool user, PRBool warn)
void AddCATrust (PRBool ssl, PRBool email, PRBool objSign)
void AddPeerTrust (PRBool ssl, PRBool email, PRBool objSign)
CERTCertTrust * GetTrust ()

Private Member Functions

void addTrust (unsigned int *t, unsigned int v)
void removeTrust (unsigned int *t, unsigned int v)
PRBool hasTrust (unsigned int t, unsigned int v)

Private Attributes

CERTCertTrust mTrust

Detailed Description

Definition at line 50 of file nsNSSCertTrust.h.


Constructor & Destructor Documentation

Definition at line 69 of file nsNSSCertTrust.cpp.

{
  memset(&mTrust, 0, sizeof(CERTCertTrust));
}

Here is the call graph for this function:

nsNSSCertTrust::nsNSSCertTrust ( unsigned int  ssl,
unsigned int  email,
unsigned int  objsign 
)

Definition at line 74 of file nsNSSCertTrust.cpp.

{
  memset(&mTrust, 0, sizeof(CERTCertTrust));
  addTrust(&mTrust.sslFlags, ssl);
  addTrust(&mTrust.emailFlags, email);
  addTrust(&mTrust.objectSigningFlags, objsign);
}

Here is the call graph for this function:

nsNSSCertTrust::nsNSSCertTrust ( CERTCertTrust *  t)

Definition at line 84 of file nsNSSCertTrust.cpp.

{
  if (t)
    memcpy(&mTrust, t, sizeof(CERTCertTrust));
  else
    memset(&mTrust, 0, sizeof(CERTCertTrust)); 
}

Here is the call graph for this function:

Definition at line 92 of file nsNSSCertTrust.cpp.

{
}

Member Function Documentation

void nsNSSCertTrust::AddCATrust ( PRBool  ssl,
PRBool  email,
PRBool  objSign 
)

Definition at line 42 of file nsNSSCertTrust.cpp.

{
  if (ssl) {
    addTrust(&mTrust.sslFlags, CERTDB_TRUSTED_CA);
    addTrust(&mTrust.sslFlags, CERTDB_TRUSTED_CLIENT_CA);
  }
  if (email) {
    addTrust(&mTrust.emailFlags, CERTDB_TRUSTED_CA);
    addTrust(&mTrust.emailFlags, CERTDB_TRUSTED_CLIENT_CA);
  }
  if (objSign) {
    addTrust(&mTrust.objectSigningFlags, CERTDB_TRUSTED_CA);
    addTrust(&mTrust.objectSigningFlags, CERTDB_TRUSTED_CLIENT_CA);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsNSSCertTrust::AddPeerTrust ( PRBool  ssl,
PRBool  email,
PRBool  objSign 
)

Definition at line 59 of file nsNSSCertTrust.cpp.

{
  if (ssl)
    addTrust(&mTrust.sslFlags, CERTDB_TRUSTED);
  if (email)
    addTrust(&mTrust.emailFlags, CERTDB_TRUSTED);
  if (objSign)
    addTrust(&mTrust.objectSigningFlags, CERTDB_TRUSTED);
}

Here is the call graph for this function:

void nsNSSCertTrust::addTrust ( unsigned int t,
unsigned int  v 
) [private]

Definition at line 356 of file nsNSSCertTrust.cpp.

{
  *t |= v;
}

Here is the caller graph for this function:

CERTCertTrust* nsNSSCertTrust::GetTrust ( ) [inline]

Definition at line 113 of file nsNSSCertTrust.h.

{ return &mTrust; }

Here is the caller graph for this function:

Definition at line 261 of file nsNSSCertTrust.cpp.

{
  if (hasTrust(mTrust.sslFlags, CERTDB_VALID_CA) ||
      hasTrust(mTrust.emailFlags, CERTDB_VALID_CA) ||
      hasTrust(mTrust.objectSigningFlags, CERTDB_VALID_CA))
    return PR_TRUE;
  return PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 299 of file nsNSSCertTrust.cpp.

{
  if (hasTrust(mTrust.sslFlags, CERTDB_USER) ||
      hasTrust(mTrust.emailFlags, CERTDB_USER) ||
      hasTrust(mTrust.objectSigningFlags, CERTDB_USER))
    return PR_TRUE;
  return PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsNSSCertTrust::HasCA ( PRBool  checkSSL = PR_TRUE,
PRBool  checkEmail = PR_TRUE,
PRBool  checkObjSign = PR_TRUE 
)

Definition at line 271 of file nsNSSCertTrust.cpp.

{
  if (checkSSL && !hasTrust(mTrust.sslFlags, CERTDB_VALID_CA))
    return PR_FALSE;
  if (checkEmail && !hasTrust(mTrust.emailFlags, CERTDB_VALID_CA))
    return PR_FALSE;
  if (checkObjSign && !hasTrust(mTrust.objectSigningFlags, CERTDB_VALID_CA))
    return PR_FALSE;
  return PR_TRUE;
}

Here is the call graph for this function:

PRBool nsNSSCertTrust::HasPeer ( PRBool  checkSSL = PR_TRUE,
PRBool  checkEmail = PR_TRUE,
PRBool  checkObjSign = PR_TRUE 
)

Definition at line 285 of file nsNSSCertTrust.cpp.

{
  if (checkSSL && !hasTrust(mTrust.sslFlags, CERTDB_VALID_PEER))
    return PR_FALSE;
  if (checkEmail && !hasTrust(mTrust.emailFlags, CERTDB_VALID_PEER))
    return PR_FALSE;
  if (checkObjSign && !hasTrust(mTrust.objectSigningFlags, CERTDB_VALID_PEER))
    return PR_FALSE;
  return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsNSSCertTrust::hasTrust ( unsigned int  t,
unsigned int  v 
) [private]

Definition at line 362 of file nsNSSCertTrust.cpp.

{
  return (t & v);
}

Here is the caller graph for this function:

PRBool nsNSSCertTrust::HasTrustedCA ( PRBool  checkSSL = PR_TRUE,
PRBool  checkEmail = PR_TRUE,
PRBool  checkObjSign = PR_TRUE 
)

Definition at line 323 of file nsNSSCertTrust.cpp.

{
  if (checkSSL && !(hasTrust(mTrust.sslFlags, CERTDB_TRUSTED_CA) ||
                    hasTrust(mTrust.sslFlags, CERTDB_TRUSTED_CLIENT_CA)))
    return PR_FALSE;
  if (checkEmail && !(hasTrust(mTrust.emailFlags, CERTDB_TRUSTED_CA) ||
                      hasTrust(mTrust.emailFlags, CERTDB_TRUSTED_CLIENT_CA)))
    return PR_FALSE;
  if (checkObjSign && 
       !(hasTrust(mTrust.objectSigningFlags, CERTDB_TRUSTED_CA) ||
         hasTrust(mTrust.objectSigningFlags, CERTDB_TRUSTED_CLIENT_CA)))
    return PR_FALSE;
  return PR_TRUE;
}

Here is the call graph for this function:

PRBool nsNSSCertTrust::HasTrustedPeer ( PRBool  checkSSL = PR_TRUE,
PRBool  checkEmail = PR_TRUE,
PRBool  checkObjSign = PR_TRUE 
)

Definition at line 341 of file nsNSSCertTrust.cpp.

{
  if (checkSSL && !(hasTrust(mTrust.sslFlags, CERTDB_TRUSTED)))
    return PR_FALSE;
  if (checkEmail && !(hasTrust(mTrust.emailFlags, CERTDB_TRUSTED)))
    return PR_FALSE;
  if (checkObjSign && 
       !(hasTrust(mTrust.objectSigningFlags, CERTDB_TRUSTED)))
    return PR_FALSE;
  return PR_TRUE;
}

Here is the call graph for this function:

PRBool nsNSSCertTrust::HasUser ( PRBool  checkSSL = PR_TRUE,
PRBool  checkEmail = PR_TRUE,
PRBool  checkObjSign = PR_TRUE 
)

Definition at line 309 of file nsNSSCertTrust.cpp.

{
  if (checkSSL && !hasTrust(mTrust.sslFlags, CERTDB_USER))
    return PR_FALSE;
  if (checkEmail && !hasTrust(mTrust.emailFlags, CERTDB_USER))
    return PR_FALSE;
  if (checkObjSign && !hasTrust(mTrust.objectSigningFlags, CERTDB_USER))
    return PR_FALSE;
  return PR_TRUE;
}

Here is the call graph for this function:

void nsNSSCertTrust::removeTrust ( unsigned int t,
unsigned int  v 
) [private]
void nsNSSCertTrust::SetEmailTrust ( PRBool  peer,
PRBool  tPeer,
PRBool  ca,
PRBool  tCA,
PRBool  tClientCA,
PRBool  user,
PRBool  warn 
)

Definition at line 119 of file nsNSSCertTrust.cpp.

{
  mTrust.emailFlags = 0;
  if (peer || tPeer)
    addTrust(&mTrust.emailFlags, CERTDB_VALID_PEER);
  if (tPeer)
    addTrust(&mTrust.emailFlags, CERTDB_TRUSTED);
  if (ca || tCA)
    addTrust(&mTrust.emailFlags, CERTDB_VALID_CA);
  if (tClientCA)
    addTrust(&mTrust.emailFlags, CERTDB_TRUSTED_CLIENT_CA);
  if (tCA)
    addTrust(&mTrust.emailFlags, CERTDB_TRUSTED_CA);
  if (user)
    addTrust(&mTrust.emailFlags, CERTDB_USER);
  if (warn)
    addTrust(&mTrust.emailFlags, CERTDB_SEND_WARN);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsNSSCertTrust::SetObjSignTrust ( PRBool  peer,
PRBool  tPeer,
PRBool  ca,
PRBool  tCA,
PRBool  tClientCA,
PRBool  user,
PRBool  warn 
)

Definition at line 141 of file nsNSSCertTrust.cpp.

{
  mTrust.objectSigningFlags = 0;
  if (peer || tPeer)
    addTrust(&mTrust.objectSigningFlags, CERTDB_VALID_PEER);
  if (tPeer)
    addTrust(&mTrust.objectSigningFlags, CERTDB_TRUSTED);
  if (ca || tCA)
    addTrust(&mTrust.objectSigningFlags, CERTDB_VALID_CA);
  if (tClientCA)
    addTrust(&mTrust.objectSigningFlags, CERTDB_TRUSTED_CLIENT_CA);
  if (tCA)
    addTrust(&mTrust.objectSigningFlags, CERTDB_TRUSTED_CA);
  if (user)
    addTrust(&mTrust.objectSigningFlags, CERTDB_USER);
  if (warn)
    addTrust(&mTrust.objectSigningFlags, CERTDB_SEND_WARN);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsNSSCertTrust::SetSSLTrust ( PRBool  peer,
PRBool  tPeer,
PRBool  ca,
PRBool  tCA,
PRBool  tClientCA,
PRBool  user,
PRBool  warn 
)

Definition at line 97 of file nsNSSCertTrust.cpp.

{
  mTrust.sslFlags = 0;
  if (peer || tPeer)
    addTrust(&mTrust.sslFlags, CERTDB_VALID_PEER);
  if (tPeer)
    addTrust(&mTrust.sslFlags, CERTDB_TRUSTED);
  if (ca || tCA)
    addTrust(&mTrust.sslFlags, CERTDB_VALID_CA);
  if (tClientCA)
    addTrust(&mTrust.sslFlags, CERTDB_TRUSTED_CLIENT_CA);
  if (tCA)
    addTrust(&mTrust.sslFlags, CERTDB_TRUSTED_CA);
  if (user)
    addTrust(&mTrust.sslFlags, CERTDB_USER);
  if (warn)
    addTrust(&mTrust.sslFlags, CERTDB_SEND_WARN);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 163 of file nsNSSCertTrust.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

CERTCertTrust nsNSSCertTrust::mTrust [private]

Definition at line 119 of file nsNSSCertTrust.h.


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