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 void CancelCreateKey ()
IMPORT_C void CancelDeleteKey ()
IMPORT_C void CancelExportEncryptedKey ()
IMPORT_C void CancelExportKey ()
void CancelExportPublic ()
void CancelGetKeyInfo ()
IMPORT_C void CancelImportKey ()
IMPORT_C void CancelInitialize ()
void CancelList ()
void CancelOpen ()
IMPORT_C void CancelRelock ()
IMPORT_C void CancelSetManagementPolicy ()
IMPORT_C void CancelSetPassphraseTimeout ()
IMPORT_C void CancelSetUsePolicy ()
IMPORT_C void CreateKey ( TInt , TKeyUsagePKCS15 , TUint , const TDesC &, CCTKeyInfo::EKeyAlgorithm , TInt , TTime , TTime , CCTKeyInfo *&, TRequestStatus &)
IMPORT_C void DeleteKey ( TCTTokenObjectHandle , TRequestStatus &)
IMPORT_C void ExportEncryptedKey ( TCTTokenObjectHandle , const CPBEncryptParms &, HBufC8 *&, TRequestStatus &)
IMPORT_C void ExportKey ( TCTTokenObjectHandle , HBufC8 *&, TRequestStatus &)
void ExportPublic (const TCTTokenObjectHandle &, HBufC8 *&, TRequestStatus &)
void GetKeyInfo ( TCTTokenObjectHandle , CCTKeyInfo *&, TRequestStatus &)
IMPORT_C void ImportKey ( TInt , const TDesC8 &, TKeyUsagePKCS15 , const TDesC &, TInt , TTime , TTime , CCTKeyInfo *&, TRequestStatus &)
IMPORT_C void Initialize ( TRequestStatus &)
IMPORT_C MCTKeyStore & KeyStore ( TInt )
IMPORT_C TInt KeyStoreCount ()
IMPORT_C MCTKeyStoreManager & KeyStoreManager ( TInt )
IMPORT_C TInt KeyStoreManagerCount ()
void List ( RMPointerArray < CCTKeyInfo > &, const TCTKeyAttributeFilter &, TRequestStatus &)
IMPORT_C CUnifiedKeyStore * NewL ( RFs &)
IMPORT_C CUnifiedKeyStore * NewLC ( RFs &)
void Open (const TCTTokenObjectHandle &, MRSASigner *&, TRequestStatus &)
void Open (const TCTTokenObjectHandle &, MDSASigner *&, TRequestStatus &)
void Open (const TCTTokenObjectHandle &, MCTDecryptor *&, TRequestStatus &)
void Open (const TCTTokenObjectHandle &, MCTDH *&, TRequestStatus &)
IMPORT_C void Relock ( TRequestStatus &)
IMPORT_C void SetManagementPolicy ( TCTTokenObjectHandle , const TSecurityPolicy &, TRequestStatus &)
IMPORT_C void SetPassphraseTimeout ( TInt , TRequestStatus &)
IMPORT_C void SetUsePolicy ( TCTTokenObjectHandle , const TSecurityPolicy &, TRequestStatus &)
Private Member Functions
CUnifiedKeyStore ( RFs &)
void CancelOutstandingRequest ()
void Cleanup ()
void Complete ( TInt )
void ConstructL ()
void DoCancel ()
void DoInitializeL ()
TBool DoOpen (const TCTTokenObjectHandle &, TRequestStatus &)
MCTKeyStore * FindKeyStore (const TCTTokenObjectHandle &)
MCTKeyStoreManager * FindKeyStoreManager (const TCTTokenObjectHandle &)
void PrepareToCreateKeyL ( TInt , TKeyUsagePKCS15 , TUint , const TDesC &, CCTKeyInfo::EKeyAlgorithm , TInt , TTime , TTime , TRequestStatus &)
TInt RunError ( TInt )
void RunL ()
void StartAsyncOperation ( 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
enum TState {
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 void CancelCreateKey ( )

Cancels an ongoing CreateKey() operation.

The operation completes with KErrCancel.

CancelDeleteKey()

IMPORT_C void CancelDeleteKey ( )

Cancels an ongoing DeleteKey() operation.

The operation completes with KErrCancel.

CancelExportEncryptedKey()

IMPORT_C void CancelExportEncryptedKey ( )

Cancels an ongoing ExportEncryptedKey() operation.

The operation completes with KErrCancel.

CancelExportKey()

IMPORT_C void CancelExportKey ( )

Cancels an ongoing ExportKey() operation.

The operation completes with KErrCancel.

CancelExportPublic()

void CancelExportPublic ( ) [virtual]

CancelGetKeyInfo()

void CancelGetKeyInfo ( ) [virtual]

CancelImportKey()

IMPORT_C void CancelImportKey ( )

Cancels an ongoing ImportKey() operation.

The operation completes with KErrCancel.

CancelInitialize()

IMPORT_C void CancelInitialize ( )

Cancels an ongoing Initialize() operation.

The operation completes with KErrCancel.

CancelList()

void CancelList ( ) [virtual]

CancelOpen()

void CancelOpen ( ) [virtual]

CancelOutstandingRequest()

void CancelOutstandingRequest ( ) [private]

Cancel the outstanding request.

CancelRelock()

IMPORT_C void CancelRelock ( )

Cancels an ongoing Relock() operation.

The operation completes with KErrCancel.

CancelSetManagementPolicy()

IMPORT_C void CancelSetManagementPolicy ( )

Cancels an ongoing SetManagementPolicy() operation.

The operation completes with KErrCancel.

CancelSetPassphraseTimeout()

IMPORT_C void CancelSetPassphraseTimeout ( )

Cancels an ongoing SetPassphraseTimeout() operation.

The operation completes with KErrCancel.

CancelSetUsePolicy()

IMPORT_C void CancelSetUsePolicy ( )

Cancels an ongoing SetUsePolicy() operation.

The operation completes with KErrCancel.

Cleanup()

void Cleanup ( ) [private]

Clean up state.

Complete(TInt)

void Complete ( TInt aError ) [private]

Complete the user's request and clean up state.

Parameters

TInt aError

ConstructL()

void ConstructL ( ) [private]

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

IMPORT_C void CreateKey ( TInt aKeyStoreIndex,
TKeyUsagePKCS15 aUsage,
TUint aSize,
const TDesC & aLabel,
CCTKeyInfo::EKeyAlgorithm aAlgorithm,
TInt aAccessType,
TTime aStartDate,
TTime aEndDate,
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 aKeyStoreIndex The index of the key store manager in which to create the key. Must be between zero and KeyStoreMangerCount() exclusive.
TKeyUsagePKCS15 aUsage The key usage flags in the PKCS#15 format.
TUint aSize The size of the key in bits.
const TDesC & aLabel A textual label for the key.
CCTKeyInfo::EKeyAlgorithm aAlgorithm The type of key.
TInt aAccessType The 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 aStartDate The start of the validity period.
TTime aEndDate The end of the validity period.
CCTKeyInfo *& aKeyInfoOut A pointer that is set to a newly created key info object on successful completion.
TRequestStatus & aStatus The 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 void DeleteKey ( TCTTokenObjectHandle aHandle,
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 aHandle The handle of the key to delete
TRequestStatus & aStatus The request status object; contains the result of the DeleteKey() request when complete. Set to KErrCancel if any outstanding request is cancelled.

DoCancel()

void DoCancel ( ) [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()

void DoInitializeL ( ) [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 void ExportEncryptedKey ( TCTTokenObjectHandle aHandle,
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 aHandle The handle of the key to export
const CPBEncryptParms & aEncryptParams
HBufC8 *& aKey A reference to a HBufC8 pointer. The pointer will be set to a newly allocated buffer containing the key data.
TRequestStatus & aStatus The 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 void ExportKey ( TCTTokenObjectHandle aHandle,
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 aHandle The handle of the key to export
HBufC8 *& aKey A 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 & aStatus The 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 &)

void ExportPublic ( 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 &)

void GetKeyInfo ( TCTTokenObjectHandle aHandle,
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 void ImportKey ( TInt aKeyStoreIndex,
const TDesC8 & aKeyData,
TKeyUsagePKCS15 aUsage,
const TDesC & aLabel,
TInt aAccessType,
TTime aStartDate,
TTime aEndDate,
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 aKeyStoreIndex The index of the key store manager in which to create the key. Must be between zero and KeyStoreMangerCount() exclusive.
const TDesC8 & aKeyData The key data to import, ASN.1 DER encoded PKCS#8.
TKeyUsagePKCS15 aUsage The key usage flags in the PKCS#15 format.
const TDesC & aLabel A textual label for the key.
TInt aAccessType The 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 aStartDate The start of the validity period.
TTime aEndDate The end of the validity period.
CCTKeyInfo *& aKeyInfoOut A pointer that is set to a newly created key info object on successful completion.
TRequestStatus & aStatus The 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 void Initialize ( 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 & aStatus The 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 ( TInt aIndex )

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 aIndex An ordinal number that identifies the key store.

KeyStoreCount()

IMPORT_C TInt KeyStoreCount ( ) const

Gets the number of available read-only key stores.

KeyStoreManager(TInt)

IMPORT_C MCTKeyStoreManager & KeyStoreManager ( TInt aIndex )

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 aIndex An ordinal number that identifies the key store.

KeyStoreManagerCount()

IMPORT_C TInt KeyStoreManagerCount ( ) const

Gets the number of available read-write key stores.

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

void List ( 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 & aFs A 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 & aFs A file server session. It must already be open.

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

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

Parameters

const TCTTokenObjectHandle & aHandle
MRSASigner *& aSigner
TRequestStatus & aStatus

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

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

Parameters

const TCTTokenObjectHandle & aHandle
MDSASigner *& aSigner
TRequestStatus & aStatus

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

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

Parameters

const TCTTokenObjectHandle & aHandle
MCTDecryptor *& aDecryptor
TRequestStatus & aStatus

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

void Open ( 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 &)

void PrepareToCreateKeyL ( TInt aKeyStoreIndex,
TKeyUsagePKCS15 aUsage,
TUint aSize,
const TDesC & aLabel,
CCTKeyInfo::EKeyAlgorithm aAlgorithm,
TInt aAccessType,
TTime aStartDate,
TTime aEndDate,
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 void Relock ( TRequestStatus & aStatus )

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

Parameters

TRequestStatus & aStatus The 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 ( TInt aError ) [private, virtual]

Parameters

TInt aError

RunL()

void RunL ( ) [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 void SetManagementPolicy ( TCTTokenObjectHandle aHandle,
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 aHandle The handle of the key
const TSecurityPolicy & aPolicy The new security policy.
TRequestStatus & aStatus The 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 void SetPassphraseTimeout ( TInt aTimeout,
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 aTimeout The timeout in seconds. 0 means that the passphrase is always asked for, and -1 means that it is never expired
TRequestStatus & aStatus The 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 void SetUsePolicy ( TCTTokenObjectHandle aHandle,
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 aHandle The handle of the key
const TSecurityPolicy & aPolicy The new security policy.
TRequestStatus & aStatus The request status object; contains the result of the SetUsePolicy() request when complete. Set to KErrCancel if any outstanding request is cancelled.

StartAsyncOperation(TState, TRequestStatus &)

void StartAsyncOperation ( TState aState,
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]