Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: mozilla/security/nss/lib/libpkix/include/pkix_sample_modules.h

Issue 14249009: Change the NSS and NSPR source tree to the new directory structure to be (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/nss/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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/. */
4 /*
5 * This file defines functions associated with CertStore types.
6 *
7 */
8
9
10 #ifndef _PKIX_SAMPLEMODULES_H
11 #define _PKIX_SAMPLEMODULES_H
12
13 #include "pkix_pl_common.h"
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18
19 /* General
20 *
21 * Please refer to the libpkix Programmer's Guide for detailed information
22 * about how to use the libpkix library. Certain key warnings and notices from
23 * that document are repeated here for emphasis.
24 *
25 * All identifiers in this file (and all public identifiers defined in
26 * libpkix) begin with "PKIX_". Private identifiers only intended for use
27 * within the library begin with "pkix_".
28 *
29 * A function returns NULL upon success, and a PKIX_Error pointer upon failure.
30 *
31 * Unless otherwise noted, for all accessor (gettor) functions that return a
32 * PKIX_PL_Object pointer, callers should assume that this pointer refers to a
33 * shared object. Therefore, the caller should treat this shared object as
34 * read-only and should not modify this shared object. When done using the
35 * shared object, the caller should release the reference to the object by
36 * using the PKIX_PL_Object_DecRef function.
37 *
38 * While a function is executing, if its arguments (or anything referred to by
39 * its arguments) are modified, free'd, or destroyed, the function's behavior
40 * is undefined.
41 *
42 */
43
44 /* PKIX_PL_CollectionCertStore
45 *
46 * A PKIX_CollectionCertStore provides an example for showing how to retrieve
47 * certificates and CRLs from a repository, such as a directory in the system.
48 * It is expected the directory is an absolute directory which contains CRL
49 * and Cert data files. CRL files are expected to have the suffix of .crl
50 * and Cert files are expected to have the suffix of .crt .
51 *
52 * Once the caller has created the CollectionCertStoreContext object, the caller
53 * then can call pkix_pl_CollectionCertStore_GetCert or
54 * pkix_pl_CollectionCertStore_GetCRL to obtain Lists of PKIX_PL_Cert or
55 * PKIX_PL_CRL objects, respectively.
56 */
57
58 /*
59 * FUNCTION: PKIX_PL_CollectionCertStore_Create
60 * DESCRIPTION:
61 *
62 * Creates a new CollectionCertStore and returns it at
63 * "pColCertStore".
64 *
65 * PARAMETERS:
66 * "storeDir"
67 * The absolute path where *.crl files are located.
68 * "pColCertStoreContext"
69 * Address where object pointer will be stored. Must be non-NULL.
70 * "plContext"
71 * Platform-specific context pointer.
72 * THREAD SAFETY:
73 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
74 * RETURNS:
75 * Returns NULL if the function succeeds.
76 * Returns a CollectionCertStoreContext Error if the function fails in
77 * a non-fatal way.
78 * Returns a Fatal Error if the function fails in an unrecoverable way.
79 */
80 PKIX_Error *
81 PKIX_PL_CollectionCertStore_Create(
82 PKIX_PL_String *storeDir,
83 PKIX_CertStore **pCertStore,
84 void *plContext);
85
86 /* PKIX_PL_PK11CertStore
87 *
88 * A PKIX_PL_PK11CertStore retrieves certificates and CRLs from a PKCS11
89 * database. The directory that contains the cert8.db, key3.db, and secmod.db
90 * files that comprise a PKCS11 database are specified in NSS initialization.
91 *
92 * Once the caller has created the Pk11CertStore object, the caller can call
93 * pkix_pl_Pk11CertStore_GetCert or pkix_pl_Pk11CertStore_GetCert to obtain
94 * a List of PKIX_PL_Certs or PKIX_PL_CRL objects, respectively.
95 */
96
97 /*
98 * FUNCTION: PKIX_PL_Pk11CertStore_Create
99 * DESCRIPTION:
100 *
101 * Creates a new Pk11CertStore and returns it at "pPk11CertStore".
102 *
103 * PARAMETERS:
104 * "pPk11CertStore"
105 * Address where object pointer will be stored. Must be non-NULL.
106 * "plContext"
107 * Platform-specific context pointer.
108 * THREAD SAFETY:
109 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
110 * RETURNS:
111 * Returns NULL if the function succeeds.
112 * Returns a CertStore Error if the function fails in a non-fatal way.
113 * Returns a Fatal Error if the function fails in an unrecoverable way.
114 */
115 PKIX_Error *
116 PKIX_PL_Pk11CertStore_Create(
117 PKIX_CertStore **pPk11CertStore,
118 void *plContext);
119
120 /* PKIX_PL_LdapCertStore
121 *
122 * A PKIX_PL_LdapCertStore retrieves certificates and CRLs from an LDAP server
123 * over a socket connection. It used the LDAP protocol as described in RFC1777.
124 *
125 * Once the caller has created the LdapCertStore object, the caller can call
126 * pkix_pl_LdapCertStore_GetCert or pkix_pl_LdapCertStore_GetCert to obtain
127 * a List of PKIX_PL_Certs or PKIX_PL_CRL objects, respectively.
128 */
129
130 /*
131 * FUNCTION: PKIX_PL_LdapDefaultClient_Create
132 * DESCRIPTION:
133 *
134 * Creates an LdapDefaultClient using the PRNetAddr poined to by "sockaddr",
135 * with a timeout value of "timeout", and a BindAPI pointed to by "bindAPI";
136 * and stores the address of the default LdapClient at "pClient".
137 *
138 * At the time of this version, there are unresolved questions about the LDAP
139 * protocol. Although RFC1777 describes a BIND and UNBIND message, it is not
140 * clear whether they are appropriate to this application. We have tested only
141 * using servers that do not expect authentication, and that reject BIND
142 * messages. It is not clear what values might be appropriate for the bindname
143 * and authentication fields, which are currently implemented as char strings
144 * supplied by the caller. (If this changes, the API and possibly the templates
145 * will have to change.) Therefore the Client_Create API contains a BindAPI
146 * structure, a union, which will have to be revised and extended when this
147 * area of the protocol is better understood.
148 *
149 * PARAMETERS:
150 * "sockaddr"
151 * Address of the PRNetAddr to be used for the socket connection. Must be
152 * non-NULL.
153 * "timeout"
154 * The PRIntervalTime value to be used as a timeout value in socket calls;
155 * a zero value indicates non-blocking I/O is to be used.
156 * "bindAPI"
157 * The address of a BindAPI to be used if a BIND message is required. If
158 * this argument is NULL, no Bind (or Unbind) will be sent.
159 * "pClient"
160 * Address where object pointer will be stored. Must be non-NULL.
161 * "plContext"
162 * Platform-specific context pointer.
163 * THREAD SAFETY:
164 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
165 * RETURNS:
166 * Returns NULL if the function succeeds.
167 * Returns a CertStore Error if the function fails in a non-fatal way.
168 * Returns a Fatal Error if the function fails in an unrecoverable way.
169 */
170 PKIX_Error *
171 PKIX_PL_LdapDefaultClient_Create(
172 PRNetAddr *sockaddr,
173 PRIntervalTime timeout,
174 LDAPBindAPI *bindAPI,
175 PKIX_PL_LdapDefaultClient **pClient,
176 void *plContext);
177
178 /*
179 * FUNCTION: PKIX_PL_LdapDefaultClient_CreateByName
180 * DESCRIPTION:
181 *
182 * Creates an LdapDefaultClient using the hostname poined to by "hostname",
183 * with a timeout value of "timeout", and a BindAPI pointed to by "bindAPI";
184 * and stores the address of the default LdapClient at "pClient".
185 *
186 * At the time of this version, there are unresolved questions about the LDAP
187 * protocol. Although RFC1777 describes a BIND and UNBIND message, it is not
188 * clear whether they are appropriate to this application. We have tested only
189 * using servers that do not expect authentication, and that reject BIND
190 * messages. It is not clear what values might be appropriate for the bindname
191 * and authentication fields, which are currently implemented as char strings
192 * supplied by the caller. (If this changes, the API and possibly the templates
193 * will have to change.) Therefore the Client_Create API contains a BindAPI
194 * structure, a union, which will have to be revised and extended when this
195 * area of the protocol is better understood.
196 *
197 * PARAMETERS:
198 * "hostname"
199 * Address of the hostname to be used for the socket connection. Must be
200 * non-NULL.
201 * "timeout"
202 * The PRIntervalTime value to be used as a timeout value in socket calls;
203 * a zero value indicates non-blocking I/O is to be used.
204 * "bindAPI"
205 * The address of a BindAPI to be used if a BIND message is required. If
206 * this argument is NULL, no Bind (or Unbind) will be sent.
207 * "pClient"
208 * Address where object pointer will be stored. Must be non-NULL.
209 * "plContext"
210 * Platform-specific context pointer.
211 * THREAD SAFETY:
212 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
213 * RETURNS:
214 * Returns NULL if the function succeeds.
215 * Returns a CertStore Error if the function fails in a non-fatal way.
216 * Returns a Fatal Error if the function fails in an unrecoverable way.
217 */
218 PKIX_Error *
219 PKIX_PL_LdapDefaultClient_CreateByName(
220 char *hostname,
221 PRIntervalTime timeout,
222 LDAPBindAPI *bindAPI,
223 PKIX_PL_LdapDefaultClient **pClient,
224 void *plContext);
225
226 /*
227 * FUNCTION: PKIX_PL_LdapCertStore_Create
228 * DESCRIPTION:
229 *
230 * Creates a new LdapCertStore using the LdapClient pointed to by "client",
231 * and stores the address of the CertStore at "pCertStore".
232 *
233 * PARAMETERS:
234 * "client"
235 * Address of the LdapClient to be used. Must be non-NULL.
236 * "pCertStore"
237 * Address where object pointer will be stored. Must be non-NULL.
238 * "plContext"
239 * Platform-specific context pointer.
240 * THREAD SAFETY:
241 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
242 * RETURNS:
243 * Returns NULL if the function succeeds.
244 * Returns a CertStore Error if the function fails in a non-fatal way.
245 * Returns a Fatal Error if the function fails in an unrecoverable way.
246 */
247 PKIX_Error *
248 PKIX_PL_LdapCertStore_Create(
249 PKIX_PL_LdapClient *client,
250 PKIX_CertStore **pCertStore,
251 void *plContext);
252
253 /* PKIX_PL_NssContext
254 *
255 * A PKIX_PL_NssContext provides an example showing how the "plContext"
256 * argument, that is part of every libpkix function call, can be used.
257 * The "plContext" is the Portability Layer Context, which can be used
258 * to communicate layer-specific information from the application to the
259 * underlying Portability Layer (while bypassing the Portable Code, which
260 * blindly passes the plContext on to every function call).
261 *
262 * In this case, NSS serves as both the application and the Portability Layer.
263 * We define an NSS-specific structure, which includes an arena and a number
264 * of SECCertificateUsage bit flags encoded as a PKIX_UInt32. A third argument,
265 * wincx, is used on Windows platforms for PKCS11 access, and should be set to
266 * NULL for other platforms.
267 * Before calling any of the libpkix functions, the caller should create the NSS
268 * context, by calling PKIX_PL_NssContext_Create, and provide that NSS context
269 * as the "plContext" argument in every libpkix function call the caller makes.
270 * When the caller is finished using the NSS context (usually just after he
271 * calls PKIX_Shutdown), the caller should call PKIX_PL_NssContext_Destroy to
272 * free the NSS context structure.
273 */
274
275 /*
276 * FUNCTION: PKIX_PL_NssContext_Create
277 * DESCRIPTION:
278 *
279 * Creates a new NssContext using the certificate usage(s) specified by
280 * "certUsage" and stores it at "pNssContext". This function also internally
281 * creates an arena and stores it as part of the NssContext structure. Unlike
282 * most other libpkix API functions, this function does not take a "plContext"
283 * parameter.
284 *
285 * PARAMETERS:
286 * "certUsage"
287 * The desired SECCertificateUsage(s).
288 * "useNssArena"
289 * Boolean flag indicates NSS Arena is used for memory allocation.
290 * "wincx"
291 * A Windows-dependent pointer for PKCS11 token handling.
292 * "pNssContext"
293 * Address where object pointer will be stored. Must be non-NULL.
294 * THREAD SAFETY:
295 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
296 * RETURNS:
297 * Returns NULL if the function succeeds.
298 * Returns a Context Error if the function fails in a non-fatal way.
299 * Returns a Fatal Error if the function fails in an unrecoverable way.
300 */
301 PKIX_Error *
302 PKIX_PL_NssContext_Create(
303 PKIX_UInt32 certificateUsage,
304 PKIX_Boolean useNssArena,
305 void *wincx,
306 void **pNssContext);
307
308 /*
309 * FUNCTION: PKIX_PL_NssContext_Destroy
310 * DESCRIPTION:
311 *
312 * Frees the structure pointed to by "nssContext" along with any of its
313 * associated memory. Unlike most other libpkix API functions, this function
314 * does not take a "plContext" parameter.
315 *
316 * PARAMETERS:
317 * "nssContext"
318 * Address of NssContext to be destroyed. Must be non-NULL.
319 * THREAD SAFETY:
320 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
321 * RETURNS:
322 * Returns NULL if the function succeeds.
323 * Returns a Context Error if the function fails in a non-fatal way.
324 * Returns a Fatal Error if the function fails in an unrecoverable way.
325 */
326 PKIX_Error *
327 PKIX_PL_NssContext_Destroy(
328 void *nssContext);
329
330 /*
331 * FUNCTION: PKIX_PL_NssContext_SetTimeout
332 * DESCRIPTION:
333 *
334 * Sets IO timeout for network operations like OCSP response and cert
335 * fetching.
336 *
337 * PARAMETERS:
338 * "nssContext"
339 * Address of NssContext to be destroyed. Must be non-NULL.
340 * THREAD SAFETY:
341 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
342 * RETURNS:
343 * Returns NULL if the function succeeds.
344 * Returns a Context Error if the function fails in a non-fatal way.
345 * Returns a Fatal Error if the function fails in an unrecoverable way.
346 */
347 PKIX_Error *
348 PKIX_PL_NssContext_SetTimeout(PKIX_UInt32 timeout, PKIX_PL_NssContext *nssContex t);
349
350 /*
351 * FUNCTION: PKIX_PL_NssContext_SetMaxResponseLen
352 * DESCRIPTION:
353 *
354 * Sets maximum responce length allowed during network IO operations.
355 *
356 * PARAMETERS:
357 * "nssContext"
358 * Address of NssContext to be destroyed. Must be non-NULL.
359 * THREAD SAFETY:
360 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
361 * RETURNS:
362 * Returns NULL if the function succeeds.
363 * Returns a Context Error if the function fails in a non-fatal way.
364 * Returns a Fatal Error if the function fails in an unrecoverable way.
365 */
366 PKIX_Error *
367 PKIX_PL_NssContext_SetMaxResponseLen(PKIX_UInt32 len, PKIX_PL_NssContext *nssCon text);
368
369 /*
370 * FUNCTION: PKIX_PL_NssContext_SetCrlReloadDelay
371 * DESCRIPTION:
372 *
373 * Sets user defined timeout between attempts to load crl using
374 * CRLDP.
375 *
376 * PARAMETERS:
377 * "delaySeconds"
378 * Reload delay in seconds.
379 * "nssContext"
380 * Address of NssContext to be destroyed. Must be non-NULL.
381 * THREAD SAFETY:
382 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
383 * RETURNS:
384 * Returns NULL if the function succeeds.
385 * Returns a Context Error if the function fails in a non-fatal way.
386 * Returns a Fatal Error if the function fails in an unrecoverable way.
387 */
388 PKIX_Error *
389 PKIX_PL_NssContext_SetCrlReloadDelay(PKIX_UInt32 delaySeconds,
390 PKIX_PL_NssContext *nssContext);
391
392 /*
393 * FUNCTION: PKIX_PL_NssContext_SetBadDerCrlReloadDelay
394 * DESCRIPTION:
395 *
396 * Sets user defined timeout between attempts to load crls
397 * that failed to decode.
398 *
399 * PARAMETERS:
400 * "delaySeconds"
401 * Reload delay in seconds.
402 * "nssContext"
403 * Address of NssContext to be destroyed. Must be non-NULL.
404 * THREAD SAFETY:
405 * Thread Safe (see Thread Safety Definitions in Programmer's Guide)
406 * RETURNS:
407 * Returns NULL if the function succeeds.
408 * Returns a Context Error if the function fails in a non-fatal way.
409 * Returns a Fatal Error if the function fails in an unrecoverable way.
410 */
411 PKIX_Error *
412 PKIX_PL_NssContext_SetBadDerCrlReloadDelay(PKIX_UInt32 delaySeconds,
413 PKIX_PL_NssContext *nssContext);
414 #ifdef __cplusplus
415 }
416 #endif
417
418 #endif /* _PKIX_SAMPLEMODULES_H */
OLDNEW
« no previous file with comments | « mozilla/security/nss/lib/libpkix/include/pkix_revchecker.h ('k') | mozilla/security/nss/lib/libpkix/include/pkix_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698