diff -r 000000000000 -r 89d6a7a84779 Symbian3/SDK/Source/GUID-85EAD2EA-6ADB-5866-9784-5E2B30E661AF.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-85EAD2EA-6ADB-5866-9784-5E2B30E661AF.dita Thu Jan 21 18:18:20 2010 +0000 @@ -0,0 +1,88 @@ + + + + + +Deleting +Keys This section provides information on deleting keys. +

The unified keystore allows the deletion of any key. The following +steps explain the process of deleting a key:

+ + +Create a file system session using an RFs object. + + +Create an object of type CUnifiedKeyStore using CUnifiedKeyStore::NewL() or CUnifiedKeyStore::NewLC(). + + +Initialise the member functions and keystore using the asynchronous +function CUnifiedKeyStore::Initialize(). + + +Use the CUnifiedKeyStore::List() function to list +the keys of the keystore. Retrieve the handle of the key to be deleted. + +Use the CUnifiedKeyStore::DeleteKey() function +to delete the key. + + +

The selected key is deleted from the keystore.

+Example

The following code snippet shows how to +initialise the unified keystore, list the keys in a keystore, select a particular +key and delete it.

//Create a file system session object +RFs iFs; +CleanupClosePushL(&iFs); + + + +//Initialise the keystore and member functions +CUnifiedKeyStore* keyStore = CUnifiedKeyStore::NewL(iFs); +keyStore->Initialize(iStatus); //iStatus is a TRequestStatus object + + +//List the keys of the keystore +RPointerArray<CCTKeyInfo> iKeys; // This variable will contain the key for deletion +TCTKeyAttributeFilter filter.iUsage = EPKCS15UsageAll; +keyStore->List(iKeys, filter, iStatus); + + +... + + + +//Retrieve the handle of the key to be deleted +_LIT(KLabel,”keylabel”); + + + +//Select the key with the label you are looking for +for (TInt j = 0; j < iKeys.Count(); j++) + { + if (Keys[j]->Label() == KLabel) + { + keyIndex = j; + break; + } + } + + +... + + + +//Delete the selected key +keyStore->DeleteKey(*iKeys[keyIndex], iStatus); + + +//Clean up +CleanupStack::PopAndDestroy(); // iFs
+
+Unified Keystore + +
\ No newline at end of file