2 * Copyright (c) 2000-2001 Apple Computer, 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.
22 Created 10/9/2000 by Doug Mitchell.
25 #ifndef _CERT_GROUP_UTILS_H
26 #define _CERT_GROUP_UTILS_H
28 #include <Security/x509defs.h>
29 #include <Security/cssmalloc.h>
30 #include "TPCertInfo.h"
32 * Cheetah version of TP doesn't work with DLs.
34 #define TP_DL_ENABLE 0
40 /* quick & dirty port from OS9 to OS X... */
41 #define tpFree(alloc, ptr) (alloc).free(ptr)
42 #define tpMalloc(alloc, size) (alloc).malloc(size)
43 #define tpCalloc(alloc, num, size) (alloc).calloc(num, size)
49 CSSM_DATA_PTR
tpMallocCopyCssmData(
51 const CSSM_DATA
*src
);
55 CSSM_BOOL freeStruct
);
56 CSSM_BOOL
tpCompareCssmData(
57 const CSSM_DATA
*data1
,
58 const CSSM_DATA
*data2
);
59 CSSM_BOOL
tpCompareOids(
61 const CSSM_OID
*oid2
);
63 CSSM_DATA_PTR
tp_CertGetPublicKey(
65 CSSM_DATA_PTR
*valueToFree
); // used in tp_CertFreePublicKey
66 void tp_CertFreePublicKey(
67 CSSM_CL_HANDLE clHand
,
70 CSSM_X509_ALGORITHM_IDENTIFIER_PTR
tp_CertGetAlgId(
72 CSSM_DATA_PTR
*valueToFree
); // used in tp_CertFreeAlgId
73 void tp_CertFreeAlgId(
74 CSSM_CL_HANDLE clHand
,
79 tp_GetCertFromDBList( CSSM_TP_HANDLE hTP
,
81 CSSM_SELECTION_PREDICATE_PTR pPredicate
,
82 uint32 NumberOfPredicates
,
83 const CSSM_DB_LIST_PTR pDBList
);
86 tp_GetCertFromDBListBySName( CSSM_TP_HANDLE hTP
,
88 const CSSM_DATA_PTR pSubjectName
,
89 const CSSM_DB_LIST_PTR pDBList
);
91 #endif /* TP_DL_ENABLE*/
93 CSSM_BOOL
tpIsSameName(
94 const CSSM_DATA
*pName1
,
95 const CSSM_DATA
*pName2
);
97 CSSM_RETURN
tp_VerifyCert(
98 CSSM_CL_HANDLE clHand
,
99 CSSM_CSP_HANDLE cspHand
,
100 TPCertInfo
*subjectCert
,
101 TPCertInfo
*issuerCert
,
102 CSSM_BOOL checkIssuerCurrent
,
103 CSSM_BOOL allowExpired
);
105 CSSM_BOOL
tp_CompareCerts(
106 const CSSM_DATA
*cert1
,
107 const CSSM_DATA
*cert2
);
111 * Search a list of DBs for a cert which verifies specified subject cert.
112 * Just a boolean return - we found it, or not.
114 CSSM_DATA_PTR
tpFindIssuer(
115 CSSM_TP_HANDLE tpHand
,
116 CSSM_CL_HANDLE clHand
,
117 CSSM_CSP_HANDLE cspHand
,
118 const CSSM_DATA_PTR subjectCert
,
119 const CSSM_DATA_PTR issuerName
, // passed for convenience
120 const CSSM_DB_LIST_PTR dbList
,
121 CSSM_BOOL
*subjectExpired
); // RETURNED
125 * Given an OID, return the corresponding CSSM_ALGID.
127 CSSM_ALGORITHMS
tpOidToAldId(
129 CSSM_ALGORITHMS
*keyAlg
); // RETURNED
135 #endif /* _CERT_GROUP_UTILS_H */