]>
Commit | Line | Data |
---|---|---|
b1ab9ed8 A |
1 | /* |
2 | * Copyright (c) 2000-2002 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 | // tpclient - client interface to CSSM TPs and their operations | |
21 | // | |
22 | #ifndef _H_CDSA_CLIENT_TPCLIENT | |
23 | #define _H_CDSA_CLIENT_TPCLIENT 1 | |
24 | ||
25 | #include <security_cdsa_client/cssmclient.h> | |
26 | #include <security_cdsa_client/clclient.h> | |
27 | #include <security_cdsa_client/cspclient.h> | |
28 | #include <security_cdsa_utilities/cssmtrust.h> | |
29 | #include <security_cdsa_utilities/cssmalloc.h> | |
30 | #include <security_cdsa_utilities/cssmdata.h> | |
31 | ||
32 | ||
33 | namespace Security { | |
34 | namespace CssmClient { | |
35 | ||
36 | ||
37 | // | |
38 | // A TP attachment | |
39 | // | |
40 | class TPImpl : public AttachmentImpl | |
41 | { | |
42 | public: | |
43 | TPImpl(const Guid &guid); | |
44 | TPImpl(const Module &module); | |
45 | virtual ~TPImpl(); | |
46 | ||
47 | public: | |
48 | // the CL and CSP used with many TP operations is usually | |
49 | // pretty stable. The system may even figure them out | |
50 | // automatically in the future. | |
51 | void use(CL &cl); | |
52 | void use(CSP &csp); | |
53 | CL &usedCL(); | |
54 | CSP &usedCSP(); | |
55 | ||
56 | public: | |
57 | void certGroupVerify(const CertGroup &certGroup, const TPVerifyContext &context, | |
58 | TPVerifyResult *result); | |
59 | ||
60 | private: | |
61 | void setupCL(); // setup mUseCL | |
62 | void setupCSP(); // setup mUseCSP | |
63 | ||
64 | private: | |
65 | CL *mUseCL; // use this CL for TP operation | |
66 | CSP *mUseCSP; // use this CSP for TP operation | |
67 | bool mOwnCL, mOwnCSP; // whether we've made our own | |
68 | }; | |
69 | ||
70 | ||
71 | class TP : public Attachment | |
72 | { | |
73 | public: | |
74 | typedef TPImpl Impl; | |
75 | ||
76 | explicit TP(Impl *impl) : Attachment(impl) {} | |
77 | TP(const Guid &guid) : Attachment(new Impl(guid)) {} | |
78 | TP(const Module &module) : Attachment(new Impl(module)) {} | |
79 | ||
80 | Impl *operator ->() const { return &impl<Impl>(); } | |
81 | Impl &operator *() const { return impl<Impl>(); } | |
82 | }; | |
83 | ||
84 | ||
85 | // | |
86 | // A self-building TPVerifyContext. | |
87 | // This is a TPVerifyContext, but it's NOT A PODWRAPPER (it's larger). | |
88 | // | |
89 | // NOTE: This is not a client-side object. | |
90 | // | |
91 | class TPBuildVerifyContext : public TPVerifyContext { | |
92 | public: | |
93 | TPBuildVerifyContext(CSSM_TP_ACTION action = CSSM_TP_ACTION_DEFAULT, | |
94 | Allocator &alloc = Allocator::standard()); | |
95 | ||
96 | Allocator &allocator; | |
97 | ||
98 | private: | |
99 | TPCallerAuth mCallerAuth; | |
427c49bc | 100 | // PolicyInfo mPolicyInfo; // -- unused |
b1ab9ed8 A |
101 | CssmDlDbList mDlDbList; |
102 | }; | |
103 | ||
104 | ||
105 | } // end namespace CssmClient | |
106 | } // end namespace Security | |
107 | ||
108 | #endif // _H_CDSA_CLIENT_CLCLIENT |