summaryrefslogtreecommitdiffstats
path: root/security/nss/lib/libpkix/include/pkix_crlsel.h
blob: 491e72f43b1448f78bc01524dbce8f2308de139a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
 * This file defines functions associated with the PKIX_CRLSelector and the
 * PKIX_ComCRLSelParams types.
 *
 */


#ifndef _PKIX_CRLSEL_H
#define _PKIX_CRLSEL_H

#include "pkixt.h"

#ifdef __cplusplus
extern "C" {
#endif

/* General
 *
 * Please refer to the libpkix Programmer's Guide for detailed information
 * about how to use the libpkix library. Certain key warnings and notices from
 * that document are repeated here for emphasis.
 *
 * All identifiers in this file (and all public identifiers defined in
 * libpkix) begin with "PKIX_". Private identifiers only intended for use
 * within the library begin with "pkix_".
 *
 * A function returns NULL upon success, and a PKIX_Error pointer upon failure.
 *
 * Unless otherwise noted, for all accessor (gettor) functions that return a
 * PKIX_PL_Object pointer, callers should assume that this pointer refers to a
 * shared object. Therefore, the caller should treat this shared object as
 * read-only and should not modify this shared object. When done using the
 * shared object, the caller should release the reference to the object by
 * using the PKIX_PL_Object_DecRef function.
 *
 * While a function is executing, if its arguments (or anything referred to by
 * its arguments) are modified, free'd, or destroyed, the function's behavior
 * is undefined.
 *
 */

/* PKIX_CRLSelector
 *
 * PKIX_CRLSelectors provide a standard way for the caller to select CRLs
 * based on particular criteria. A CRLSelector is typically used by libpkix
 * to retrieve CRLs from a CertStore during certificate chain validation or
 * building. (see pkix_certstore.h) For example, the caller may wish to only
 * select those CRLs that have a particular issuer or a particular value for a
 * private CRL extension. The MatchCallback allows the caller to specify the
 * custom matching logic to be used by a CRLSelector.

 * By default, the MatchCallback is set to point to the default implementation
 * provided by libpkix, which understands how to process the most common
 * parameters. If the default implementation is used, the caller should set
 * these common parameters using PKIX_CRLSelector_SetCommonCRLSelectorParams.
 * Any common parameter that is not set is assumed to be disabled, which means
 * the default MatchCallback implementation will select all CRLs without
 * regard to that particular disabled parameter. For example, if the
 * MaxCRLNumber parameter is not set, MatchCallback will not filter out any
 * CRL based on its CRL number. As such, if no parameters are set, all are
 * disabled and any CRL will match. If a parameter is disabled, its associated
 * PKIX_ComCRLSelParams_Get* function returns a default value of NULL.
 *
 * If a custom implementation is desired, the default implementation can be
 * overridden by calling PKIX_CRLSelector_SetMatchCallback. In this case, the
 * CRLSelector can be initialized with a crlSelectorContext, which is where
 * the caller can specify the desired parameters the caller wishes to match
 * against. Note that this crlSelectorContext must be a PKIX_PL_Object,
 * allowing it to be reference-counted and allowing it to provide the standard
 * PKIX_PL_Object functions (Equals, Hashcode, ToString, Compare, Duplicate).
 *
 */

/*
 * FUNCTION: PKIX_CRLSelector_MatchCallback
 * DESCRIPTION:
 *
 *  This callback function determines whether the specified CRL pointed to by
 *  "crl" matches the criteria of the CRLSelector pointed to by "selector".
 *  If the CRL matches the CRLSelector's criteria, PKIX_TRUE is stored at
 *  "pMatch". Otherwise PKIX_FALSE is stored at "pMatch".
 *
 * PARAMETERS:
 *  "selector"
 *      Address of CRLSelector whose MatchCallback logic and parameters are
 *      to be used. Must be non-NULL.
 *  "crl"
 *      Address of CRL that is to be matched using "selector". Must be non-NULL.
 *  "pMatch"
 *      Address at which Boolean result is stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe
 *
 *  Multiple threads must be able to safely call this function without
 *  worrying about conflicts, even if they're operating on the same objects.
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRLSelector Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
typedef PKIX_Error *
(*PKIX_CRLSelector_MatchCallback)(
        PKIX_CRLSelector *selector,
        PKIX_PL_CRL *crl,
        PKIX_Boolean *pMatch,
        void *plContext);

/*
 * FUNCTION: PKIX_CRLSelector_Create
 * DESCRIPTION:
 *
 *  Creates a new CRLSelector using the Object pointed to by
 *  "crlSelectorContext" (if any) and stores it at "pSelector". As noted
 *  above, by default, the MatchCallback is set to point to the default
 *  implementation provided by libpkix, which understands how to process
 *  ComCRLSelParams. This is overridden if the MatchCallback pointed to by
 *  "callback" is not NULL, in which case the parameters are specified using
 *  the Object pointed to by "crlSelectorContext".
 *
 * PARAMETERS:
 *  "issue"
 *      crl issuer.
 *  "crlDpList"
 *      distribution points list
 *  "callback"
 *      The MatchCallback function to be used.
 *  "pSelector"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRLSelector Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_CRLSelector_Create(
        PKIX_PL_Cert *issuer,
        PKIX_List *crlDpList,
        PKIX_PL_Date *date,
        PKIX_CRLSelector **pSelector,
        void *plContext);

/*
 * FUNCTION: PKIX_CRLSelector_GetMatchCallback
 * DESCRIPTION:
 *
 *  Retrieves a pointer to "selector's" Match callback function and puts it in
 *  "pCallback".
 *
 * PARAMETERS:
 *  "selector"
 *      The CRLSelector whose Match callback is desired. Must be non-NULL.
 *  "pCallback"
 *      Address where Match callback function pointer will be stored.
 *      Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRLSelector Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_CRLSelector_GetMatchCallback(
        PKIX_CRLSelector *selector,
        PKIX_CRLSelector_MatchCallback *pCallback,
        void *plContext);

/*
 * FUNCTION: PKIX_CRLSelector_GetCRLSelectorContext
 * DESCRIPTION:
 *
 *  Retrieves a pointer to a PKIX_PL_Object representing the context (if any)
 *  of the CRLSelector pointed to by "selector" and stores it at
 *  "pCRLSelectorContext".
 *
 * PARAMETERS:
 *  "selector"
 *      Address of CRLSelector whose context is to be stored. Must be non-NULL.
 *  "pCRLSelectorContext"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRLSelector Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_CRLSelector_GetCRLSelectorContext(
        PKIX_CRLSelector *selector,
        void **pCRLSelectorContext,
        void *plContext);

/*
 * FUNCTION: PKIX_CRLSelector_GetCommonCRLSelectorParams
 * DESCRIPTION:
 *
 *  Retrieves a pointer to the ComCRLSelParams object that represent the common
 *  parameters of the CRLSelector pointed to by "selector" and stores it at
 *  "pCommonCRLSelectorParams". If there are no common parameters stored with
 *  the CRLSelector, this function stores NULL at "pCommonCRLSelectorParams".
 *
 * PARAMETERS:
 *  "selector"
 *      Address of CRLSelector whose ComCRLSelParams are to be stored.
 *      Must be non-NULL.
 *  "pCommonCRLSelectorParams"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Conditionally Thread Safe
 *      (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRLSelector Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_CRLSelector_GetCommonCRLSelectorParams(
        PKIX_CRLSelector *selector,
        PKIX_ComCRLSelParams **pCommonCRLSelectorParams,
        void *plContext);

/*
 * FUNCTION: PKIX_CRLSelector_SetCommonCRLSelectorParams
 * DESCRIPTION:
 *
 *  Sets the common parameters for the CRLSelector pointed to by "selector"
 *  using the ComCRLSelParams pointed to by "commonCRLSelectorParams".
 *
 * PARAMETERS:
 *  "selector"
 *      Address of CRLSelector whose common parameters are to be set.
 *      Must be non-NULL.
 *  "commonCRLSelectorParams"
 *      Address of ComCRLSelParams representing the common parameters.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Not Thread Safe - assumes exclusive access to "selector"
 *  (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRLSelector Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_CRLSelector_SetCommonCRLSelectorParams(
        PKIX_CRLSelector *selector,
        PKIX_ComCRLSelParams *commonCRLSelectorParams,
        void *plContext);

/* PKIX_ComCRLSelParams
 *
 * PKIX_ComCRLSelParams are X.509 parameters commonly used with CRLSelectors,
 * especially determining which CRLs to retrieve from a CertStore.
 * PKIX_ComCRLSelParams are typically used with those CRLSelectors that use
 * the default implementation of MatchCallback, which understands how to
 * process ComCRLSelParams.
 */

/*
 * FUNCTION: PKIX_ComCRLSelParams_Create
 * DESCRIPTION:
 *
 *  Creates a new ComCRLSelParams object and stores it at "pParams".
 *
 * PARAMETERS:
 *  "pParams"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRLSelector Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_ComCRLSelParams_Create(
        PKIX_ComCRLSelParams **pParams,
        void *plContext);

/*
 * FUNCTION: PKIX_ComCRLSelParams_GetIssuerNames
 * DESCRIPTION:
 *
 *  Retrieves a pointer to the List of X500Names (if any) representing the
 *  issuer names criterion that is set in the ComCRLSelParams pointed to by
 *  "params" and stores it at "pNames". In order to match against this
 *  criterion, a CRL's IssuerName must match at least one of the criterion's
 *  issuer names.
 *
 *  If "params" does not have this criterion set, this function stores NULL at
 *  "pNames", in which case all CRLs are considered to match.
 *
 *  Note that the List returned by this function is immutable.
 *
 * PARAMETERS:
 *  "params"
 *      Address of ComCRLSelParams whose issuer names criterion (if any) is to
 *      be stored. Must be non-NULL.
 *  "pNames"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Conditionally Thread Safe
 *      (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRLSelector Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_ComCRLSelParams_GetIssuerNames(
        PKIX_ComCRLSelParams *params,
        PKIX_List **pNames,  /* list of PKIX_PL_X500Name */
        void *plContext);

