~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/security/manager/ssl/src/nsNSSCertTrust.h

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * The contents of this file are subject to the Mozilla Public
 
3
 * License Version 1.1 (the "License"); you may not use this file
 
4
 * except in compliance with the License. You may obtain a copy of
 
5
 * the License at http://www.mozilla.org/MPL/
 
6
 * 
 
7
 * Software distributed under the License is distributed on an "AS
 
8
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 
9
 * implied. See the License for the specific language governing
 
10
 * rights and limitations under the License.
 
11
 * 
 
12
 * The Original Code is the Netscape security libraries.
 
13
 * 
 
14
 * The Initial Developer of the Original Code is Netscape
 
15
 * Communications Corporation.  Portions created by Netscape are 
 
16
 * Copyright (C) 2000 Netscape Communications Corporation.  All
 
17
 * Rights Reserved.
 
18
 * 
 
19
 * Contributor(s):
 
20
 *  Ian McGreer <mcgreer@netscape.com>
 
21
 *  Javier Delgadillo <javi@netscape.com>
 
22
 * 
 
23
 * Alternatively, the contents of this file may be used under the
 
24
 * terms of the GNU General Public License Version 2 or later (the
 
25
 * "GPL"), in which case the provisions of the GPL are applicable 
 
26
 * instead of those above.  If you wish to allow use of your 
 
27
 * version of this file only under the terms of the GPL and not to
 
28
 * allow others to use your version of this file under the MPL,
 
29
 * indicate your decision by deleting the provisions above and
 
30
 * replace them with the notice and other provisions required by
 
31
 * the GPL.  If you do not delete the provisions above, a recipient
 
32
 * may use your version of this file under either the MPL or the
 
33
 * GPL.
 
34
 *
 
35
 */
 
36
 
 
37
#ifndef _NSNSSCERTTRUST_H_
 
38
#define _NSNSSCERTTRUST_H_
 
39
 
 
40
#include "certt.h"
 
41
#include "certdb.h"
 
42
 
 
43
/*
 
44
 * nsNSSCertTrust
 
45
 * 
 
46
 * Class for maintaining trust flags for an NSS certificate.
 
47
 */
 
48
class nsNSSCertTrust
 
49
{
 
50
public:
 
51
  nsNSSCertTrust();
 
52
  nsNSSCertTrust(unsigned int ssl, unsigned int email, unsigned int objsign);
 
53
  nsNSSCertTrust(CERTCertTrust *t);
 
54
  virtual ~nsNSSCertTrust();
 
55
 
 
56
  /* query */
 
57
  PRBool HasAnyCA();
 
58
  PRBool HasAnyUser();
 
59
  PRBool HasCA(PRBool checkSSL = PR_TRUE, 
 
60
               PRBool checkEmail = PR_TRUE,  
 
61
               PRBool checkObjSign = PR_TRUE);
 
62
  PRBool HasPeer(PRBool checkSSL = PR_TRUE, 
 
63
                 PRBool checkEmail = PR_TRUE,  
 
64
                 PRBool checkObjSign = PR_TRUE);
 
65
  PRBool HasUser(PRBool checkSSL = PR_TRUE, 
 
66
                 PRBool checkEmail = PR_TRUE,  
 
67
                 PRBool checkObjSign = PR_TRUE);
 
68
  PRBool HasTrustedCA(PRBool checkSSL = PR_TRUE, 
 
69
                      PRBool checkEmail = PR_TRUE,  
 
70
                      PRBool checkObjSign = PR_TRUE);
 
71
  PRBool HasTrustedPeer(PRBool checkSSL = PR_TRUE, 
 
72
                        PRBool checkEmail = PR_TRUE,  
 
73
                        PRBool checkObjSign = PR_TRUE);
 
74
 
 
75
  /* common defaults */
 
76
  /* equivalent to "c,c,c" */
 
77
  void SetValidCA();
 
78
  /* equivalent to "C,C,C" */
 
79
  void SetTrustedServerCA();
 
80
  /* equivalent to "CT,CT,CT" */
 
81
  void SetTrustedCA();
 
82
  /* equivalent to "p,," */
 
83
  void SetValidServerPeer();
 
84
  /* equivalent to "p,p,p" */
 
85
  void SetValidPeer();
 
86
  /* equivalent to "P,P,P" */
 
87
  void SetTrustedPeer();
 
88
  /* equivalent to "u,u,u" */
 
89
  void SetUser();
 
90
 
 
91
  /* general setters */
 
92
  /* read: "p, P, c, C, T, u, w" */
 
93
  void SetSSLTrust(PRBool peer, PRBool tPeer,
 
94
                   PRBool ca,   PRBool tCA, PRBool tClientCA,
 
95
                   PRBool user, PRBool warn); 
 
96
 
 
97
  void SetEmailTrust(PRBool peer, PRBool tPeer,
 
98
                     PRBool ca,   PRBool tCA, PRBool tClientCA,
 
99
                     PRBool user, PRBool warn);
 
100
 
 
101
  void SetObjSignTrust(PRBool peer, PRBool tPeer,
 
102
                       PRBool ca,   PRBool tCA, PRBool tClientCA,
 
103
                       PRBool user, PRBool warn);
 
104
 
 
105
  /* set c <--> CT */
 
106
  void AddCATrust(PRBool ssl, PRBool email, PRBool objSign);
 
107
  /* set p <--> P */
 
108
  void AddPeerTrust(PRBool ssl, PRBool email, PRBool objSign);
 
109
 
 
110
  /* get it (const?) (shallow?) */
 
111
  CERTCertTrust * GetTrust() { return &mTrust; }
 
112
 
 
113
private:
 
114
  void addTrust(unsigned int *t, unsigned int v);
 
115
  void removeTrust(unsigned int *t, unsigned int v);
 
116
  PRBool hasTrust(unsigned int t, unsigned int v);
 
117
  CERTCertTrust mTrust;
 
118
};
 
119
 
 
120
#endif