PageRenderTime 103ms CodeModel.GetById 40ms app.highlight 10ms RepoModel.GetById 50ms app.codeStats 0ms

/gecko_api/include/certdb.h

http://firefox-mac-pdf.googlecode.com/
C++ Header | 171 lines | 81 code | 39 blank | 51 comment | 0 complexity | 77f94099439258b6e28de820771df83e MD5 | raw file
  1/* ***** BEGIN LICENSE BLOCK *****
  2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  3 *
  4 * The contents of this file are subject to the Mozilla Public License Version
  5 * 1.1 (the "License"); you may not use this file except in compliance with
  6 * the License. You may obtain a copy of the License at
  7 * http://www.mozilla.org/MPL/
  8 *
  9 * Software distributed under the License is distributed on an "AS IS" basis,
 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 11 * for the specific language governing rights and limitations under the
 12 * License.
 13 *
 14 * The Original Code is the Netscape security libraries.
 15 *
 16 * The Initial Developer of the Original Code is
 17 * Netscape Communications Corporation.
 18 * Portions created by the Initial Developer are Copyright (C) 1994-2000
 19 * the Initial Developer. All Rights Reserved.
 20 *
 21 * Contributor(s):
 22 *
 23 * Alternatively, the contents of this file may be used under the terms of
 24 * either the GNU General Public License Version 2 or later (the "GPL"), or
 25 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 26 * in which case the provisions of the GPL or the LGPL are applicable instead
 27 * of those above. If you wish to allow use of your version of this file only
 28 * under the terms of either the GPL or the LGPL, and not to allow others to
 29 * use your version of this file under the terms of the MPL, indicate your
 30 * decision by deleting the provisions above and replace them with the notice
 31 * and other provisions required by the GPL or the LGPL. If you do not delete
 32 * the provisions above, a recipient may use your version of this file under
 33 * the terms of any one of the MPL, the GPL or the LGPL.
 34 *
 35 * ***** END LICENSE BLOCK ***** */
 36
 37#ifndef _CERTDB_H_
 38#define _CERTDB_H_
 39
 40
 41/* common flags for all types of certificates */
 42#define CERTDB_VALID_PEER	(1<<0)
 43#define CERTDB_TRUSTED		(1<<1)
 44#define CERTDB_SEND_WARN	(1<<2)
 45#define CERTDB_VALID_CA		(1<<3)
 46#define CERTDB_TRUSTED_CA	(1<<4) /* trusted for issuing server certs */
 47#define CERTDB_NS_TRUSTED_CA	(1<<5)
 48#define CERTDB_USER		(1<<6)
 49#define CERTDB_TRUSTED_CLIENT_CA (1<<7) /* trusted for issuing client certs */
 50#define CERTDB_INVISIBLE_CA	(1<<8) /* don't show in UI */
 51#define CERTDB_GOVT_APPROVED_CA	(1<<9) /* can do strong crypto in export ver */
 52
 53
 54SEC_BEGIN_PROTOS
 55
 56CERTSignedCrl *
 57SEC_FindCrlByKey(CERTCertDBHandle *handle, SECItem *crlKey, int type);
 58
 59CERTSignedCrl *
 60SEC_FindCrlByName(CERTCertDBHandle *handle, SECItem *crlKey, int type);
 61
 62CERTSignedCrl *
 63SEC_FindCrlByDERCert(CERTCertDBHandle *handle, SECItem *derCrl, int type);
 64
 65PRBool
 66SEC_CertNicknameConflict(char *nickname, SECItem *derSubject,
 67			 CERTCertDBHandle *handle);
 68CERTSignedCrl *
 69SEC_NewCrl(CERTCertDBHandle *handle, char *url, SECItem *derCrl, int type);
 70
 71SECStatus
 72SEC_DeletePermCRL(CERTSignedCrl *crl);
 73
 74
 75SECStatus
 76SEC_LookupCrls(CERTCertDBHandle *handle, CERTCrlHeadNode **nodes, int type);
 77
 78SECStatus 
 79SEC_DestroyCrl(CERTSignedCrl *crl);
 80
 81CERTSignedCrl* SEC_DupCrl(CERTSignedCrl* acrl);
 82
 83SECStatus
 84CERT_AddTempCertToPerm(CERTCertificate *cert, char *nickname,
 85		       CERTCertTrust *trust);
 86
 87SECStatus SEC_DeletePermCertificate(CERTCertificate *cert);
 88
 89PRBool
 90SEC_CrlIsNewer(CERTCrl *inNew, CERTCrl *old);
 91
 92SECCertTimeValidity
 93SEC_CheckCrlTimes(CERTCrl *crl, PRTime t);
 94
 95#ifdef notdef
 96/*
 97** Add a DER encoded certificate to the permanent database.
 98**	"derCert" is the DER encoded certificate.
 99**	"nickname" is the nickname to use for the cert
100**	"trust" is the trust parameters for the cert
101*/
102SECStatus SEC_AddPermCertificate(PCERTCertDBHandle *handle, SECItem *derCert,
103				char *nickname, PCERTCertTrust *trust);
104
105certDBEntryCert *
106SEC_FindPermCertByKey(PCERTCertDBHandle *handle, SECItem *certKey);
107
108certDBEntryCert
109*SEC_FindPermCertByName(PCERTCertDBHandle *handle, SECItem *name);
110
111SECStatus SEC_OpenPermCertDB(PCERTCertDBHandle *handle,
112			     PRBool readOnly,
113			     PCERTDBNameFunc namecb,
114			     void *cbarg);
115
116
117typedef SECStatus (PR_CALLBACK * PermCertCallback)(PCERTCertificate *cert,
118                                                   SECItem *k, void *pdata);
119/*
120** Traverse the entire permanent database, and pass the certs off to a
121** user supplied function.
122**	"certfunc" is the user function to call for each certificate
123**	"udata" is the user's data, which is passed through to "certfunc"
124*/
125SECStatus
126PCERT_TraversePermCerts(PCERTCertDBHandle *handle,
127		      PermCertCallback certfunc,
128		      void *udata );
129
130SECStatus
131SEC_AddTempNickname(PCERTCertDBHandle *handle, char *nickname, SECItem *certKey);
132
133SECStatus
134SEC_DeleteTempNickname(PCERTCertDBHandle *handle, char *nickname);
135
136
137PRBool
138SEC_CertDBKeyConflict(SECItem *derCert, PCERTCertDBHandle *handle);
139
140SECStatus
141SEC_GetCrlTimes(PCERTCrl *dates, PRTime *notBefore, PRTime *notAfter);
142
143PCERTSignedCrl *
144SEC_AddPermCrlToTemp(PCERTCertDBHandle *handle, certDBEntryRevocation *entry);
145
146SECStatus
147SEC_DeleteTempCrl(PCERTSignedCrl *crl);
148
149
150SECStatus
151SEC_CheckKRL(PCERTCertDBHandle *handle,SECKEYLowPublicKey *key,
152	     PCERTCertificate *rootCert, int64 t, void *wincx);
153
154SECStatus
155SEC_CheckCRL(PCERTCertDBHandle *handle,PCERTCertificate *cert,
156	     PCERTCertificate *caCert, int64 t, void *wincx);
157
158SECStatus
159SEC_CrlReplaceUrl(PCERTSignedCrl *crl,char *url);
160
161/* Compare two certificate validity structures and return which cert should be
162** preferred, based first on newer notAfter, then on newer notBefore.
163*/
164CERTCompareValidityStatus
165CERT_CompareValidityTimes(CERTValidity* val_a, CERTValidity* val_b);
166
167#endif
168
169SEC_END_PROTOS
170
171#endif /* _CERTDB_H_ */