CUnifiedKeyStore Class Reference

class CUnifiedKeyStore : public CActive

The unified key store.

This class provides a key store whose contents are the sum of the contents of all key store implementations on the device. It is intended a single point of access for clients wishing to access key stores.

Since this class is intended for widespread use, capability checks relating to key access are documented here even though the checks are actually made in the individual key store implementations.

Inherits from

Nested Classes and Structures

Public Member Functions
~CUnifiedKeyStore()
IMPORT_C voidCancelCreateKey()
IMPORT_C voidCancelDeleteKey()
IMPORT_C voidCancelExportEncryptedKey()
IMPORT_C voidCancelExportKey()
voidCancelExportPublic()
voidCancelGetKeyInfo()
IMPORT_C voidCancelImportKey()
IMPORT_C voidCancelInitialize()
voidCancelList()
voidCancelOpen()
IMPORT_C voidCancelRelock()
IMPORT_C voidCancelSetManagementPolicy()
IMPORT_C voidCancelSetPassphraseTimeout()
IMPORT_C voidCancelSetUsePolicy()
IMPORT_C voidCreateKey(TInt, TKeyUsagePKCS15, TUint, const TDesC &, CCTKeyInfo::EKeyAlgorithm, TInt, TTime, TTime, CCTKeyInfo *&, TRequestStatus &)
IMPORT_C voidDeleteKey(TCTTokenObjectHandle, TRequestStatus &)
IMPORT_C voidExportEncryptedKey(TCTTokenObjectHandle, const CPBEncryptParms &, HBufC8 *&, TRequestStatus &)
IMPORT_C voidExportKey(TCTTokenObjectHandle, HBufC8 *&, TRequestStatus &)
voidExportPublic(const TCTTokenObjectHandle &, HBufC8 *&, TRequestStatus &)
voidGetKeyInfo(TCTTokenObjectHandle, CCTKeyInfo *&, TRequestStatus &)
IMPORT_C voidImportKey(TInt, const TDesC8 &, TKeyUsagePKCS15, const TDesC &, TInt, TTime, TTime, CCTKeyInfo *&, TRequestStatus &)
IMPORT_C voidInitialize(TRequestStatus &)
IMPORT_C MCTKeyStore &KeyStore(TInt)
IMPORT_C TIntKeyStoreCount()
IMPORT_C MCTKeyStoreManager &KeyStoreManager(TInt)
IMPORT_C TIntKeyStoreManagerCount()
voidList(RMPointerArray< CCTKeyInfo > &, const TCTKeyAttributeFilter &, TRequestStatus &)
IMPORT_C CUnifiedKeyStore *NewL(RFs &)
IMPORT_C CUnifiedKeyStore *NewLC(RFs &)
voidOpen(const TCTTokenObjectHandle &, MRSASigner *&, TRequestStatus &)
voidOpen(const TCTTokenObjectHandle &, MDSASigner *&, TRequestStatus &)
voidOpen(const TCTTokenObjectHandle &, MCTDecryptor *&, TRequestStatus &)
voidOpen(const TCTTokenObjectHandle &, MCTDH *&, TRequestStatus &)
IMPORT_C voidRelock(TRequestStatus &)
IMPORT_C voidSetManagementPolicy(TCTTokenObjectHandle, const TSecurityPolicy &, TRequestStatus &)
IMPORT_C voidSetPassphraseTimeout(TInt, TRequestStatus &)
IMPORT_C voidSetUsePolicy(TCTTokenObjectHandle, const TSecurityPolicy &, TRequestStatus &)
Private Member Functions
CUnifiedKeyStore(RFs &)
voidCancelOutstandingRequest()
voidCleanup()
voidComplete(TInt)
voidConstructL()
voidDoCancel()
voidDoInitializeL()
TBool DoOpen(const TCTTokenObjectHandle &, TRequestStatus &)
MCTKeyStore *FindKeyStore(const TCTTokenObjectHandle &)
MCTKeyStoreManager *FindKeyStoreManager(const TCTTokenObjectHandle &)
voidPrepareToCreateKeyL(TInt, TKeyUsagePKCS15, TUint, const TDesC &, CCTKeyInfo::EKeyAlgorithm, TInt, TTime, TTime, TRequestStatus &)
TInt RunError(TInt)
voidRunL()
voidStartAsyncOperation(TState, TRequestStatus &)
Inherited Functions
CActive::CActive(TInt)
CActive::Cancel()
CActive::Deque()
CActive::Extension_(TUint,TAny *&,TAny *)
CActive::IsActive()const
CActive::IsAdded()const
CActive::Priority()const
CActive::SetActive()
CActive::SetPriority(TInt)
CActive::~CActive()
CBase::CBase()
CBase::Delete(CBase *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Private Member Enumerations
enumTState {
EIdle, EInitializeGetTokenList, EInitializeGetToken, EInitialiseGetKeyManagerInterface, EInitializeGetKeyUserInterface, EInitializeGetKeyUserInterfaceFinished, EInitializeFinished, EList, EGetKeyInfo, EOpen, ECreateKey, EImportKey, EImportKeyEncrypted, EExportKey, EExportEncryptedKey, EExportPublic, EDeleteKey, ESetUsePolicy, ESetManagementPolicy, ESetPassphraseTimeout, ERelock, ESetAuthenticationPolicy, EGetAuthenticationPolicy
}
Inherited Enumerations
CActive:TPriority
Private Attributes
TCTKeyAttributeFilter *iFilter
RFs &iFs
TInt iIndex
TInt iIndexTokenTypes
TInt iIndexTokens
HBufC8 *iKeyData
CCTKeyInfo *iKeyInfo
CCTKeyInfo **iKeyInfoOut
RMPointerArray< CCTKeyInfo > *iKeyInfos
MCTKeyStore *iKeyStore
MCTKeyStoreManager *iKeyStoreManager
RPointerArray< CKeyStoreIF >iKeyStoresHolder
TInt iNewTimeout
TRequestStatus *iOriginalRequestStatus
CPBEncryptParms *iPbeParams
TUid iRequestUid
TState iState
MCTToken *iToken
MCTTokenInterface *iTokenInterface
MCTTokenType *iTokenType
RCPointerArray< CCTTokenTypeInfo >iTokenTypes
RCPointerArray< HBufC >iTokens
Inherited Attributes
CActive::iStatus

Constructor & Destructor Documentation

CUnifiedKeyStore(RFs &)

CUnifiedKeyStore(RFs &aFs)[private]

Parameters

RFs & aFs

~CUnifiedKeyStore()

IMPORT_C~CUnifiedKeyStore()

The destructor destroys all the resources owned by this object.

Member Functions Documentation

CancelCreateKey()

IMPORT_C voidCancelCreateKey()

Cancels an ongoing CreateKey() operation.

The operation completes with KErrCancel.

CancelDeleteKey()

IMPORT_C voidCancelDeleteKey()

Cancels an ongoing DeleteKey() operation.

The operation completes with KErrCancel.

CancelExportEncryptedKey()

IMPORT_C voidCancelExportEncryptedKey()

Cancels an ongoing ExportEncryptedKey() operation.

The operation completes with KErrCancel.

CancelExportKey()

IMPORT_C voidCancelExportKey()

Cancels an ongoing ExportKey() operation.

The operation completes with KErrCancel.

CancelExportPublic()

voidCancelExportPublic()[virtual]

CancelGetKeyInfo()

voidCancelGetKeyInfo()[virtual]

CancelImportKey()

IMPORT_C voidCancelImportKey()

Cancels an ongoing ImportKey() operation.

The operation completes with KErrCancel.

CancelInitialize()

IMPORT_C voidCancelInitialize()

Cancels an ongoing Initialize() operation.

The operation completes with KErrCancel.

CancelList()

voidCancelList()[virtual]

CancelOpen()

voidCancelOpen()[virtual]

CancelOutstandingRequest()

voidCancelOutstandingRequest()[private]

Cancel the outstanding request.

CancelRelock()

IMPORT_C voidCancelRelock()

Cancels an ongoing Relock() operation.

The operation completes with KErrCancel.

CancelSetManagementPolicy()

IMPORT_C voidCancelSetManagementPolicy()

Cancels an ongoing SetManagementPolicy() operation.

The operation completes with KErrCancel.

CancelSetPassphraseTimeout()

IMPORT_C voidCancelSetPassphraseTimeout()

Cancels an ongoing SetPassphraseTimeout() operation.

The operation completes with KErrCancel.

CancelSetUsePolicy()

IMPORT_C voidCancelSetUsePolicy()

Cancels an ongoing SetUsePolicy() operation.

The operation completes with KErrCancel.

Cleanup()

voidCleanup()[private]

Clean up state.

Complete(TInt)

voidComplete(TIntaError)[private]

Complete the user's request and clean up state.

Parameters

TInt aError

ConstructL()

voidConstructL()[private]

CreateKey(TInt, TKeyUsagePKCS15, TUint, const TDesC &, CCTKeyInfo::EKeyAlgorithm, TInt, TTime, TTime, CCTKeyInfo *&, TRequestStatus &)

IMPORT_C voidCreateKey(TIntaKeyStoreIndex,
TKeyUsagePKCS15aUsage,
TUintaSize,
const TDesC &aLabel,
CCTKeyInfo::EKeyAlgorithmaAlgorithm,
TIntaAccessType,
TTimeaStartDate,
TTimeaEndDate,
CCTKeyInfo *&aKeyInfoOut,
TRequestStatus &aStatus
)

Generates a new key pair.

For the software key store, the owner of the new key is set to the calling process. Users can subsequently be added by calling SetUsers().

capability
WriteUserData Requires the caller to have WriteUserData capability
leave
KErrPermissionDenied If the caller does not have WriteUserData capability
leave
KErrKeyUsage If the key usage flags are not valid or not consistent with the key algorithm.
leave
KErrKeyValidity If the validity start and end dates are specified but do not form a valid time period.
panic
If aKeyStoreIndex does not specify a valid keystore manager.

Parameters

TInt aKeyStoreIndexThe index of the key store manager in which to create the key. Must be between zero and KeyStoreMangerCount() exclusive.
TKeyUsagePKCS15 aUsageThe key usage flags in the PKCS#15 format.
TUint aSizeThe size of the key in bits.
const TDesC & aLabelA textual label for the key.
CCTKeyInfo::EKeyAlgorithm aAlgorithmThe type of key.
TInt aAccessTypeThe key access type - a bitfield specifying key access requirements. Allowed values are zero, or a comination of CCTKeyInfo::EKeyAccess::ESenstive and CCTKeyInfo::EKeyAccess::EExtractable
TTime aStartDateThe start of the validity period.
TTime aEndDateThe end of the validity period.
CCTKeyInfo *& aKeyInfoOutA pointer that is set to a newly created key info object on successful completion.
TRequestStatus & aStatusThe request status object; contains the result of the CreateKey() request when complete. Set to KErrCancel if any outstanding request is cancelled.

DeleteKey(TCTTokenObjectHandle, TRequestStatus &)

IMPORT_C voidDeleteKey(TCTTokenObjectHandleaHandle,
TRequestStatus &aStatus
)

Deletes a key.

capability
WriteUserData Requires the caller to have WriteUserData capability
leave
KErrPermissionDenied If the caller does not have WriteUserData capability, or is not the owner of the key.
leave
KErrNotFound If the key the handle referes to does not exist.
leave
KErrAccessDenied If the calling process is not allowed to delete the key.
leave
KErrInUse If another client is currently using the key.

Parameters

TCTTokenObjectHandle aHandleThe handle of the key to delete
TRequestStatus & aStatusThe request status object; contains the result of the DeleteKey() request when complete. Set to KErrCancel if any outstanding request is cancelled.

DoCancel()

voidDoCancel()[private, virtual]

Implements cancellation of an outstanding request.

This function is called as part of the active object's Cancel().

It must call the appropriate cancel function offered by the active object's asynchronous service provider. The asynchronous service provider's cancel is expected to act immediately.

DoCancel() must not wait for event completion; this is handled by Cancel().

CActive::Cancel

DoInitializeL()

voidDoInitializeL()[private]

DoOpen(const TCTTokenObjectHandle &, TRequestStatus &)

TBool DoOpen(const TCTTokenObjectHandle &aHandle,
TRequestStatus &aStatus
)[private]

Parameters

const TCTTokenObjectHandle & aHandle
TRequestStatus & aStatus

ExportEncryptedKey(TCTTokenObjectHandle, const CPBEncryptParms &, HBufC8 *&, TRequestStatus &)

IMPORT_C voidExportEncryptedKey(TCTTokenObjectHandleaHandle,
const CPBEncryptParms &aEncryptParams,
HBufC8 *&aKey,
TRequestStatus &aStatus
)

Exports an encrypted key pair.

The key is exported as DER-encoded PKCS#5/PKCS#8 data.

capability
ReadUserData Requires the caller to have ReadUserData capability
leave
KErrPermissionDenied If the caller does not have ReadUserData capability, or is not the owner of the key.
leave
KErrNotFound If the key the handle referes to does not exist.
leave
KErrKeyAccess If the exportable flag is not set for the key.
leave
KErrKeyAlgorithm If this type of key cannot be exported.

Parameters

TCTTokenObjectHandle aHandleThe handle of the key to export
const CPBEncryptParms & aEncryptParams
HBufC8 *& aKeyA reference to a HBufC8 pointer. The pointer will be set to a newly allocated buffer containing the key data.
TRequestStatus & aStatusThe request status object; contains the result of the ExportEncryptedKey() request when complete. Set to KErrCancel if any outstanding request is cancelled.

ExportKey(TCTTokenObjectHandle, HBufC8 *&, TRequestStatus &)

IMPORT_C voidExportKey(TCTTokenObjectHandleaHandle,
HBufC8 *&aKey,
TRequestStatus &aStatus
)

Exports a key pair in the clear.

The key is exported as DER-encoded PKCS#8 data.

capability
ReadUserData Requires the caller to have ReadUserData capability
leave
KErrPermissionDenied If the caller does not have ReadUserData capability, or is not the owner of the key.
leave
KErrNotFound If the key the handle referes to does not exist.
leave
KErrKeyAccess If the sensitive flag is set for the key, or the exportable flag is not set.
leave
KErrKeyAlgorithm If this type of key cannot be exported.

Parameters

TCTTokenObjectHandle aHandleThe handle of the key to export
HBufC8 *& aKeyA reference to a HBufC8 pointer. The pointer will be set to a newly allocated buffer containing the key data. It is the caller's responsibility to delete this buffer.
TRequestStatus & aStatusThe request status object; contains the result of the ExportKey() request when complete. Set to KErrCancel if any outstanding request is cancelled.

ExportPublic(const TCTTokenObjectHandle &, HBufC8 *&, TRequestStatus &)

voidExportPublic(const TCTTokenObjectHandle &aHandle,
HBufC8 *&aPublicKey,
TRequestStatus &aStatus
)[virtual]

Parameters

const TCTTokenObjectHandle & aHandle
HBufC8 *& aPublicKey
TRequestStatus & aStatus

FindKeyStore(const TCTTokenObjectHandle &)

MCTKeyStore *FindKeyStore(const TCTTokenObjectHandle &aHandle)[private]

A synchronous method to find the key store given a token object handle. Returns NULL if none found.

Parameters

const TCTTokenObjectHandle & aHandle

FindKeyStoreManager(const TCTTokenObjectHandle &)

MCTKeyStoreManager *FindKeyStoreManager(const TCTTokenObjectHandle &aHandle)[private]

A synchronous method to find the key store manager given a token object handle. Returns NULL if none found.

Parameters

const TCTTokenObjectHandle & aHandle

GetKeyInfo(TCTTokenObjectHandle, CCTKeyInfo *&, TRequestStatus &)

voidGetKeyInfo(TCTTokenObjectHandleaHandle,
CCTKeyInfo *&aInfo,
TRequestStatus &aStatus
)[virtual]

Parameters

TCTTokenObjectHandle aHandle
CCTKeyInfo *& aInfo
TRequestStatus & aStatus

ImportKey(TInt, const TDesC8 &, TKeyUsagePKCS15, const TDesC &, TInt, TTime, TTime, CCTKeyInfo *&, TRequestStatus &)

IMPORT_C voidImportKey(TIntaKeyStoreIndex,
const TDesC8 &aKeyData,
TKeyUsagePKCS15aUsage,
const TDesC &aLabel,
TIntaAccessType,
TTimeaStartDate,
TTimeaEndDate,
CCTKeyInfo *&aKeyInfoOut,
TRequestStatus &aStatus
)

Imports a key pair.

For the software key store, the owner of the new key is set to the calling process. Users can subsequently be added by calling SetUsers().

The key data should be in PKCS#8 format. Both encrypted and cleartext versions are allowed.

capability
WriteUserData Requires the caller to have WriteUserData capability
leave
KErrPermissionDenied If the caller does not have WriteUserData capability
leave
KErrKeyUsage If the key usage flags are not valid or not consistent with the key algorithm.
leave
KErrKeyValidity If the validity start and end dates are specified but do not form a valid time period.
leave
KErrArgument If the key data cannot be parsed.
panic
If aKeyStoreIndex does not specify a valid keystore manager.

Parameters

TInt aKeyStoreIndexThe index of the key store manager in which to create the key. Must be between zero and KeyStoreMangerCount() exclusive.
const TDesC8 & aKeyDataThe key data to import, ASN.1 DER encoded PKCS#8.
TKeyUsagePKCS15 aUsageThe key usage flags in the PKCS#15 format.
const TDesC & aLabelA textual label for the key.
TInt aAccessTypeThe key access type - a bitfield specifying key access requirements. Allowed values are zero, or a comination of CCTKeyInfo::EKeyAccess::ESenstive and CCTKeyInfo::EKeyAccess::EExtractable
TTime aStartDateThe start of the validity period.
TTime aEndDateThe end of the validity period.
CCTKeyInfo *& aKeyInfoOutA pointer that is set to a newly created key info object on successful completion.
TRequestStatus & aStatusThe request status object; contains the result of the ImportKey() request when complete. Set to KErrCancel if any outstanding request is cancelled.

Initialize(TRequestStatus &)

IMPORT_C voidInitialize(TRequestStatus &aStatus)

Initialises the manager.

It must be called after the manager has been constructed and before any call to the manager functions.

This is an asynchronous request.

Parameters

TRequestStatus & aStatusThe request status object; contains the result of the Initialize() request when complete. Set to KErrCancel if any outstanding request is cancelled.

KeyStore(TInt)

IMPORT_C MCTKeyStore &KeyStore(TIntaIndex)

Gets a read-only interface to a key store.

panic
CUnifiedKeyStore 2 If aIndex is out of range, ie it is greater than or equal to the value returned by KeyStoreCount().

Parameters

TInt aIndexAn ordinal number that identifies the key store.

KeyStoreCount()

IMPORT_C TIntKeyStoreCount()const

Gets the number of available read-only key stores.

KeyStoreManager(TInt)

IMPORT_C MCTKeyStoreManager &KeyStoreManager(TIntaIndex)

Gets a read-write interface to the store specified by aIndex.

panic
CUnifiedKeyStore 2 If aIndex s out of range, ie it is greater than or equal to the value returned by KeyStoreManagerCount().

Parameters

TInt aIndexAn ordinal number that identifies the key store.

KeyStoreManagerCount()

IMPORT_C TIntKeyStoreManagerCount()const

Gets the number of available read-write key stores.

List(RMPointerArray< CCTKeyInfo > &, const TCTKeyAttributeFilter &, TRequestStatus &)

voidList(RMPointerArray< CCTKeyInfo > &aKeys,
const TCTKeyAttributeFilter &aFilter,
TRequestStatus &aStatus
)[virtual]

Parameters

RMPointerArray< CCTKeyInfo > & aKeys
const TCTKeyAttributeFilter & aFilter
TRequestStatus & aStatus

NewL(RFs &)

IMPORT_C CUnifiedKeyStore *NewL(RFs &aFs)[static]

Creates a new CUnifiedKeyStore object.

Parameters

RFs & aFsA file server session. It must already be open.

NewLC(RFs &)

IMPORT_C CUnifiedKeyStore *NewLC(RFs &aFs)[static]

Creates a new CUnifiedKeyStore object and and puts a pointer to the new object onto the cleanup stack.

Parameters

RFs & aFsA file server session. It must already be open.

Open(const TCTTokenObjectHandle &, MRSASigner *&, TRequestStatus &)

voidOpen(const TCTTokenObjectHandle &aHandle,
MRSASigner *&aSigner,
TRequestStatus &aStatus
)[virtual]

Parameters

const TCTTokenObjectHandle & aHandle
MRSASigner *& aSigner
TRequestStatus & aStatus

Open(const TCTTokenObjectHandle &, MDSASigner *&, TRequestStatus &)

voidOpen(const TCTTokenObjectHandle &aHandle,
MDSASigner *&aSigner,
TRequestStatus &aStatus
)[virtual]

Parameters

const TCTTokenObjectHandle & aHandle
MDSASigner *& aSigner
TRequestStatus & aStatus

Open(const TCTTokenObjectHandle &, MCTDecryptor *&, TRequestStatus &)

voidOpen(const TCTTokenObjectHandle &aHandle,
MCTDecryptor *&aDecryptor,
TRequestStatus &aStatus
)[virtual]

Parameters

const TCTTokenObjectHandle & aHandle
MCTDecryptor *& aDecryptor
TRequestStatus & aStatus

Open(const TCTTokenObjectHandle &, MCTDH *&, TRequestStatus &)

voidOpen(const TCTTokenObjectHandle &aHandle,
MCTDH *&aDH,
TRequestStatus &aStatus
)[virtual]

Parameters

const TCTTokenObjectHandle & aHandle
MCTDH *& aDH
TRequestStatus & aStatus

PrepareToCreateKeyL(TInt, TKeyUsagePKCS15, TUint, const TDesC &, CCTKeyInfo::EKeyAlgorithm, TInt, TTime, TTime, TRequestStatus &)

voidPrepareToCreateKeyL(TIntaKeyStoreIndex,
TKeyUsagePKCS15aUsage,
TUintaSize,
const TDesC &aLabel,
CCTKeyInfo::EKeyAlgorithmaAlgorithm,
TIntaAccessType,
TTimeaStartDate,
TTimeaEndDate,
TRequestStatus &aStatus
)[private]

Parameters

TInt aKeyStoreIndex
TKeyUsagePKCS15 aUsage
TUint aSize
const TDesC & aLabel
CCTKeyInfo::EKeyAlgorithm aAlgorithm
TInt aAccessType
TTime aStartDate
TTime aEndDate
TRequestStatus & aStatus

Relock(TRequestStatus &)

IMPORT_C voidRelock(TRequestStatus &aStatus)

Re-locks the entire store (i.e., forget the passphrase).

Parameters

TRequestStatus & aStatusThe request status object; contains the result of the Relock() request when complete. Set to KErrCancel if any outstanding request is cancelled.

RunError(TInt)

TInt RunError(TIntaError)[private, virtual]

Parameters

TInt aError

RunL()

voidRunL()[private, virtual]

Handles an active object's request completion event.

A derived class must provide an implementation to handle the completed request. If appropriate, it may issue another request.

The function is called by the active scheduler when a request completion event occurs, i.e. after the active scheduler's WaitForAnyRequest() function completes.

Before calling this active object's RunL() function, the active scheduler has:

1. decided that this is the highest priority active object with a completed request

2. marked this active object's request as complete (i.e. the request is no longer outstanding)

RunL() runs under a trap harness in the active scheduler. If it leaves, then the active scheduler calls RunError() to handle the leave.

Note that once the active scheduler's Start() function has been called, all user code is run under one of the program's active object's RunL() or RunError() functions.

CActiveScheduler::Start CActiveScheduler::Error CActiveScheduler::WaitForAnyRequest TRAPD

SetManagementPolicy(TCTTokenObjectHandle, const TSecurityPolicy &, TRequestStatus &)

IMPORT_C voidSetManagementPolicy(TCTTokenObjectHandleaHandle,
const TSecurityPolicy &aPolicy,
TRequestStatus &aStatus
)

Sets the security policy for key management.

Specifies which processes are allowed to perform management operations on the key.

capability
WriteUserData Requires the caller to have WriteUserData capability
leave
KErrPermissionDenied If the caller does not have WriteUserData capability, or is not the owner of the key.
leave
KErrNotFound If the key the handle referes to does not exist.

Parameters

TCTTokenObjectHandle aHandleThe handle of the key
const TSecurityPolicy & aPolicyThe new security policy.
TRequestStatus & aStatusThe request status object; contains the result of the SetManagementPolicy() request when complete. Set to KErrCancel if any outstanding request is cancelled.

SetPassphraseTimeout(TInt, TRequestStatus &)

IMPORT_C voidSetPassphraseTimeout(TIntaTimeout,
TRequestStatus &aStatus
)

Sets the passphrase timeout for all keys owned by this process.

capability
WriteUserData Requires the caller to have WriteUserData capability
leave
KErrPermissionDenied If the caller does not have WriteUserData capability, or is not the owner of the key
leave
KErrArgument If the timeout specified is invalid.

Parameters

TInt aTimeoutThe timeout in seconds. 0 means that the passphrase is always asked for, and -1 means that it is never expired
TRequestStatus & aStatusThe request status object; contains the result of the SetPassphraseTimeout() request when complete. Set to KErrCancel if any outstanding request is cancelled.

SetUsePolicy(TCTTokenObjectHandle, const TSecurityPolicy &, TRequestStatus &)

IMPORT_C voidSetUsePolicy(TCTTokenObjectHandleaHandle,
const TSecurityPolicy &aPolicy,
TRequestStatus &aStatus
)

Sets the security policy for key use.

Specifies which processes are allowed to use the key for cryptographic operations.

capability
WriteUserData Requires the caller to have WriteUserData capability
leave
KErrPermissionDenied If the caller does not have WriteUserData capability, or is not the owner of the key.
leave
KErrNotFound If the key the handle referes to does not exist.

Parameters

TCTTokenObjectHandle aHandleThe handle of the key
const TSecurityPolicy & aPolicyThe new security policy.
TRequestStatus & aStatusThe request status object; contains the result of the SetUsePolicy() request when complete. Set to KErrCancel if any outstanding request is cancelled.

StartAsyncOperation(TState, TRequestStatus &)

voidStartAsyncOperation(TStateaState,
TRequestStatus &aStatus
)[private]

Parameters

TState aState
TRequestStatus & aStatus

Member Enumerations Documentation

Enum TState

Enumerators

EIdle
EInitializeGetTokenList
EInitializeGetToken
EInitialiseGetKeyManagerInterface
EInitializeGetKeyUserInterface
EInitializeGetKeyUserInterfaceFinished
EInitializeFinished
EList
EGetKeyInfo
EOpen
ECreateKey
EImportKey
EImportKeyEncrypted
EExportKey
EExportEncryptedKey
EExportPublic
EDeleteKey
ESetUsePolicy
ESetManagementPolicy
ESetPassphraseTimeout
ERelock
ESetAuthenticationPolicy
EGetAuthenticationPolicy

Member Data Documentation

TCTKeyAttributeFilter * iFilter

TCTKeyAttributeFilter *iFilter[private]

RFs & iFs

RFs &iFs[private]

TInt iIndex

TInt iIndex[private]

TInt iIndexTokenTypes

TInt iIndexTokenTypes[private]

TInt iIndexTokens

TInt iIndexTokens[private]

HBufC8 * iKeyData

HBufC8 *iKeyData[private]

CCTKeyInfo * iKeyInfo

CCTKeyInfo *iKeyInfo[private]

CCTKeyInfo ** iKeyInfoOut

CCTKeyInfo **iKeyInfoOut[private]

RMPointerArray< CCTKeyInfo > * iKeyInfos

RMPointerArray< CCTKeyInfo > *iKeyInfos[private]

MCTKeyStore * iKeyStore

MCTKeyStore *iKeyStore[private]

MCTKeyStoreManager * iKeyStoreManager

MCTKeyStoreManager *iKeyStoreManager[private]

RPointerArray< CKeyStoreIF > iKeyStoresHolder

RPointerArray< CKeyStoreIF >iKeyStoresHolder[private]

TInt iNewTimeout

TInt iNewTimeout[private]

TRequestStatus * iOriginalRequestStatus

TRequestStatus *iOriginalRequestStatus[private]

CPBEncryptParms * iPbeParams

CPBEncryptParms *iPbeParams[private]

TUid iRequestUid

TUid iRequestUid[private]

TState iState

TState iState[private]

MCTToken * iToken

MCTToken *iToken[private]

MCTTokenInterface * iTokenInterface

MCTTokenInterface *iTokenInterface[private]

MCTTokenType * iTokenType

MCTTokenType *iTokenType[private]

RCPointerArray< CCTTokenTypeInfo > iTokenTypes

RCPointerArray< CCTTokenTypeInfo >iTokenTypes[private]

RCPointerArray< HBufC > iTokens

RCPointerArray< HBufC >iTokens[private]