/*
 * FUNCTION: PKIX_ComCRLSelParams_SetIssuerNames
 * DESCRIPTION:
 *
 *  Sets the issuer names criterion of the ComCRLSelParams pointed to by
 *  "params" using a List of X500Names pointed to by "names". In order to match
 *  against this criterion, a CRL's IssuerName must match at least one of the
 *  criterion's issuer names.
 *
 * PARAMETERS:
 *  "params"
 *      Address of ComCRLSelParamsParams whose issuer names criterion is to be
 *      set. Must be non-NULL.
 *  "names"
 *      Address of List of X500Names used to set the criterion
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Not Thread Safe - assumes exclusive access to "params"
 *  (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRLSelector Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_ComCRLSelParams_SetIssuerNames(
        PKIX_ComCRLSelParams *params,
        PKIX_List *names,   /* list of PKIX_PL_X500Name */
        void *plContext);

/*
 * FUNCTION: PKIX_ComCRLSelParams_AddIssuerName
 * DESCRIPTION:
 *
 *  Adds to the issuer names criterion of the ComCRLSelParams pointed to by
 *  "params" using the X500Name pointed to by "name". In order to match
 *  against this criterion, a CRL's IssuerName must match at least one of the
 *  criterion's issuer names.
 *
 * PARAMETERS:
 *  "params"
 *      Address of ComCRLSelParams whose issuer names criterion is to be added
 *      to. Must be non-NULL.
 *  "name"
 *      Address of X500Name to be added.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Not Thread Safe - assumes exclusive access to "params"
 *  (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRLSelector Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_ComCRLSelParams_AddIssuerName(
        PKIX_ComCRLSelParams *params,
        PKIX_PL_X500Name *name,
        void *plContext);

/*
 * FUNCTION: PKIX_ComCRLSelParams_GetCertificateChecking
 * DESCRIPTION:
 *
 *  Retrieves a pointer to the Cert (if any) representing the certificate whose
 *  revocation status is being checked. This is not a criterion. It is simply
 *  optional information that may help a CertStore find relevant CRLs.
 *
 *  If "params" does not have a certificate set, this function stores NULL at
 *  "pCert", in which case there is no optional information to provide.
 *
 * PARAMETERS:
 *  "params"
 *      Address of ComCRLSelParams whose certificate being checked (if any) is
 *      to be stored. Must be non-NULL.
 *  "pCert"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Conditionally Thread Safe
 *      (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds
 *  Returns a CRLSelector Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_ComCRLSelParams_GetCertificateChecking(
        PKIX_ComCRLSelParams *params,
        PKIX_PL_Cert **pCert,
        void *plContext);

/*
 * FUNCTION: PKIX_ComCRLSelParams_SetCertificateChecking
 * DESCRIPTION:
 *
 *  Sets the ComCRLSelParams pointed to by "params" with the certificate
 *  (pointed to by "cert") whose revocation status is being checked. This is
 *  not a criterion. It is simply optional information that may help a
 *  CertStore find relevant CRLs.
 *
 * PARAMETERS:
 *  "params"
 *      Address of ComCRLSelParams whose certificate being checked is to be
 *      set. Must be non-NULL.
 *  "cert"
 *      Address of Cert whose revocation status is being checked
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Not Thread Safe - assumes exclusive access to "params"
 *  (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRLSelector Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_ComCRLSelParams_SetCertificateChecking(
        PKIX_ComCRLSelParams *params,
        PKIX_PL_Cert *cert,
        void *plContext);

/*
 * FUNCTION: PKIX_ComCRLSelParams_GetDateAndTime
 * DESCRIPTION:
 *
 *  Retrieves a pointer to the Date (if any) representing the dateAndTime
 *  criterion that is set in the ComCRLSelParams pointed to by "params" and
 *  stores it at "pDate". In order to match against this criterion, a CRL's
 *  thisUpdate component must be less than or equal to the criterion's
 *  dateAndTime and the CRL's nextUpdate component must be later than the
 *  criterion's dateAndTime. There is no match if the CRL does not contain a
 *  nextUpdate component.
 *
 *  If "params" does not have this criterion set, this function stores NULL at
 *  "pDate", in which case all CRLs are considered to match.
 *
 * PARAMETERS:
 *  "params"
 *      Address of ComCRLSelParams whose dateAndTime criterion (if any) is to
 *      be stored. Must be non-NULL.
 *  "pDate"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Conditionally Thread Safe
 *      (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRLSelector Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_ComCRLSelParams_GetDateAndTime(
        PKIX_ComCRLSelParams *params,
        PKIX_PL_Date **pDate,
        void *plContext);

/*
 * FUNCTION: PKIX_ComCRLSelParams_SetDateAndTime
 * DESCRIPTION:
 *
 *  Sets the dateAndTime criterion of the ComCRLSelParams pointed to by
 *  "params" using a Date pointed to by "date". In order to match against this
 *  criterion, a CRL's thisUpdate component must be less than or equal to the
 *  criterion's dateAndTime and the CRL's nextUpdate component must be later
 *  than the criterion's dateAndTime. There is no match if the CRL does not
 *  contain a nextUpdate component.
 *
 * PARAMETERS:
 *  "params"
 *      Address of ComCRLSelParamsParams whose dateAndTime criterion is to be
 *      set. Must be non-NULL.
 *  "date"
 *      Address of Date used to set the criterion
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Not Thread Safe - assumes exclusive access to "params"
 *  (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRLSelector Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_ComCRLSelParams_SetDateAndTime(
        PKIX_ComCRLSelParams *params,
        PKIX_PL_Date *date,
        void *plContext);

/* 
 * FUNCTION: PKIX_ComCRLSelParams_GetNISTPolicyEnabled
 * DESCRIPTION:
 *
 *  Retrieves a pointer to the Boolean representing the NIST CRL policy
 *  activation flag that is set in the ComCRLSelParams pointed to by "params"
 *  and stores it at "enabled". If enabled, a CRL must have nextUpdate field.
 *
 *  Default value for this flag is TRUE.
 *
 * PARAMETERS:
 *  "params"
 *      Address of ComCRLSelParams whose NIST CRL policy criterion  is to
 *      be stored. Must be non-NULL.
 *  "pEnabled"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Conditionally Thread Safe
 *      (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRLSelector Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_ComCRLSelParams_GetNISTPolicyEnabled(
        PKIX_ComCRLSelParams *params,
        PKIX_Boolean *pEnabled,
        void *plContext);

/*
 * FUNCTION: PKIX_ComCRLSelParams_SetNISTPolicyEnabled
 * DESCRIPTION:
 *
 *  Sets the NIST crl policy criterion of the ComCRLSelParams pointed to by
 *  "params" using a "enabled" flag. In order to match against this
 *  criterion, a CRL's nextUpdate must be available and criterion's
 *  dataAndTime must be within thisUpdate and nextUpdate time period.
 *
 * PARAMETERS:
 *  "params"
 *      Address of ComCRLSelParamsParams whose NIST CRL policy criterion
 *      is to be set. Must be non-NULL.
 *  "enabled"
 *      Address of Bollean used to set the criterion
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Not Thread Safe - assumes exclusive access to "params"
 *  (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRLSelector Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_ComCRLSelParams_SetNISTPolicyEnabled(
        PKIX_ComCRLSelParams *params,
        PKIX_Boolean enabled,
        void *plContext);

/*
 * FUNCTION: PKIX_ComCRLSelParams_GetMaxCRLNumber
 * DESCRIPTION:
 *
 *  Retrieves a pointer to the BigInt (if any) representing the maxCRLNumber
 *  criterion that is set in the ComCRLSelParams pointed to by "params" and
 *  stores it at "pNumber". In order to match against this criterion, a CRL
 *  must have a CRL number extension whose value is less than or equal to the
 *  criterion's value.
 *
 *  If "params" does not have this criterion set, this function stores NULL at
 *  "pNumber", in which case all CRLs are considered to match.
 *
 * PARAMETERS:
 *  "params"
 *      Address of ComCRLSelParams whose maxCRLNumber criterion (if any) is to
 *      be stored. Must be non-NULL.
 *  "pNumber"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Conditionally Thread Safe
 *      (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRLSelector Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_ComCRLSelParams_GetMaxCRLNumber(
        PKIX_ComCRLSelParams *params,
        PKIX_PL_BigInt **pNumber,
        void *plContext);

/*
 * FUNCTION: PKIX_ComCRLSelParams_SetMaxCRLNumber
 * DESCRIPTION:
 *
 *  Sets the maxCRLNumber criterion of the ComCRLSelParams pointed to by
 *  "params" using a BigInt pointed to by "number". In order to match against
 *  this criterion, a CRL must have a CRL number extension whose value is less
 *  than or equal to the criterion's value.
 *
 * PARAMETERS:
 *  "params"
 *      Address of ComCRLSelParamsParams whose maxCRLNumber criterion is to be
 *      set. Must be non-NULL.
 *  "number"
 *      Address of BigInt used to set the criterion
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Not Thread Safe - assumes exclusive access to "params"
 *  (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRLSelector Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_ComCRLSelParams_SetMaxCRLNumber(
        PKIX_ComCRLSelParams *params,
        PKIX_PL_BigInt *number,
        void *plContext);

/*
 * FUNCTION: PKIX_ComCRLSelParams_GetMinCRLNumber
 * DESCRIPTION:
 *
 *  Retrieves a pointer to the BigInt (if any) representing the minCRLNumber
 *  criterion that is set in the ComCRLSelParams pointed to by "params" and
 *  stores it at "pNumber". In order to match against this criterion, a CRL
 *  must have a CRL number extension whose value is greater than or equal to
 *  the criterion's value.
 *
 *  If "params" does not have this criterion set, this function stores NULL at
 *  "pNumber", in which case all CRLs are considered to match.
 *
 * PARAMETERS:
 *  "params"
 *      Address of ComCRLSelParams whose minCRLNumber criterion (if any) is to
 *      be stored. Must be non-NULL.
 *  "pNumber"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Conditionally Thread Safe
 *      (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRLSelector Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_ComCRLSelParams_GetMinCRLNumber(
        PKIX_ComCRLSelParams *params,
        PKIX_PL_BigInt **pNumber,
        void *plContext);

/*
 * FUNCTION: PKIX_ComCRLSelParams_SetMinCRLNumber
 * DESCRIPTION:
 *
 *  Sets the minCRLNumber criterion of the ComCRLSelParams pointed to by
 *  "params" using a BigInt pointed to by "number". In order to match against
 *  this criterion, a CRL must have a CRL number extension whose value is
 *  greater than or equal to the criterion's value.
 *
 * PARAMETERS:
 *  "params"
 *      Address of ComCRLSelParamsParams whose minCRLNumber criterion is to be
 *      set. Must be non-NULL.
 *  "number"
 *      Address of BigInt used to set the criterion
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Not Thread Safe - assumes exclusive access to "params"
 *  (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRLSelector Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_ComCRLSelParams_SetMinCRLNumber(
        PKIX_ComCRLSelParams *params,
        PKIX_PL_BigInt *number,
        void *plContext);

/*
 * FUNCTION: PKIX_ComCRLSelParams_SetCrlDp
 * DESCRIPTION:
 *
 * Sets crldp list that can be used to download a crls.
 * 
 * PARAMETERS:
 *  "params"
 *      Address of ComCRLSelParamsParams whose minCRLNumber criterion is to be
 *      set. Must be non-NULL.
 *  "crldpList"
 *      A list of CRLDPs. Can be an emptry list.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Not Thread Safe - assumes exclusive access to "params"
 *  (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRLSelector Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error*
PKIX_ComCRLSelParams_SetCrlDp(
         PKIX_ComCRLSelParams *params,
         PKIX_List *crldpList,
         void *plContext);

#ifdef __cplusplus
}
#endif

#endif /* _PKIX_CRLSEL_H */