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.
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 &) |
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 |
IMPORT_C | ~CUnifiedKeyStore | ( | ) |
The destructor destroys all the resources owned by this object.
IMPORT_C void | CancelCreateKey | ( | ) |
Cancels an ongoing CreateKey() operation.
The operation completes with KErrCancel.
IMPORT_C void | CancelDeleteKey | ( | ) |
Cancels an ongoing DeleteKey() operation.
The operation completes with KErrCancel.
IMPORT_C void | CancelExportEncryptedKey | ( | ) |
Cancels an ongoing ExportEncryptedKey() operation.
The operation completes with KErrCancel.
IMPORT_C void | CancelExportKey | ( | ) |
Cancels an ongoing ExportKey() operation.
The operation completes with KErrCancel.
IMPORT_C void | CancelImportKey | ( | ) |
Cancels an ongoing ImportKey() operation.
The operation completes with KErrCancel.
IMPORT_C void | CancelInitialize | ( | ) |
Cancels an ongoing Initialize() operation.
The operation completes with KErrCancel.
void | CancelOutstandingRequest | ( | ) | [private] |
Cancel the outstanding request.
IMPORT_C void | CancelRelock | ( | ) |
Cancels an ongoing Relock() operation.
The operation completes with KErrCancel.
IMPORT_C void | CancelSetManagementPolicy | ( | ) |
Cancels an ongoing SetManagementPolicy() operation.
The operation completes with KErrCancel.
IMPORT_C void | CancelSetPassphraseTimeout | ( | ) |
Cancels an ongoing SetPassphraseTimeout() operation.
The operation completes with KErrCancel.
IMPORT_C void | CancelSetUsePolicy | ( | ) |
Cancels an ongoing SetUsePolicy() operation.
The operation completes with KErrCancel.
void | Complete | ( | TInt | aError | ) | [private] |
Complete the user's request and clean up state.
TInt aError |
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().
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. |
IMPORT_C void | DeleteKey | ( | TCTTokenObjectHandle | aHandle, |
TRequestStatus & | aStatus | |||
) |
Deletes a key.
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. |
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() .
TBool | DoOpen | ( | const TCTTokenObjectHandle & | aHandle, |
TRequestStatus & | aStatus | |||
) | [private] |
const TCTTokenObjectHandle & aHandle | |
TRequestStatus & aStatus |
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.
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. |
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.
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. |
void | ExportPublic | ( | const TCTTokenObjectHandle & | aHandle, |
HBufC8 *& | aPublicKey, | |||
TRequestStatus & | aStatus | |||
) | [virtual] |
const TCTTokenObjectHandle & aHandle | |
HBufC8 *& aPublicKey | |
TRequestStatus & aStatus |
MCTKeyStore * | FindKeyStore | ( | const TCTTokenObjectHandle & | aHandle | ) | [private] |
A synchronous method to find the key store given a token object handle. Returns NULL if none found.
const TCTTokenObjectHandle & aHandle |
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.
const TCTTokenObjectHandle & aHandle |
void | GetKeyInfo | ( | TCTTokenObjectHandle | aHandle, |
CCTKeyInfo *& | aInfo, | |||
TRequestStatus & | aStatus | |||
) | [virtual] |
TCTTokenObjectHandle aHandle | |
CCTKeyInfo *& aInfo | |
TRequestStatus & aStatus |
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.
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. |
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.
TRequestStatus & aStatus | The request status object; contains the result of the Initialize() request when complete. Set to KErrCancel if any outstanding request is cancelled. |
IMPORT_C MCTKeyStore & | KeyStore | ( | TInt | aIndex | ) |
Gets a read-only interface to a key store.
TInt aIndex | An ordinal number that identifies the key store. |
IMPORT_C TInt | KeyStoreCount | ( | ) | const |
Gets the number of available read-only key stores.
IMPORT_C MCTKeyStoreManager & | KeyStoreManager | ( | TInt | aIndex | ) |
Gets a read-write interface to the store specified by aIndex.
TInt aIndex | An ordinal number that identifies the key store. |
IMPORT_C TInt | KeyStoreManagerCount | ( | ) | const |
Gets the number of available read-write key stores.
void | List | ( | RMPointerArray < CCTKeyInfo > & | aKeys, |
const TCTKeyAttributeFilter & | aFilter, | |||
TRequestStatus & | aStatus | |||
) | [virtual] |
RMPointerArray < CCTKeyInfo > & aKeys | |
const TCTKeyAttributeFilter & aFilter | |
TRequestStatus & aStatus |
IMPORT_C CUnifiedKeyStore * | NewL | ( | RFs & | aFs | ) | [static] |
Creates a new CUnifiedKeyStore object.
RFs & aFs | A file server session. It must already be open. |
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.
RFs & aFs | A file server session. It must already be open. |
void | Open | ( | const TCTTokenObjectHandle & | aHandle, |
MRSASigner *& | aSigner, | |||
TRequestStatus & | aStatus | |||
) | [virtual] |
const TCTTokenObjectHandle & aHandle | |
MRSASigner *& aSigner | |
TRequestStatus & aStatus |
void | Open | ( | const TCTTokenObjectHandle & | aHandle, |
MDSASigner *& | aSigner, | |||
TRequestStatus & | aStatus | |||
) | [virtual] |
const TCTTokenObjectHandle & aHandle | |
MDSASigner *& aSigner | |
TRequestStatus & aStatus |
void | Open | ( | const TCTTokenObjectHandle & | aHandle, |
MCTDecryptor *& | aDecryptor, | |||
TRequestStatus & | aStatus | |||
) | [virtual] |
const TCTTokenObjectHandle & aHandle | |
MCTDecryptor *& aDecryptor | |
TRequestStatus & aStatus |
void | Open | ( | const TCTTokenObjectHandle & | aHandle, |
MCTDH *& | aDH, | |||
TRequestStatus & | aStatus | |||
) | [virtual] |
const TCTTokenObjectHandle & aHandle | |
MCTDH *& aDH | |
TRequestStatus & aStatus |
void | PrepareToCreateKeyL | ( | TInt | aKeyStoreIndex, |
TKeyUsagePKCS15 | aUsage, | |||
TUint | aSize, | |||
const TDesC & | aLabel, | |||
CCTKeyInfo::EKeyAlgorithm | aAlgorithm, | |||
TInt | aAccessType, | |||
TTime | aStartDate, | |||
TTime | aEndDate, | |||
TRequestStatus & | aStatus | |||
) | [private] |
TInt aKeyStoreIndex | |
TKeyUsagePKCS15 aUsage | |
TUint aSize | |
const TDesC & aLabel | |
CCTKeyInfo::EKeyAlgorithm aAlgorithm | |
TInt aAccessType | |
TTime aStartDate | |
TTime aEndDate | |
TRequestStatus & aStatus |
IMPORT_C void | Relock | ( | TRequestStatus & | aStatus | ) |
Re-locks the entire store (i.e., forget the passphrase).
TRequestStatus & aStatus | The request status object; contains the result of the Relock() request when complete. Set to KErrCancel if any outstanding request is cancelled. |
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
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.
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. |
IMPORT_C void | SetPassphraseTimeout | ( | TInt | aTimeout, |
TRequestStatus & | aStatus | |||
) |
Sets the passphrase timeout for all keys owned by this process.
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. |
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.
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. |
void | StartAsyncOperation | ( | TState | aState, |
TRequestStatus & | aStatus | |||
) | [private] |
TState aState | |
TRequestStatus & aStatus |
EIdle | |
EInitializeGetTokenList | |
EInitializeGetToken | |
EInitialiseGetKeyManagerInterface | |
EInitializeGetKeyUserInterface | |
EInitializeGetKeyUserInterfaceFinished | |
EInitializeFinished | |
EList | |
EGetKeyInfo | |
EOpen | |
ECreateKey | |
EImportKey | |
EImportKeyEncrypted | |
EExportKey | |
EExportEncryptedKey | |
EExportPublic | |
EDeleteKey | |
ESetUsePolicy | |
ESetManagementPolicy | |
ESetPassphraseTimeout | |
ERelock | |
ESetAuthenticationPolicy | |
EGetAuthenticationPolicy |
RPointerArray < CKeyStoreIF > | iKeyStoresHolder | [private] |
RCPointerArray < CCTTokenTypeInfo > | iTokenTypes | [private] |
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.