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.
20 // SSDLSession.h - CSP session for security server CSP/DL.
22 #ifndef _H_SSCSPSESSION
23 #define _H_SSCSPSESSION
25 #include "SSCSPDLSession.h"
27 #include <Security/SecurityServerClient.h>
35 class SSCSPSession
: public CSPFullPluginSession
38 SSCSPDLSession
&mSSCSPDLSession
;
39 SSFactory
&mSSFactory
;
41 SSCSPSession(CSSM_MODULE_HANDLE handle
,
43 const CSSM_VERSION
&version
,
45 CSSM_SERVICE_TYPE subserviceType
,
46 CSSM_ATTACH_FLAGS attachFlags
,
47 const CSSM_UPCALLS
&upcalls
,
48 SSCSPDLSession
&ssCSPDLSession
);
50 SecurityServer::ClientSession
&clientSession()
51 { return mSSCSPDLSession
.clientSession(); }
53 CSPContext
*contextCreate(CSSM_CC_HANDLE handle
, const Context
&context
);
55 void contextUpdate(CSSM_CC_HANDLE handle
, const Context
&context
,
57 void contextDelete(CSSM_CC_HANDLE handle
, const Context
&context
,
61 void setupContext(CSPContext
* &ctx
, const Context
&context
,
64 SSDatabase
getDatabase(const Context
&context
);
66 void makeReferenceKey(SecurityServer::KeyHandle inKeyHandle
,
67 CssmKey
&outKey
, SSDatabase
&inSSDatabase
,
68 uint32 inKeyAttr
, const CssmData
*inKeyLabel
);
69 SSKey
&lookupKey(const CssmKey
&inKey
);
71 void WrapKey(CSSM_CC_HANDLE CCHandle
,
72 const Context
&Context
,
73 const AccessCredentials
&AccessCred
,
75 const CssmData
*DescriptiveData
,
77 CSSM_PRIVILEGE Privilege
);
78 void UnwrapKey(CSSM_CC_HANDLE CCHandle
,
79 const Context
&Context
,
80 const CssmKey
*PublicKey
,
81 const CssmKey
&WrappedKey
,
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
,
94 const CssmData
*KeyLabel
,
95 const CSSM_RESOURCE_CONTROL_CONTEXT
*CredAndAclEntry
,
97 void GenerateKey(CSSM_CC_HANDLE ccHandle
,
98 const Context
&context
,
101 const CssmData
*keyLabel
,
102 const CSSM_RESOURCE_CONTROL_CONTEXT
*credAndAclEntry
,
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
,
111 uint32 privateKeyUsage
,
112 uint32 privateKeyAttr
,
113 const CssmData
*privateKeyLabel
,
114 const CSSM_RESOURCE_CONTROL_CONTEXT
*credAndAclEntry
,
116 CSSM_PRIVILEGE privilege
);
117 void ObtainPrivateKeyFromPublicKey(const CssmKey
&PublicKey
,
118 CssmKey
&PrivateKey
);
119 void QueryKeySizeInBits(CSSM_CC_HANDLE CCHandle
,
120 const Context
&Context
,
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
);
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
,
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
,
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
,
165 #endif // _H_SSCSPSESSION