comparison nss/lib/libpkix/pkix/certsel/pkix_comcertselparams.c @ 0:1e5118fa0cb1

This is NSS with a Cmake Buildsyste To compile a static NSS library for Windows we've used the Chromium-NSS fork and added a Cmake buildsystem to compile it statically for Windows. See README.chromium for chromium changes and README.trustbridge for our modifications.
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 28 Jul 2014 10:47:06 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1e5118fa0cb1
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 * pkix_comcertselparams.c
6 *
7 * ComCertSelParams Object Functions
8 *
9 */
10
11 #include "pkix_comcertselparams.h"
12
13 /* --Private-Functions-------------------------------------------- */
14
15 /*
16 * FUNCTION: pkix_ComCertSelParams_Destroy
17 * (see comments for PKIX_PL_DestructorCallback in pkix_pl_system.h)
18 */
19 static PKIX_Error *
20 pkix_ComCertSelParams_Destroy(
21 PKIX_PL_Object *object,
22 void *plContext)
23 {
24 PKIX_ComCertSelParams *params = NULL;
25
26 PKIX_ENTER(COMCERTSELPARAMS, "pkix_ComCertSelParams_Destroy");
27 PKIX_NULLCHECK_ONE(object);
28
29 /* Check that this object is a comCertSelParams object */
30 PKIX_CHECK(pkix_CheckType
31 (object, PKIX_COMCERTSELPARAMS_TYPE, plContext),
32 PKIX_OBJECTNOTCOMCERTSELPARAMS);
33
34 params = (PKIX_ComCertSelParams *)object;
35
36 PKIX_DECREF(params->subject);
37 PKIX_DECREF(params->policies);
38 PKIX_DECREF(params->cert);
39 PKIX_DECREF(params->nameConstraints);
40 PKIX_DECREF(params->pathToNames);
41 PKIX_DECREF(params->subjAltNames);
42 PKIX_DECREF(params->date);
43 PKIX_DECREF(params->extKeyUsage);
44 PKIX_DECREF(params->certValid);
45 PKIX_DECREF(params->issuer);
46 PKIX_DECREF(params->serialNumber);
47 PKIX_DECREF(params->authKeyId);
48 PKIX_DECREF(params->subjKeyId);
49 PKIX_DECREF(params->subjPubKey);
50 PKIX_DECREF(params->subjPKAlgId);
51
52 cleanup:
53
54 PKIX_RETURN(COMCERTSELPARAMS);
55 }
56
57 /*
58 * FUNCTION: pkix_ComCertSelParams_Duplicate
59 * (see comments for PKIX_PL_DuplicateCallback in pkix_pl_system.h)
60 */
61 static PKIX_Error *
62 pkix_ComCertSelParams_Duplicate(
63 PKIX_PL_Object *object,
64 PKIX_PL_Object **pNewObject,
65 void *plContext)
66 {
67 PKIX_ComCertSelParams *params = NULL;
68 PKIX_ComCertSelParams *paramsDuplicate = NULL;
69
70 PKIX_ENTER(COMCERTSELPARAMS, "pkix_ComCertSelParams_Duplicate");
71 PKIX_NULLCHECK_TWO(object, pNewObject);
72
73 PKIX_CHECK(pkix_CheckType
74 (object, PKIX_COMCERTSELPARAMS_TYPE, plContext),
75 PKIX_OBJECTNOTCOMCERTSELPARAMS);
76
77 params = (PKIX_ComCertSelParams *)object;
78
79 PKIX_CHECK(PKIX_ComCertSelParams_Create(&paramsDuplicate, plContext),
80 PKIX_COMCERTSELPARAMSCREATEFAILED);
81
82 paramsDuplicate->minPathLength = params->minPathLength;
83 paramsDuplicate->matchAllSubjAltNames = params->matchAllSubjAltNames;
84
85 PKIX_DUPLICATE(params->subject, &paramsDuplicate->subject, plContext,
86 PKIX_OBJECTDUPLICATEFAILED);
87
88 PKIX_DUPLICATE(params->policies, &paramsDuplicate->policies, plContext,
89 PKIX_OBJECTDUPLICATEFAILED);
90
91 if (params->cert){
92 PKIX_CHECK(PKIX_PL_Object_Duplicate
93 ((PKIX_PL_Object *)params->cert,
94 (PKIX_PL_Object **)&paramsDuplicate->cert,
95 plContext),
96 PKIX_OBJECTDUPLICATEFAILED);
97 }
98
99 PKIX_DUPLICATE
100 (params->nameConstraints,
101 &paramsDuplicate->nameConstraints,
102 plContext,
103 PKIX_OBJECTDUPLICATEFAILED);
104
105 PKIX_DUPLICATE
106 (params->pathToNames,
107 &paramsDuplicate->pathToNames,
108 plContext,
109 PKIX_OBJECTDUPLICATEFAILED);
110
111 PKIX_DUPLICATE
112 (params->subjAltNames,
113 &paramsDuplicate->subjAltNames,
114 plContext,
115 PKIX_OBJECTDUPLICATEFAILED);
116
117 if (params->date){
118 PKIX_CHECK(PKIX_PL_Object_Duplicate
119 ((PKIX_PL_Object *)params->date,
120 (PKIX_PL_Object **)&paramsDuplicate->date,
121 plContext),
122 PKIX_OBJECTDUPLICATEFAILED);
123 }
124
125 paramsDuplicate->keyUsage = params->keyUsage;
126
127 PKIX_DUPLICATE(params->certValid,
128 &paramsDuplicate->certValid,
129 plContext,
130 PKIX_OBJECTDUPLICATEFAILED);
131
132 PKIX_DUPLICATE(params->issuer,
133 &paramsDuplicate->issuer,
134 plContext,
135 PKIX_OBJECTDUPLICATEFAILED);
136
137 PKIX_DUPLICATE(params->serialNumber,
138 &paramsDuplicate->serialNumber,
139 plContext,
140 PKIX_OBJECTDUPLICATEFAILED);
141
142 PKIX_DUPLICATE(params->authKeyId,
143 &paramsDuplicate->authKeyId,
144 plContext,
145 PKIX_OBJECTDUPLICATEFAILED);
146
147 PKIX_DUPLICATE(params->subjKeyId,
148 &paramsDuplicate->subjKeyId,
149 plContext,
150 PKIX_OBJECTDUPLICATEFAILED);
151
152 PKIX_DUPLICATE(params->subjPubKey,
153 &paramsDuplicate->subjPubKey,
154 plContext,
155 PKIX_OBJECTDUPLICATEFAILED);
156
157 PKIX_DUPLICATE(params->subjPKAlgId,
158 &paramsDuplicate->subjPKAlgId,
159 plContext,
160 PKIX_OBJECTDUPLICATEFAILED);
161
162 paramsDuplicate->leafCertFlag = params->leafCertFlag;
163
164 *pNewObject = (PKIX_PL_Object *)paramsDuplicate;
165
166 cleanup:
167
168 if (PKIX_ERROR_RECEIVED){
169 PKIX_DECREF(paramsDuplicate);
170 }
171
172 PKIX_RETURN(COMCERTSELPARAMS);
173 }
174
175 /*
176 * FUNCTION: pkix_ComCertSelParams_RegisterSelf
177 * DESCRIPTION:
178 * Registers PKIX_COMCERTSELPARAMS_TYPE and its related functions with
179 * systemClasses[]
180 * THREAD SAFETY:
181 * Not Thread Safe - for performance and complexity reasons
182 *
183 * Since this function is only called by PKIX_PL_Initialize, which should
184 * only be called once, it is acceptable that this function is not
185 * thread-safe.
186 */
187 PKIX_Error *
188 pkix_ComCertSelParams_RegisterSelf(void *plContext)
189 {
190 extern pkix_ClassTable_Entry systemClasses[PKIX_NUMTYPES];
191 pkix_ClassTable_Entry* entry = &systemClasses[PKIX_COMCERTSELPARAMS_TYPE];
192
193 PKIX_ENTER(COMCERTSELPARAMS, "pkix_ComCertSelParams_RegisterSelf");
194
195 entry->description = "ComCertSelParams";
196 entry->typeObjectSize = sizeof(PKIX_ComCertSelParams);
197 entry->destructor = pkix_ComCertSelParams_Destroy;
198 entry->duplicateFunction = pkix_ComCertSelParams_Duplicate;
199
200 PKIX_RETURN(COMCERTSELPARAMS);
201 }
202
203 /* --Public-Functions--------------------------------------------- */
204
205
206 /*
207 * FUNCTION: PKIX_ComCertSelParams_Create (see comments in pkix_certsel.h)
208 */
209 PKIX_Error *
210 PKIX_ComCertSelParams_Create(
211 PKIX_ComCertSelParams **pParams,
212 void *plContext)
213 {
214 PKIX_ComCertSelParams *params = NULL;
215
216 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_Create");
217 PKIX_NULLCHECK_ONE(pParams);
218
219 PKIX_CHECK(PKIX_PL_Object_Alloc
220 (PKIX_COMCERTSELPARAMS_TYPE,
221 sizeof (PKIX_ComCertSelParams),
222 (PKIX_PL_Object **)&params,
223 plContext),
224 PKIX_COULDNOTCREATECOMMONCERTSELPARAMSOBJECT);
225
226 /* initialize fields */
227 params->version = 0xFFFFFFFF;
228 params->minPathLength = -1;
229 params->matchAllSubjAltNames = PKIX_TRUE;
230 params->subject = NULL;
231 params->policies = NULL;
232 params->cert = NULL;
233 params->nameConstraints = NULL;
234 params->pathToNames = NULL;
235 params->subjAltNames = NULL;
236 params->extKeyUsage = NULL;
237 params->keyUsage = 0;
238 params->extKeyUsage = NULL;
239 params->keyUsage = 0;
240 params->date = NULL;
241 params->certValid = NULL;
242 params->issuer = NULL;
243 params->serialNumber = NULL;
244 params->authKeyId = NULL;
245 params->subjKeyId = NULL;
246 params->subjPubKey = NULL;
247 params->subjPKAlgId = NULL;
248 params->leafCertFlag = PKIX_FALSE;
249
250 *pParams = params;
251
252 cleanup:
253
254 PKIX_RETURN(COMCERTSELPARAMS);
255
256 }
257
258 /*
259 * FUNCTION: PKIX_ComCertSelParams_GetSubject (see comments in pkix_certsel.h)
260 */
261 PKIX_Error *
262 PKIX_ComCertSelParams_GetSubject(
263 PKIX_ComCertSelParams *params,
264 PKIX_PL_X500Name **pSubject,
265 void *plContext)
266 {
267 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetSubject");
268 PKIX_NULLCHECK_TWO(params, pSubject);
269
270 PKIX_INCREF(params->subject);
271
272 *pSubject = params->subject;
273
274 cleanup:
275 PKIX_RETURN(COMCERTSELPARAMS);
276 }
277
278 /*
279 * FUNCTION: PKIX_ComCertSelParams_SetSubject (see comments in pkix_certsel.h)
280 */
281 PKIX_Error *
282 PKIX_ComCertSelParams_SetSubject(
283 PKIX_ComCertSelParams *params,
284 PKIX_PL_X500Name *subject,
285 void *plContext)
286 {
287 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetSubject");
288 PKIX_NULLCHECK_ONE(params);
289
290 PKIX_DECREF(params->subject);
291
292 PKIX_INCREF(subject);
293
294 params->subject = subject;
295
296 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
297 ((PKIX_PL_Object *)params, plContext),
298 PKIX_OBJECTINVALIDATECACHEFAILED);
299
300 cleanup:
301
302 PKIX_RETURN(COMCERTSELPARAMS);
303 }
304
305
306 /*
307 * FUNCTION: PKIX_ComCertSelParams_GetBasicConstraints
308 * (see comments in pkix_certsel.h)
309 */
310 PKIX_Error *
311 PKIX_ComCertSelParams_GetBasicConstraints(
312 PKIX_ComCertSelParams *params,
313 PKIX_Int32 *pMinPathLength,
314 void *plContext)
315 {
316 PKIX_ENTER(COMCERTSELPARAMS,
317 "PKIX_ComCertSelParams_GetBasicConstraints");
318 PKIX_NULLCHECK_TWO(params, pMinPathLength);
319
320 *pMinPathLength = params->minPathLength;
321
322 PKIX_RETURN(COMCERTSELPARAMS);
323 }
324
325
326 /*
327 * FUNCTION: PKIX_ComCertSelParams_SetBasicConstraints
328 * (see comments in pkix_certsel.h)
329 */
330 PKIX_Error *
331 PKIX_ComCertSelParams_SetBasicConstraints(
332 PKIX_ComCertSelParams *params,
333 PKIX_Int32 minPathLength,
334 void *plContext)
335 {
336 PKIX_ENTER(COMCERTSELPARAMS,
337 "PKIX_ComCertSelParams_SetBasicConstraints");
338 PKIX_NULLCHECK_ONE(params);
339
340 params->minPathLength = minPathLength;
341
342 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
343 ((PKIX_PL_Object *)params, plContext),
344 PKIX_OBJECTINVALIDATECACHEFAILED);
345
346 cleanup:
347
348 PKIX_RETURN(COMCERTSELPARAMS);
349 }
350
351
352 /*
353 * FUNCTION: PKIX_ComCertSelParams_GetPolicy (see comments in pkix_certsel.h)
354 */
355 PKIX_Error *
356 PKIX_ComCertSelParams_GetPolicy(
357 PKIX_ComCertSelParams *params,
358 PKIX_List **pPolicy, /* List of PKIX_PL_OID */
359 void *plContext)
360 {
361 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetPolicy");
362 PKIX_NULLCHECK_TWO(params, pPolicy);
363
364 PKIX_INCREF(params->policies);
365 *pPolicy = params->policies;
366
367 cleanup:
368 PKIX_RETURN(COMCERTSELPARAMS);
369 }
370
371 /*
372 * FUNCTION: PKIX_ComCertSelParams_SetPolicy (see comments in pkix_certsel.h)
373 */
374 PKIX_Error *
375 PKIX_ComCertSelParams_SetPolicy(
376 PKIX_ComCertSelParams *params,
377 PKIX_List *policy, /* List of PKIX_PL_OID */
378 void *plContext)
379 {
380 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetPolicy");
381 PKIX_NULLCHECK_ONE(params);
382
383 PKIX_DECREF(params->policies);
384 PKIX_INCREF(policy);
385 params->policies = policy;
386
387 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
388 ((PKIX_PL_Object *)params, plContext),
389 PKIX_OBJECTINVALIDATECACHEFAILED);
390 cleanup:
391
392 PKIX_RETURN(COMCERTSELPARAMS);
393 }
394
395 /*
396 * FUNCTION: PKIX_ComCertSelParams_GetCertificate
397 * (see comments in pkix_certsel.h)
398 */
399 PKIX_Error *
400 PKIX_ComCertSelParams_GetCertificate(
401 PKIX_ComCertSelParams *params,
402 PKIX_PL_Cert **pCert,
403 void *plContext)
404 {
405 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetCertificate");
406 PKIX_NULLCHECK_TWO(params, pCert);
407
408 PKIX_INCREF(params->cert);
409 *pCert = params->cert;
410
411 cleanup:
412 PKIX_RETURN(COMCERTSELPARAMS);
413 }
414
415 /*
416 * FUNCTION: PKIX_ComCertSelParams_SetCertificate
417 * (see comments in pkix_certsel.h)
418 */
419 PKIX_Error *
420 PKIX_ComCertSelParams_SetCertificate(
421 PKIX_ComCertSelParams *params,
422 PKIX_PL_Cert *cert,
423 void *plContext)
424 {
425 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetCertificate");
426 PKIX_NULLCHECK_ONE(params);
427
428 PKIX_DECREF(params->cert);
429 PKIX_INCREF(cert);
430 params->cert = cert;
431
432 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
433 ((PKIX_PL_Object *)params, plContext),
434 PKIX_OBJECTINVALIDATECACHEFAILED);
435 cleanup:
436
437 PKIX_RETURN(COMCERTSELPARAMS);
438 }
439
440 /*
441 * FUNCTION: PKIX_ComCertSelParams_GetCertificateValid
442 * (see comments in pkix_certsel.h)
443 */
444 PKIX_Error *
445 PKIX_ComCertSelParams_GetCertificateValid(
446 PKIX_ComCertSelParams *params,
447 PKIX_PL_Date **pDate,
448 void *plContext)
449 {
450 PKIX_ENTER(COMCERTSELPARAMS,
451 "PKIX_ComCertSelParams_GetCertificateValid");
452
453 PKIX_NULLCHECK_TWO(params, pDate);
454
455 PKIX_INCREF(params->date);
456 *pDate = params->date;
457
458 cleanup:
459 PKIX_RETURN(COMCERTSELPARAMS);
460 }
461
462 /*
463 * FUNCTION: PKIX_ComCertSelParams_SetCertificateValid
464 * (see comments in pkix_certsel.h)
465 */
466 PKIX_Error *
467 PKIX_ComCertSelParams_SetCertificateValid(
468 PKIX_ComCertSelParams *params,
469 PKIX_PL_Date *date,
470 void *plContext)
471 {
472 PKIX_ENTER(COMCERTSELPARAMS,
473 "PKIX_ComCertSelParams_SetCertificateValid");
474 PKIX_NULLCHECK_ONE(params);
475
476 PKIX_DECREF(params->date);
477 PKIX_INCREF(date);
478 params->date = date;
479
480 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
481 ((PKIX_PL_Object *)params, plContext),
482 PKIX_OBJECTINVALIDATECACHEFAILED);
483 cleanup:
484
485 PKIX_RETURN(COMCERTSELPARAMS);
486 }
487
488 /*
489 * FUNCTION: PKIX_ComCertSelParams_GetNameConstraints
490 * (see comments in pkix_certsel.h)
491 */
492 PKIX_Error *
493 PKIX_ComCertSelParams_GetNameConstraints(
494 PKIX_ComCertSelParams *params,
495 PKIX_PL_CertNameConstraints **pNameConstraints,
496 void *plContext)
497 {
498 PKIX_ENTER(COMCERTSELPARAMS,
499 "PKIX_ComCertSelParams_GetNameConstraints");
500 PKIX_NULLCHECK_TWO(params, pNameConstraints);
501
502 PKIX_INCREF(params->nameConstraints);
503
504 *pNameConstraints = params->nameConstraints;
505
506 cleanup:
507 PKIX_RETURN(COMCERTSELPARAMS);
508 }
509
510 /*
511 * FUNCTION: PKIX_ComCertSelParams_SetNameConstraints
512 * (see comments in pkix_certsel.h)
513 */
514 PKIX_Error *
515 PKIX_ComCertSelParams_SetNameConstraints(
516 PKIX_ComCertSelParams *params,
517 PKIX_PL_CertNameConstraints *nameConstraints,
518 void *plContext)
519 {
520 PKIX_ENTER(COMCERTSELPARAMS,
521 "PKIX_ComCertSelParams_SetNameConstraints");
522 PKIX_NULLCHECK_ONE(params);
523
524 PKIX_DECREF(params->nameConstraints);
525 PKIX_INCREF(nameConstraints);
526 params->nameConstraints = nameConstraints;
527
528 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
529 ((PKIX_PL_Object *)params, plContext),
530 PKIX_OBJECTINVALIDATECACHEFAILED);
531
532 cleanup:
533
534 PKIX_RETURN(COMCERTSELPARAMS);
535 }
536
537 /*
538 * FUNCTION: PKIX_ComCertSelParams_GetPathToNames
539 * (see comments in pkix_certsel.h)
540 */PKIX_Error *
541 PKIX_ComCertSelParams_GetPathToNames(
542 PKIX_ComCertSelParams *params,
543 PKIX_List **pNames, /* list of PKIX_PL_GeneralName */
544 void *plContext)
545 {
546 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetPathToNames");
547 PKIX_NULLCHECK_TWO(params, pNames);
548
549 PKIX_INCREF(params->pathToNames);
550
551 *pNames = params->pathToNames;
552
553 cleanup:
554 PKIX_RETURN(COMCERTSELPARAMS);
555 }
556
557 /*
558 * FUNCTION: PKIX_ComCertSelParams_SetPathToNames
559 * (see comments in pkix_certsel.h)
560 */
561 PKIX_Error *
562 PKIX_ComCertSelParams_SetPathToNames(
563 PKIX_ComCertSelParams *params,
564 PKIX_List *names, /* list of PKIX_PL_GeneralName */
565 void *plContext)
566 {
567 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetPathToNames");
568 PKIX_NULLCHECK_ONE(params);
569
570 PKIX_DECREF(params->pathToNames);
571 PKIX_INCREF(names);
572
573 params->pathToNames = names;
574
575 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
576 ((PKIX_PL_Object *)params, plContext),
577 PKIX_OBJECTINVALIDATECACHEFAILED);
578
579 cleanup:
580
581 PKIX_RETURN(COMCERTSELPARAMS);
582 }
583
584 /*
585 * FUNCTION: PKIX_ComCertSelParams_AddPathToName
586 * (see comments in pkix_certsel.h)
587 */
588 PKIX_Error *
589 PKIX_ComCertSelParams_AddPathToName(
590 PKIX_ComCertSelParams *params,
591 PKIX_PL_GeneralName *name,
592 void *plContext)
593 {
594 PKIX_List *pathToNamesList = NULL;
595
596 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_AddPathToName");
597 PKIX_NULLCHECK_ONE(params);
598
599 if (name == NULL) {
600 goto cleanup;
601 }
602
603 if (params->pathToNames == NULL) {
604 /* Create a list for name item */
605 PKIX_CHECK(PKIX_List_Create(&pathToNamesList, plContext),
606 PKIX_LISTCREATEFAILED);
607
608 params->pathToNames = pathToNamesList;
609 }
610
611 PKIX_CHECK(PKIX_List_AppendItem
612 (params->pathToNames, (PKIX_PL_Object *)name, plContext),
613 PKIX_LISTAPPENDITEMFAILED);
614
615 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
616 ((PKIX_PL_Object *)params, plContext),
617 PKIX_OBJECTINVALIDATECACHEFAILED);
618
619 cleanup:
620
621 PKIX_RETURN(COMCERTSELPARAMS);
622 }
623
624 /*
625 * FUNCTION: PKIX_ComCertSelParams_GetSubjAltNames
626 * (see comments in pkix_certsel.h)
627 */
628 PKIX_Error *
629 PKIX_ComCertSelParams_GetSubjAltNames(
630 PKIX_ComCertSelParams *params,
631 PKIX_List **pNames, /* list of PKIX_PL_GeneralName */
632 void *plContext)
633 {
634 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetSubjAltNames");
635 PKIX_NULLCHECK_TWO(params, pNames);
636
637 PKIX_INCREF(params->subjAltNames);
638
639 *pNames = params->subjAltNames;
640
641 cleanup:
642 PKIX_RETURN(COMCERTSELPARAMS);
643 }
644
645 /*
646 * FUNCTION: PKIX_ComCertSelParams_SetSubjAltNames
647 * (see comments in pkix_certsel.h)
648 */
649 PKIX_Error *
650 PKIX_ComCertSelParams_SetSubjAltNames(
651 PKIX_ComCertSelParams *params,
652 PKIX_List *names, /* list of PKIX_PL_GeneralName */
653 void *plContext)
654 {
655 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetSubjAltNames");
656 PKIX_NULLCHECK_TWO(params, names);
657
658 PKIX_DECREF(params->subjAltNames);
659 PKIX_INCREF(names);
660
661 params->subjAltNames = names;
662
663 cleanup:
664 PKIX_RETURN(COMCERTSELPARAMS);
665 }
666
667 /*
668 * FUNCTION: PKIX_ComCertSelParams_AddSubjAltNames
669 * (see comments in pkix_certsel.h)
670 */
671 PKIX_Error *
672 PKIX_ComCertSelParams_AddSubjAltName(
673 PKIX_ComCertSelParams *params,
674 PKIX_PL_GeneralName *name,
675 void *plContext)
676 {
677 PKIX_List *list = NULL;
678
679 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_AddSubjAltName");
680 PKIX_NULLCHECK_TWO(params, name);
681
682 if (params->subjAltNames == NULL) {
683 PKIX_CHECK(PKIX_List_Create(&list, plContext),
684 PKIX_LISTCREATEFAILED);
685 params->subjAltNames = list;
686 }
687
688 PKIX_CHECK(PKIX_List_AppendItem
689 (params->subjAltNames, (PKIX_PL_Object *)name, plContext),
690 PKIX_LISTAPPENDITEMFAILED);
691
692 cleanup:
693
694 PKIX_RETURN(COMCERTSELPARAMS)
695 }
696
697 /*
698 * FUNCTION: PKIX_ComCertSelParams_GetMatchAllSubjAltNames
699 * (see comments in pkix_certsel.h)
700 */
701 PKIX_Error *
702 PKIX_ComCertSelParams_GetMatchAllSubjAltNames(
703 PKIX_ComCertSelParams *params,
704 PKIX_Boolean *pMatch,
705 void *plContext)
706 {
707 PKIX_ENTER(COMCERTSELPARAMS,
708 "PKIX_ComCertSelParams_GetMatchAllSubjAltNames");
709 PKIX_NULLCHECK_TWO(params, pMatch);
710
711 *pMatch = params->matchAllSubjAltNames;
712
713 PKIX_RETURN(COMCERTSELPARAMS);
714 }
715
716 /*
717 * FUNCTION: PKIX_ComCertSelParams_SetMatchAllSubjAltNames
718 * (see comments in pkix_certsel.h)
719 */
720 PKIX_Error *
721 PKIX_ComCertSelParams_SetMatchAllSubjAltNames(
722 PKIX_ComCertSelParams *params,
723 PKIX_Boolean match,
724 void *plContext)
725 {
726 PKIX_ENTER(COMCERTSELPARAMS,
727 "PKIX_ComCertSelParams_SetMatchAllSubjAltNames");
728 PKIX_NULLCHECK_ONE(params);
729
730 params->matchAllSubjAltNames = match;
731
732 PKIX_RETURN(COMCERTSELPARAMS);
733 }
734
735 /*
736 * FUNCTION: PKIX_ComCertSelParams_GetExtendedKeyUsage
737 * (see comments in pkix_certsel.h)
738 */
739 PKIX_Error *
740 PKIX_ComCertSelParams_GetExtendedKeyUsage(
741 PKIX_ComCertSelParams *params,
742 PKIX_List **pExtKeyUsage, /* list of PKIX_PL_OID */
743 void *plContext)
744 {
745 PKIX_ENTER(COMCERTSELPARAMS,
746 "PKIX_ComCertSelParams_GetExtendedKeyUsage");
747 PKIX_NULLCHECK_TWO(params, pExtKeyUsage);
748
749 PKIX_INCREF(params->extKeyUsage);
750 *pExtKeyUsage = params->extKeyUsage;
751
752 cleanup:
753 PKIX_RETURN(COMCERTSELPARAMS);
754 }
755
756 /*
757 * FUNCTION: PKIX_ComCertSelParams_SetExtendedKeyUsage
758 * (see comments in pkix_certsel.h)
759 */
760 PKIX_Error *
761 PKIX_ComCertSelParams_SetExtendedKeyUsage(
762 PKIX_ComCertSelParams *params,
763 PKIX_List *extKeyUsage, /* list of PKIX_PL_OID */
764 void *plContext)
765 {
766 PKIX_ENTER(COMCERTSELPARAMS,
767 "PKIX_ComCertSelParams_SetExtendedKeyUsage");
768 PKIX_NULLCHECK_ONE(params);
769
770 PKIX_DECREF(params->extKeyUsage);
771 PKIX_INCREF(extKeyUsage);
772
773 params->extKeyUsage = extKeyUsage;
774
775 cleanup:
776 PKIX_RETURN(COMCERTSELPARAMS);
777 }
778
779 /*
780 * FUNCTION: PKIX_ComCertSelParams_GetKeyUsage
781 * (see comments in pkix_certsel.h)
782 */
783 PKIX_Error *
784 PKIX_ComCertSelParams_GetKeyUsage(
785 PKIX_ComCertSelParams *params,
786 PKIX_UInt32 *pKeyUsage,
787 void *plContext)
788 {
789 PKIX_ENTER(COMCERTSELPARAMS,
790 "PKIX_ComCertSelParams_GetKeyUsage");
791 PKIX_NULLCHECK_TWO(params, pKeyUsage);
792
793 *pKeyUsage = params->keyUsage;
794
795 PKIX_RETURN(COMCERTSELPARAMS);
796 }
797
798 /*
799 * FUNCTION: PKIX_ComCertSelParams_SetKeyUsage
800 * (see comments in pkix_certsel.h)
801 */
802 PKIX_Error *
803 PKIX_ComCertSelParams_SetKeyUsage(
804 PKIX_ComCertSelParams *params,
805 PKIX_UInt32 keyUsage,
806 void *plContext)
807 {
808 PKIX_ENTER(COMCERTSELPARAMS,
809 "PKIX_ComCertSelParams_SetKeyUsage");
810 PKIX_NULLCHECK_ONE(params);
811
812 params->keyUsage = keyUsage;
813
814 PKIX_RETURN(COMCERTSELPARAMS);
815 }
816
817 /*
818 * FUNCTION: PKIX_ComCertSelParams_GetIssuer
819 * (see comments in pkix_certsel.h)
820 */
821 PKIX_Error *
822 PKIX_ComCertSelParams_GetIssuer(
823 PKIX_ComCertSelParams *params,
824 PKIX_PL_X500Name **pIssuer,
825 void *plContext)
826 {
827 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetIssuer");
828 PKIX_NULLCHECK_TWO(params, pIssuer);
829
830 PKIX_INCREF(params->issuer);
831 *pIssuer = params->issuer;
832
833 cleanup:
834 PKIX_RETURN(COMCERTSELPARAMS);
835 }
836
837 /*
838 * FUNCTION: PKIX_ComCertSelParams_SetIssuer
839 * (see comments in pkix_certsel.h)
840 */
841 PKIX_Error *
842 PKIX_ComCertSelParams_SetIssuer(
843 PKIX_ComCertSelParams *params,
844 PKIX_PL_X500Name *issuer,
845 void *plContext)
846 {
847 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetIssuer");
848 PKIX_NULLCHECK_ONE(params);
849
850 PKIX_DECREF(params->issuer);
851 PKIX_INCREF(issuer);
852 params->issuer = issuer;
853
854 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
855 ((PKIX_PL_Object *)params, plContext),
856 PKIX_OBJECTINVALIDATECACHEFAILED);
857
858 cleanup:
859
860 PKIX_RETURN(COMCERTSELPARAMS);
861 }
862
863 /*
864 * FUNCTION: PKIX_ComCertSelParams_GetSerialNumber
865 * (see comments in pkix_certsel.h)
866 */
867 PKIX_Error *
868 PKIX_ComCertSelParams_GetSerialNumber(
869 PKIX_ComCertSelParams *params,
870 PKIX_PL_BigInt **pSerialNumber,
871 void *plContext)
872 {
873 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetSerialNumber");
874 PKIX_NULLCHECK_TWO(params, pSerialNumber);
875
876 PKIX_INCREF(params->serialNumber);
877 *pSerialNumber = params->serialNumber;
878
879 cleanup:
880 PKIX_RETURN(COMCERTSELPARAMS);
881 }
882
883 /*
884 * FUNCTION: PKIX_ComCertSelParams_SetSerialNumber
885 * (see comments in pkix_certsel.h)
886 */
887 PKIX_Error *
888 PKIX_ComCertSelParams_SetSerialNumber(
889 PKIX_ComCertSelParams *params,
890 PKIX_PL_BigInt *serialNumber,
891 void *plContext)
892 {
893 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetSerialNumber");
894 PKIX_NULLCHECK_ONE(params);
895
896 PKIX_DECREF(params->serialNumber);
897 PKIX_INCREF(serialNumber);
898 params->serialNumber = serialNumber;
899
900 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
901 ((PKIX_PL_Object *)params, plContext),
902 PKIX_OBJECTINVALIDATECACHEFAILED);
903
904 cleanup:
905
906 PKIX_RETURN(COMCERTSELPARAMS);
907 }
908
909 /*
910 * FUNCTION: PKIX_ComCertSelParams_GetVersion
911 * (see comments in pkix_certsel.h)
912 */
913 PKIX_Error *
914 PKIX_ComCertSelParams_GetVersion(
915 PKIX_ComCertSelParams *params,
916 PKIX_UInt32 *pVersion,
917 void *plContext)
918 {
919 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetVersion");
920 PKIX_NULLCHECK_TWO(params, pVersion);
921
922 *pVersion = params->version;
923
924 PKIX_RETURN(COMCERTSELPARAMS);
925 }
926
927 /*
928 * FUNCTION: PKIX_ComCertSelParams_SetVersion
929 * (see comments in pkix_certsel.h)
930 */
931 PKIX_Error *
932 PKIX_ComCertSelParams_SetVersion(
933 PKIX_ComCertSelParams *params,
934 PKIX_Int32 version,
935 void *plContext)
936 {
937 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetVersion");
938 PKIX_NULLCHECK_ONE(params);
939
940 params->version = version;
941
942 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
943 ((PKIX_PL_Object *)params, plContext),
944 PKIX_OBJECTINVALIDATECACHEFAILED);
945
946 cleanup:
947
948 PKIX_RETURN(COMCERTSELPARAMS);
949 }
950
951 /*
952 * FUNCTION: PKIX_ComCertSelParams_GetSubjKeyIdentifier
953 * (see comments in pkix_certsel.h)
954 */
955 PKIX_Error *
956 PKIX_ComCertSelParams_GetSubjKeyIdentifier(
957 PKIX_ComCertSelParams *params,
958 PKIX_PL_ByteArray **pSubjKeyId,
959 void *plContext)
960 {
961 PKIX_ENTER(COMCERTSELPARAMS,
962 "PKIX_ComCertSelParams_GetSubjKeyIdentifier");
963 PKIX_NULLCHECK_TWO(params, pSubjKeyId);
964
965 PKIX_INCREF(params->subjKeyId);
966
967 *pSubjKeyId = params->subjKeyId;
968
969 cleanup:
970 PKIX_RETURN(COMCERTSELPARAMS);
971 }
972
973 /*
974 * FUNCTION: PKIX_ComCertSelParams_SetSubjKeyIdentifier
975 * (see comments in pkix_certsel.h)
976 */
977 PKIX_Error *
978 PKIX_ComCertSelParams_SetSubjKeyIdentifier(
979 PKIX_ComCertSelParams *params,
980 PKIX_PL_ByteArray *subjKeyId,
981 void *plContext)
982 {
983 PKIX_ENTER(COMCERTSELPARAMS,
984 "PKIX_ComCertSelParams_SetSubjKeyIdentifier");
985 PKIX_NULLCHECK_ONE(params);
986
987 PKIX_DECREF(params->subjKeyId);
988 PKIX_INCREF(subjKeyId);
989
990 params->subjKeyId = subjKeyId;
991
992 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
993 ((PKIX_PL_Object *)params, plContext),
994 PKIX_OBJECTINVALIDATECACHEFAILED);
995
996 cleanup:
997
998 PKIX_RETURN(COMCERTSELPARAMS);
999 }
1000
1001 /*
1002 * FUNCTION: PKIX_ComCertSelParams_GetAuthorityKeyIdentifier
1003 * (see comments in pkix_certsel.h)
1004 */
1005 PKIX_Error *
1006 PKIX_ComCertSelParams_GetAuthorityKeyIdentifier(
1007 PKIX_ComCertSelParams *params,
1008 PKIX_PL_ByteArray **pAuthKeyId,
1009 void *plContext)
1010 {
1011 PKIX_ENTER(COMCERTSELPARAMS,
1012 "PKIX_ComCertSelParams_GetAuthorityKeyIdentifier");
1013 PKIX_NULLCHECK_TWO(params, pAuthKeyId);
1014
1015 PKIX_INCREF(params->authKeyId);
1016
1017 *pAuthKeyId = params->authKeyId;
1018
1019 cleanup:
1020 PKIX_RETURN(COMCERTSELPARAMS);
1021 }
1022
1023 /*
1024 * FUNCTION: PKIX_ComCertSelParams_SetAuthorityKeyIdentifier
1025 * (see comments in pkix_certsel.h)
1026 */
1027 PKIX_Error *
1028 PKIX_ComCertSelParams_SetAuthorityKeyIdentifier(
1029 PKIX_ComCertSelParams *params,
1030 PKIX_PL_ByteArray *authKeyId,
1031 void *plContext)
1032 {
1033 PKIX_ENTER(COMCERTSELPARAMS,
1034 "PKIX_ComCertSelParams_SetAuthKeyIdentifier");
1035 PKIX_NULLCHECK_ONE(params);
1036
1037 PKIX_DECREF(params->authKeyId);
1038 PKIX_INCREF(authKeyId);
1039
1040 params->authKeyId = authKeyId;
1041
1042 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
1043 ((PKIX_PL_Object *)params, plContext),
1044 PKIX_OBJECTINVALIDATECACHEFAILED);
1045
1046 cleanup:
1047
1048 PKIX_RETURN(COMCERTSELPARAMS);
1049 }
1050
1051 /*
1052 * FUNCTION: PKIX_ComCertSelParams_GetSubjPubKey
1053 * (see comments in pkix_certsel.h)
1054 */
1055 PKIX_Error *
1056 PKIX_ComCertSelParams_GetSubjPubKey(
1057 PKIX_ComCertSelParams *params,
1058 PKIX_PL_PublicKey **pSubjPubKey,
1059 void *plContext)
1060 {
1061 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetSubjPubKey");
1062 PKIX_NULLCHECK_TWO(params, pSubjPubKey);
1063
1064 PKIX_INCREF(params->subjPubKey);
1065
1066 *pSubjPubKey = params->subjPubKey;
1067
1068 cleanup:
1069 PKIX_RETURN(COMCERTSELPARAMS);
1070 }
1071
1072 /*
1073 * FUNCTION: PKIX_ComCertSelParams_SetSubjPubKey
1074 * (see comments in pkix_certsel.h)
1075 */
1076 PKIX_Error *
1077 PKIX_ComCertSelParams_SetSubjPubKey(
1078 PKIX_ComCertSelParams *params,
1079 PKIX_PL_PublicKey *subjPubKey,
1080 void *plContext)
1081 {
1082 PKIX_ENTER(COMCERTSELPARAMS,
1083 "PKIX_ComCertSelParams_SetSubjPubKey");
1084 PKIX_NULLCHECK_ONE(params);
1085
1086 PKIX_DECREF(params->subjPubKey);
1087 PKIX_INCREF(subjPubKey);
1088
1089 params->subjPubKey = subjPubKey;
1090
1091 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
1092 ((PKIX_PL_Object *)params, plContext),
1093 PKIX_OBJECTINVALIDATECACHEFAILED);
1094
1095 cleanup:
1096
1097 PKIX_RETURN(COMCERTSELPARAMS);
1098 }
1099
1100 /*
1101 * FUNCTION: PKIX_ComCertSelParams_GetSubjPKAlgId
1102 * (see comments in pkix_certsel.h)
1103 */
1104 PKIX_Error *
1105 PKIX_ComCertSelParams_GetSubjPKAlgId(
1106 PKIX_ComCertSelParams *params,
1107 PKIX_PL_OID **pAlgId,
1108 void *plContext)
1109 {
1110 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetSubjPKAlgId");
1111 PKIX_NULLCHECK_TWO(params, pAlgId);
1112
1113 PKIX_INCREF(params->subjPKAlgId);
1114
1115 *pAlgId = params->subjPKAlgId;
1116
1117 cleanup:
1118 PKIX_RETURN(COMCERTSELPARAMS);
1119 }
1120
1121 /*
1122 * FUNCTION: PKIX_ComCertSelParams_SetSubjPKAlgId
1123 * (see comments in pkix_certsel.h)
1124 */
1125 PKIX_Error *
1126 PKIX_ComCertSelParams_SetSubjPKAlgId(
1127 PKIX_ComCertSelParams *params,
1128 PKIX_PL_OID *algId,
1129 void *plContext)
1130 {
1131 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetSubjPKAlgId");
1132 PKIX_NULLCHECK_ONE(params);
1133
1134 PKIX_DECREF(params->subjPKAlgId);
1135 PKIX_INCREF(algId);
1136
1137 params->subjPKAlgId = algId;
1138
1139 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
1140 ((PKIX_PL_Object *)params, plContext),
1141 PKIX_OBJECTINVALIDATECACHEFAILED);
1142
1143 cleanup:
1144
1145 PKIX_RETURN(COMCERTSELPARAMS);
1146 }
1147
1148 /*
1149 * FUNCTION: PKIX_ComCertSelParams_GetLeafCertFlag
1150 * (see comments in pkix_certsel.h)
1151 */
1152 PKIX_Error*
1153 PKIX_ComCertSelParams_GetLeafCertFlag(
1154 PKIX_ComCertSelParams *params,
1155 PKIX_Boolean *pLeafFlag,
1156 void *plContext)
1157 {
1158 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_GetLeafCertFlag");
1159 PKIX_NULLCHECK_TWO(params, pLeafFlag);
1160
1161 *pLeafFlag = params->leafCertFlag;
1162
1163 PKIX_RETURN(COMCERTSELPARAMS);
1164 }
1165
1166 /*
1167 * FUNCTION: PKIX_ComCertSelParams_SetLeafCertFlag
1168 * (see comments in pkix_certsel.h)
1169 */
1170 PKIX_Error *
1171 PKIX_ComCertSelParams_SetLeafCertFlag(
1172 PKIX_ComCertSelParams *params,
1173 PKIX_Boolean leafFlag,
1174 void *plContext)
1175 {
1176 PKIX_ENTER(COMCERTSELPARAMS, "PKIX_ComCertSelParams_SetLeafCertFlag");
1177 PKIX_NULLCHECK_ONE(params);
1178
1179 params->leafCertFlag = leafFlag;
1180
1181 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
1182 ((PKIX_PL_Object *)params, plContext),
1183 PKIX_OBJECTINVALIDATECACHEFAILED);
1184
1185 cleanup:
1186
1187 PKIX_RETURN(COMCERTSELPARAMS);
1188 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)