|
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 #ifndef _GENAME_H_ |
|
6 #define _GENAME_H_ |
|
7 |
|
8 #include "plarena.h" |
|
9 #include "seccomon.h" |
|
10 #include "secoidt.h" |
|
11 #include "secasn1.h" |
|
12 #include "secder.h" |
|
13 #include "certt.h" |
|
14 |
|
15 /************************************************************************/ |
|
16 SEC_BEGIN_PROTOS |
|
17 |
|
18 extern const SEC_ASN1Template CERT_GeneralNamesTemplate[]; |
|
19 |
|
20 extern SECItem ** |
|
21 cert_EncodeGeneralNames(PLArenaPool *arena, CERTGeneralName *names); |
|
22 |
|
23 extern CERTGeneralName * |
|
24 cert_DecodeGeneralNames(PLArenaPool *arena, SECItem **encodedGenName); |
|
25 |
|
26 extern SECStatus |
|
27 cert_DestroyGeneralNames(CERTGeneralName *name); |
|
28 |
|
29 extern CERTGeneralNameType |
|
30 CERT_GetGeneralNameTypeFromString(const char *string); |
|
31 |
|
32 extern SECStatus |
|
33 cert_EncodeNameConstraints(CERTNameConstraints *constraints, PLArenaPool *arena, |
|
34 SECItem *dest); |
|
35 |
|
36 extern CERTNameConstraints * |
|
37 cert_DecodeNameConstraints(PLArenaPool *arena, const SECItem *encodedConstraints); |
|
38 |
|
39 extern CERTGeneralName * |
|
40 cert_CombineNamesLists(CERTGeneralName *list1, CERTGeneralName *list2); |
|
41 |
|
42 extern CERTNameConstraint * |
|
43 cert_CombineConstraintsLists(CERTNameConstraint *list1, CERTNameConstraint *list2); |
|
44 |
|
45 /*********************************************************************/ |
|
46 /* A thread safe implementation of General Names */ |
|
47 /*********************************************************************/ |
|
48 |
|
49 /* Destroy a Single CERTGeneralName */ |
|
50 void |
|
51 CERT_DestroyGeneralName(CERTGeneralName *name); |
|
52 |
|
53 SECStatus |
|
54 CERT_CompareGeneralName(CERTGeneralName *a, CERTGeneralName *b); |
|
55 |
|
56 SECStatus |
|
57 CERT_CopyGeneralName(PLArenaPool *arena, |
|
58 CERTGeneralName *dest, |
|
59 CERTGeneralName *src); |
|
60 |
|
61 /* General Name Lists are a thread safe, reference counting layer to |
|
62 * general names */ |
|
63 |
|
64 /* Destroys a CERTGeneralNameList */ |
|
65 void |
|
66 CERT_DestroyGeneralNameList(CERTGeneralNameList *list); |
|
67 |
|
68 /* Creates a CERTGeneralNameList */ |
|
69 CERTGeneralNameList * |
|
70 CERT_CreateGeneralNameList(CERTGeneralName *name); |
|
71 |
|
72 /* Compares two CERTGeneralNameList */ |
|
73 SECStatus |
|
74 CERT_CompareGeneralNameLists(CERTGeneralNameList *a, CERTGeneralNameList *b); |
|
75 |
|
76 /* returns a copy of the first name of the type requested */ |
|
77 void * |
|
78 CERT_GetGeneralNameFromListByType(CERTGeneralNameList *list, |
|
79 CERTGeneralNameType type, |
|
80 PLArenaPool *arena); |
|
81 |
|
82 /* Adds a name to the tail of the list */ |
|
83 void |
|
84 CERT_AddGeneralNameToList(CERTGeneralNameList *list, |
|
85 CERTGeneralNameType type, |
|
86 void *data, SECItem *oid); |
|
87 |
|
88 /* returns a duplicate of the CERTGeneralNameList */ |
|
89 CERTGeneralNameList * |
|
90 CERT_DupGeneralNameList(CERTGeneralNameList *list); |
|
91 |
|
92 /* returns the number of CERTGeneralName objects in the doubly linked |
|
93 ** list of which *names is a member. |
|
94 */ |
|
95 extern int |
|
96 CERT_GetNamesLength(CERTGeneralName *names); |
|
97 |
|
98 /************************************************************************/ |
|
99 |
|
100 SECStatus |
|
101 CERT_CompareNameSpace(CERTCertificate *cert, |
|
102 CERTGeneralName *namesList, |
|
103 CERTCertificate **certsList, |
|
104 PLArenaPool *reqArena, |
|
105 CERTCertificate **pBadCert); |
|
106 |
|
107 SEC_END_PROTOS |
|
108 |
|
109 #endif |