2 * Copyright (c) 2003,2011,2014 Apple Inc. All Rights Reserved.
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
19 * clNameUtils.h - support for Name, GeneralizedName, all sorts of names
22 #ifndef _CL_NAME_UTILS_H_
23 #define _CL_NAME_UTILS_H_
25 #include <Security/cssmtype.h>
26 #include <security_utilities/alloc.h>
27 #include <Security/x509defs.h>
28 #include <Security/certextensions.h>
29 #include <Security/X509Templates.h>
30 #include <security_asn1/SecNssCoder.h>
33 const NSS_ATV
&nssObj
,
34 CSSM_X509_TYPE_VALUE_PAIR
&cssmObj
,
41 const NSS_RDN
&nssObj
,
42 CSSM_X509_RDN
&cssmObj
,
45 void CL_nssNameToCssm(
46 const NSS_Name
&nssObj
,
47 CSSM_X509_NAME
&cssmObj
,
51 const CSSM_X509_TYPE_VALUE_PAIR
&cssmObj
,
55 const CSSM_X509_RDN
&cssmObj
,
58 void CL_cssmNameToNss(
59 const CSSM_X509_NAME
&cssmObj
,
63 void CL_normalizeString(
65 int &strLen
); // IN/OUT
66 void CL_normalizeX509NameNSS(
70 void CL_nssGeneralNameToCssm(
71 NSS_GeneralName
&nssObj
,
72 CE_GeneralName
&cdsaObj
,
73 SecNssCoder
&coder
, // for temp decoding
74 Allocator
&alloc
); // destination
76 void CL_nssGeneralNamesToCssm(
77 const NSS_GeneralNames
&nssObj
,
78 CE_GeneralNames
&cdsaObj
,
79 SecNssCoder
&coder
, // for temp decoding
80 Allocator
&alloc
); // destination
81 void CL_cssmGeneralNameToNss(
82 CE_GeneralName
&cdsaObj
,
83 NSS_GeneralName
&nssObj
, // actually an NSSTaggedItem
84 SecNssCoder
&coder
); // for temp decoding
85 void CL_cssmGeneralNamesToNss(
86 const CE_GeneralNames
&cdsaObj
,
87 NSS_GeneralNames
&nssObj
,
91 const CE_OtherName
&src
,
95 void CL_freeAuthorityKeyId(
96 CE_AuthorityKeyID
&cdsaObj
,
98 void CL_freeCssmGeneralName(
99 CE_GeneralName
&genName
,
101 void CL_freeCssmGeneralNames(
102 CE_GeneralNames
*cdsaObj
,
104 void CL_freeCssmDistPointName(
105 CE_DistributionPointName
*cssmDpn
,
107 void CL_freeCssmDistPoints(
108 CE_CRLDistPointsSyntax
*cssmDps
,
110 void CL_freeX509Name(
111 CSSM_X509_NAME_PTR x509Name
,
114 CSSM_X509_RDN_PTR rdn
,
116 void CL_freeOtherName(
117 CE_OtherName
*cssmOther
,
119 void CL_freeCssmIssuingDistPoint(
120 CE_IssuingDistributionPoint
*cssmIdp
,
124 #endif /* _CL_NAME_UTILS_H_ */