#ifndef _H_SDKEY_
#define _H_SDKEY_
#include <securityd_client/ssclient.h>
#include <security_cdsa_plugin/CSPsession.h>
namespace Security
{
class CssmKey;
}
class SDCSPSession;
class SDCSPDLSession;
class SDDLSession;
class SDKey : public ReferencedKey
{
public:
SDKey(SDCSPSession &session, SecurityServer::KeyHandle keyHandle,
CssmKey &ioKey, CSSM_DB_HANDLE inDBHandle, uint32 inKeyAttr,
const CssmData *inKeyLabel);
SDKey(SDDLSession &session, CssmKey &ioKey, SecurityServer::KeyHandle hKey, CSSM_DB_HANDLE inDBHandle,
SecurityServer::RecordHandle record, CSSM_DB_RECORDTYPE recordType,
CssmData &keyBlob);
virtual ~SDKey();
void free(const AccessCredentials *accessCred, CssmKey &ioKey,
CSSM_BOOL deleteKey);
SecurityServer::ClientSession &clientSession();
SecurityServer::KeyHandle optionalKeyHandle() const;
SecurityServer::KeyHandle keyHandle();
void getOwner(CSSM_ACL_OWNER_PROTOTYPE &owner, Allocator &allocator);
void changeOwner(const AccessCredentials &accessCred,
const AclOwnerPrototype &newOwner);
void getAcl(const char *selectionTag, uint32 &numberOfAclInfos,
AclEntryInfo *&aclInfos, Allocator &allocator);
void changeAcl(const AccessCredentials &accessCred,
const AclEdit &aclEdit);
private:
Allocator &mAllocator;
SecurityServer::KeyHandle mKeyHandle;
CSSM_DB_HANDLE mDatabase;
SecurityServer::RecordHandle mRecord;
SecurityServer::ClientSession &mClientSession;
};
#endif // _H_SDKEY_