]> git.saurik.com Git - apple/security.git/blob - AppleCSPDL/SSCSPSession.h
Security-28.tar.gz
[apple/security.git] / AppleCSPDL / SSCSPSession.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 // SSDLSession.h - CSP session for security server CSP/DL.
21 //
22 #ifndef _H_SSCSPSESSION
23 #define _H_SSCSPSESSION
24
25 #include "SSCSPDLSession.h"
26
27 #include <Security/SecurityServerClient.h>
28
29
30 class CSPDLPlugin;
31 class SSFactory;
32 class SSDatabase;
33 class SSKey;
34
35 class SSCSPSession : public CSPFullPluginSession
36 {
37 public:
38 SSCSPDLSession &mSSCSPDLSession;
39 SSFactory &mSSFactory;
40
41 SSCSPSession(CSSM_MODULE_HANDLE handle,
42 CSPDLPlugin &plug,
43 const CSSM_VERSION &version,
44 uint32 subserviceId,
45 CSSM_SERVICE_TYPE subserviceType,
46 CSSM_ATTACH_FLAGS attachFlags,
47 const CSSM_UPCALLS &upcalls,
48 SSCSPDLSession &ssCSPDLSession);
49
50 SecurityServer::ClientSession &clientSession()
51 { return mSSCSPDLSession.clientSession(); }
52
53 CSPContext *contextCreate(CSSM_CC_HANDLE handle, const Context &context);
54 #if 0
55 void contextUpdate(CSSM_CC_HANDLE handle, const Context &context,
56 PluginContext *ctx);
57 void contextDelete(CSSM_CC_HANDLE handle, const Context &context,
58 PluginContext *ctx);
59 #endif
60
61 void setupContext(CSPContext * &ctx, const Context &context,
62 bool encoding);
63
64 SSDatabase getDatabase(const Context &context);
65
66 void makeReferenceKey(SecurityServer::KeyHandle inKeyHandle,
67 CssmKey &outKey, SSDatabase &inSSDatabase,
68 uint32 inKeyAttr, const CssmData *inKeyLabel);
69 SSKey &lookupKey(const CssmKey &inKey);
70
71 void WrapKey(CSSM_CC_HANDLE CCHandle,
72 const Context &Context,
73 const AccessCredentials &AccessCred,
74 const CssmKey &Key,
75 const CssmData *DescriptiveData,
76 CssmKey &WrappedKey,
77 CSSM_PRIVILEGE Privilege);
78 void UnwrapKey(CSSM_CC_HANDLE CCHandle,
79 const Context &Context,
80 const CssmKey *PublicKey,
81 const CssmKey &WrappedKey,
82 uint32 KeyUsage,
83 uint32 KeyAttr,
84 const CssmData *KeyLabel,
85 const CSSM_RESOURCE_CONTROL_CONTEXT *CredAndAclEntry,
86 CssmKey &UnwrappedKey,
87 CssmData &DescriptiveData,
88 CSSM_PRIVILEGE Privilege);
89 void DeriveKey(CSSM_CC_HANDLE CCHandle,
90 const Context &Context,
91 CssmData &Param,
92 uint32 KeyUsage,
93 uint32 KeyAttr,
94 const CssmData *KeyLabel,
95 const CSSM_RESOURCE_CONTROL_CONTEXT *CredAndAclEntry,
96 CssmKey &DerivedKey);
97 void GenerateKey(CSSM_CC_HANDLE ccHandle,
98 const Context &context,
99 uint32 keyUsage,
100 uint32 keyAttr,
101 const CssmData *keyLabel,
102 const CSSM_RESOURCE_CONTROL_CONTEXT *credAndAclEntry,
103 CssmKey &key,
104 CSSM_PRIVILEGE privilege);
105 void GenerateKeyPair(CSSM_CC_HANDLE ccHandle,
106 const Context &context,
107 uint32 publicKeyUsage,
108 uint32 publicKeyAttr,
109 const CssmData *publicKeyLabel,
110 CssmKey &publicKey,
111 uint32 privateKeyUsage,
112 uint32 privateKeyAttr,
113 const CssmData *privateKeyLabel,
114 const CSSM_RESOURCE_CONTROL_CONTEXT *credAndAclEntry,
115 CssmKey &privateKey,
116 CSSM_PRIVILEGE privilege);
117 void ObtainPrivateKeyFromPublicKey(const CssmKey &PublicKey,
118 CssmKey &PrivateKey);
119 void QueryKeySizeInBits(CSSM_CC_HANDLE CCHandle,
120 const Context &Context,
121 const CssmKey &Key,
122 CSSM_KEY_SIZE &KeySize);
123 void FreeKey(const AccessCredentials *AccessCred,
124 CssmKey &key, CSSM_BOOL Delete);
125 void GenerateRandom(CSSM_CC_HANDLE ccHandle,
126 const Context &context,
127 CssmData &randomNumber);
128 void Login(const AccessCredentials &AccessCred,
129 const CssmData *LoginName,
130 const void *Reserved);
131 void Logout();
132 void VerifyDevice(const CssmData &DeviceCert);
133 void GetOperationalStatistics(CSPOperationalStatistics &statistics);
134 void RetrieveCounter(CssmData &Counter);
135 void RetrieveUniqueId(CssmData &UniqueID);
136 void GetTimeValue(CSSM_ALGORITHMS TimeAlgorithm, CssmData &TimeData);
137 void GetKeyOwner(const CssmKey &Key,
138 CSSM_ACL_OWNER_PROTOTYPE &Owner);
139 void ChangeKeyOwner(const AccessCredentials &AccessCred,
140 const CssmKey &Key,
141 const CSSM_ACL_OWNER_PROTOTYPE &NewOwner);
142 void GetKeyAcl(const CssmKey &Key,
143 const CSSM_STRING *SelectionTag,
144 uint32 &NumberOfAclInfos,
145 CSSM_ACL_ENTRY_INFO_PTR &AclInfos);
146 void ChangeKeyAcl(const AccessCredentials &AccessCred,
147 const CSSM_ACL_EDIT &AclEdit,
148 const CssmKey &Key);
149 void GetLoginOwner(CSSM_ACL_OWNER_PROTOTYPE &Owner);
150 void ChangeLoginOwner(const AccessCredentials &AccessCred,
151 const CSSM_ACL_OWNER_PROTOTYPE &NewOwner);
152 void GetLoginAcl(const CSSM_STRING *SelectionTag,
153 uint32 &NumberOfAclInfos,
154 CSSM_ACL_ENTRY_INFO_PTR &AclInfos);
155 void ChangeLoginAcl(const AccessCredentials &AccessCred,
156 const CSSM_ACL_EDIT &AclEdit);
157 void PassThrough(CSSM_CC_HANDLE CCHandle,
158 const Context &Context,
159 uint32 PassThroughId,
160 const void *InData,
161 void **OutData);
162 };
163
164
165 #endif // _H_SSCSPSESSION