]> git.saurik.com Git - apple/security.git/blob - AppleX509TP/rootCerts.h
Security-54.1.7.tar.gz
[apple/security.git] / AppleX509TP / rootCerts.h
1 /*
2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
3 *
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
8 * using this file.
9 *
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.
16 */
17
18
19 /*
20 File: rootCerts.h
21
22 Contains: Interface to local cache of system-wide trusted root certs
23
24 Written by: Doug Mitchell.
25
26 Copyright: Copyright 1999 by Apple Computer, Inc., all rights reserved.
27
28 */
29
30 #ifndef _TP_ROOT_CERTS_H_
31 #define _TP_ROOT_CERTS_H_
32
33 #include <Security/cssmtype.h>
34 #include <Security/globalizer.h>
35 #include <Security/threading.h>
36
37 /*
38 * As of 3/18/02, use of the built-in root certs is disabled by default.
39 * Their use is enabled at in CSSM_TP_CertGroupVerify by the use of a
40 * private bit in CSSM_APPLE_TP_ACTION_DATA.ActionFlags.
41 * The presence of the root certs at all (at compile time) is controlled
42 * TP_ROOT_CERT_ENABLE.
43 */
44 #define TP_ROOT_CERT_ENABLE 1
45
46 #if TP_ROOT_CERT_ENABLE
47
48 /*
49 * Each one of these represents one known root cert.
50 */
51 typedef struct {
52 CSSM_DATA subjectName; // normalized and DER-encoded
53 CSSM_DATA publicKey; // DER-encoded
54 uint32 keySize;
55 } tpRootCert;
56
57 /* One of these per process which caches the roots in tpRootCert format */
58 class TPRootStore
59 {
60 public:
61 TPRootStore() : mRootCerts(NULL), mNumRootCerts(0) { }
62 ~TPRootStore();
63 const tpRootCert *rootCerts(
64 CSSM_CL_HANDLE clHand,
65 unsigned &numRootCerts);
66 static ModuleNexus<TPRootStore> tpGlobalRoots;
67
68 private:
69 tpRootCert *mRootCerts;
70 unsigned mNumRootCerts;
71 Mutex mLock;
72 };
73
74 #endif /* TP_ROOT_CERT_ENABLE */
75
76 #endif /* _TP_ROOT_CERTS_H_ */