1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef nsNSSCertTrust_h
6 #define nsNSSCertTrust_h
11 * Class for maintaining trust flags for an NSS certificate.
13 class nsNSSCertTrust
{
16 nsNSSCertTrust(unsigned int ssl
, unsigned int email
);
17 explicit nsNSSCertTrust(CERTCertTrust
* t
);
18 virtual ~nsNSSCertTrust();
23 bool HasPeer(bool checkSSL
= true, bool checkEmail
= true);
24 bool HasTrustedCA(bool checkSSL
= true, bool checkEmail
= true);
25 bool HasTrustedPeer(bool checkSSL
= true, bool checkEmail
= true);
28 /* equivalent to "c,c,c" */
30 /* equivalent to "p,p,p" */
34 /* read: "p, P, c, C, T, u, w" */
35 void SetSSLTrust(bool peer
, bool tPeer
, bool ca
, bool tCA
, bool tClientCA
,
36 bool user
, bool warn
);
38 void SetEmailTrust(bool peer
, bool tPeer
, bool ca
, bool tCA
, bool tClientCA
,
39 bool user
, bool warn
);
42 void AddCATrust(bool ssl
, bool email
);
44 void AddPeerTrust(bool ssl
, bool email
);
46 CERTCertTrust
& GetTrust() { return mTrust
; }
49 void addTrust(unsigned int* t
, unsigned int v
);
50 void removeTrust(unsigned int* t
, unsigned int v
);
51 bool hasTrust(unsigned int t
, unsigned int v
);
55 #endif // nsNSSCertTrust_h