PageRenderTime 21ms CodeModel.GetById 14ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/security/nss/lib/pki/pkistore.h

http://github.com/zpao/v8monkey
C Header | 204 lines | 123 code | 27 blank | 54 comment | 0 complexity | bafc5647944501bc6fc6d1090aceed6d 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 PKISTORE_H
 38#define PKISTORE_H
 39
 40#ifdef DEBUG
 41static const char PKISTORE_CVS_ID[] = "@(#) $RCSfile: pkistore.h,v $ $Revision: 1.12 $ $Date: 2008/06/06 01:19:31 $";
 42#endif /* DEBUG */
 43
 44#ifndef NSSPKIT_H
 45#include "nsspkit.h"
 46#endif /* NSSPKIT_H */
 47
 48#ifndef BASE_H
 49#include "base.h"
 50#endif /* BASE_H */
 51
 52PR_BEGIN_EXTERN_C
 53
 54/* 
 55 * PKI Stores
 56 *
 57 * This is a set of routines for managing local stores of PKI objects.
 58 * Currently, the only application is in crypto contexts, where the
 59 * certificate store is used.  In the future, methods should be added
 60 * here for storing local references to keys.
 61 */
 62
 63/* 
 64 * nssCertificateStore
 65 *
 66 * Manages local store of certificate, trust, and S/MIME profile objects.
 67 * Within a crypto context, mappings of cert to trust and cert to S/MIME
 68 * profile are always 1-1.  Therefore, it is reasonable to store all objects
 69 * in a single collection, indexed by the certificate.
 70 */
 71
 72NSS_EXTERN nssCertificateStore *
 73nssCertificateStore_Create
 74(
 75  NSSArena *arenaOpt
 76);
 77
 78NSS_EXTERN PRStatus
 79nssCertificateStore_Destroy
 80(
 81  nssCertificateStore *store
 82);
 83
 84/* Atomic Find cert in store, or add this cert to the store.
 85** Ref counts properly maintained.
 86*/
 87NSS_EXTERN NSSCertificate *
 88nssCertificateStore_FindOrAdd 
 89(
 90  nssCertificateStore *store,
 91  NSSCertificate *c
 92);
 93
 94NSS_EXTERN void
 95nssCertificateStore_RemoveCertLOCKED
 96(
 97  nssCertificateStore *store,
 98  NSSCertificate *cert
 99);
100
101struct nssCertificateStoreTraceStr {
102    nssCertificateStore* store;
103    PZLock* lock;
104    PRBool locked;
105    PRBool unlocked;
106};
107
108typedef struct nssCertificateStoreTraceStr nssCertificateStoreTrace;
109
110NSS_EXTERN void
111nssCertificateStore_Lock (
112  nssCertificateStore *store, nssCertificateStoreTrace* out
113);
114
115NSS_EXTERN void
116nssCertificateStore_Unlock (
117  nssCertificateStore *store, const nssCertificateStoreTrace* in,
118  nssCertificateStoreTrace* out
119);
120
121NSS_EXTERN NSSCertificate **
122nssCertificateStore_FindCertificatesBySubject
123(
124  nssCertificateStore *store,
125  NSSDER *subject,
126  NSSCertificate *rvOpt[],
127  PRUint32 maximumOpt,
128  NSSArena *arenaOpt
129);
130
131NSS_EXTERN NSSCertificate **
132nssCertificateStore_FindCertificatesByNickname
133(
134  nssCertificateStore *store,
135  const NSSUTF8 *nickname,
136  NSSCertificate *rvOpt[],
137  PRUint32 maximumOpt,
138  NSSArena *arenaOpt
139);
140
141NSS_EXTERN NSSCertificate **
142nssCertificateStore_FindCertificatesByEmail
143(
144  nssCertificateStore *store,
145  NSSASCII7 *email,
146  NSSCertificate *rvOpt[],
147  PRUint32 maximumOpt,
148  NSSArena *arenaOpt
149);
150
151NSS_EXTERN NSSCertificate *
152nssCertificateStore_FindCertificateByIssuerAndSerialNumber
153(
154  nssCertificateStore *store,
155  NSSDER *issuer,
156  NSSDER *serial
157);
158
159NSS_EXTERN NSSCertificate *
160nssCertificateStore_FindCertificateByEncodedCertificate
161(
162  nssCertificateStore *store,
163  NSSDER *encoding
164);
165
166NSS_EXTERN PRStatus
167nssCertificateStore_AddTrust
168(
169  nssCertificateStore *store,
170  NSSTrust *trust
171);
172
173NSS_EXTERN NSSTrust *
174nssCertificateStore_FindTrustForCertificate
175(
176  nssCertificateStore *store,
177  NSSCertificate *cert
178);
179
180NSS_EXTERN PRStatus
181nssCertificateStore_AddSMIMEProfile
182(
183  nssCertificateStore *store,
184  nssSMIMEProfile *profile
185);
186
187NSS_EXTERN nssSMIMEProfile *
188nssCertificateStore_FindSMIMEProfileForCertificate
189(
190  nssCertificateStore *store,
191  NSSCertificate *cert
192);
193
194NSS_EXTERN void
195nssCertificateStore_DumpStoreInfo
196(
197  nssCertificateStore *store,
198  void (* cert_dump_iter)(const void *, void *, void *),
199  void *arg
200);
201
202PR_END_EXTERN_C
203
204#endif /* PKISTORE_H */