diff -r 43e37759235e -r 51a74ef9ed63 Symbian3/SDK/Source/GUID-98B0A83B-0064-598E-BE88-84305CA6A4F1.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-98B0A83B-0064-598E-BE88-84305CA6A4F1.dita Wed Mar 31 11:11:55 2010 +0100 @@ -0,0 +1,97 @@ + + + + + +Finding +KeysYou can find a specific set of keys using the unified +keystore. This section explains the process of finding keys.

The +unified keystore allows you to search all keys on a device regardless of which +keystore they are in.

You can specify a filter object that determines +which keys are returned. The criteria by which you can filter the keys are +as follows: + + + +Filter Criteria +Description + + +The key identifier +Used when searching for a particular key. + + +The key usage +Used when searching for a key usage, for example encryption. + + +The key owner UID +Used when searching for a key owner.

Applications must use this to +prevent them seeing insecure keys that might have been added by a malicious +application.

+
+ +The key algorithm +Used when searching for a particular key algorithm, for example RSA. + + + +

+

The following steps explain the process of finding keys in a keystore:

+ +Create a file system +session using an RFs object. + +Create an object +of type CUnifiedKeyStore using CUnifiedKeyStore::NewL() or CUnifiedKeyStore::NewLC(). + +Initialize the member +functions and keystore using the asynchronous function CUnifiedKeyStore::Initialize(). + +Specify a filter +object corresponding to the type of keys that are to be returned. + +Use the CUnifiedKeyStore::List() +function to list the filtered keys. + + +

Keys are listed based on the specified filter criteria.

+Example

The following code snippet shows how to +set a file system session object, initialize the keystore and its member functions, +specify filter criteria for the types of keys to be listed, and then list +the specific set of keys.

+ +//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 + + +//Specify the filter criteria +RPointerArray<CCTKeyInfo> iKeys; // This variable will contain the keys found +TCTKeyAttributeFilter filter; +filter.iOwner = KApplicationUID; // The UID of the key owner application +filter.iUsage = EPKCS15UsageSign; +filter.iKeyAlgorithm = CCTKeyInfo::EDSA; + + +//List keys based on specified filter criteria +iKeyStore->List(iKeys, filter, iStatus); + + +//Clean up +CleanupStack::PopAndDestroy(); // iFs
+
+Unified Keystore + +
\ No newline at end of file