|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE task |
|
11 PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"> |
|
12 <task id="GUID-1733B4E1-3264-58DF-957B-F5C0AE1E0644" xml:lang="en"><title>Retrieving |
|
13 Keystores</title><shortdesc>This section explains how to retrieve keystore implementations. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody> |
|
14 <context><p>Keystores can be used in manager mode or user mode. In manager |
|
15 mode, modifications to an existing keystore can be performed through the <xref href="GUID-89FFDC49-F722-3A68-8601-C461AD2FBDF2.dita"><apiname>MCTKeyStoreManager</apiname></xref> interface. |
|
16 In user mode, a keystore can be viewed using the <xref href="GUID-2B3202F8-469D-3253-90E8-B553506AD47A.dita"><apiname>MCTKeyStore</apiname></xref> interface. </p><p> The |
|
17 following steps explain the process of retrieving keystores:</p> </context> |
|
18 <steps id="GUID-D16D66C2-BD90-584D-BD2E-0096D85A8C15"> |
|
19 <step id="GUID-EE9F9F53-52F2-59C3-A65D-0569ABECBCB2"><cmd/> |
|
20 <info>Create an object of type CUnifiedKeyStore using <xref href="GUID-818689D6-EB99-382E-A435-D9C6C5D464DE.dita#GUID-818689D6-EB99-382E-A435-D9C6C5D464DE/GUID-C7A96153-4179-3B3F-878D-1EAA64A98D39"><apiname>CUnifiedKeyStore::NewL()</apiname></xref> or <xref href="GUID-818689D6-EB99-382E-A435-D9C6C5D464DE.dita#GUID-818689D6-EB99-382E-A435-D9C6C5D464DE/GUID-217FBB3B-CEF5-36F2-A612-EDDA0982053C"><apiname>CUnifiedKeyStore::NewLC()</apiname></xref>. </info> |
|
21 </step> |
|
22 <step id="GUID-1CFCBA6B-7BAC-5994-BFB0-5AA63703BA06"><cmd/> |
|
23 <info>Initialise the member functions and keystore using the asynchronous |
|
24 function <xref href="GUID-818689D6-EB99-382E-A435-D9C6C5D464DE.dita#GUID-818689D6-EB99-382E-A435-D9C6C5D464DE/GUID-6C5D732C-1FD1-3EF0-AC90-87690F891B8D"><apiname>CUnifiedKeyStore::Initialize()</apiname></xref>. </info> |
|
25 </step> |
|
26 <step id="GUID-4E386CB7-118B-5E5D-AE61-A4911719E029"><cmd/> |
|
27 <info>Retrieve the keystore in either of the following modes. </info> |
|
28 <substeps id="GUID-019BBF0F-33B9-5A7D-B245-D65C2463F1B4"> |
|
29 <substep id="GUID-6B9577C5-15C8-50FC-B553-E9B8EB7BAC1E"><cmd/> |
|
30 <info>Read/write mode </info> |
|
31 <info>Use the <xref href="GUID-818689D6-EB99-382E-A435-D9C6C5D464DE.dita#GUID-818689D6-EB99-382E-A435-D9C6C5D464DE/GUID-AB8E29A7-8C56-3B54-A1F1-A1BB140F4DD3"><apiname>CUnifiedKeyStore::KeyStoreManager()</apiname></xref> function |
|
32 to get the required <xref href="GUID-89FFDC49-F722-3A68-8601-C461AD2FBDF2.dita"><apiname>MCTKeyStoreManager</apiname></xref> object using an |
|
33 appropriate index of the keystore. </info> |
|
34 </substep> |
|
35 <substep id="GUID-4A2D4A9C-BF5B-58AB-91B8-3703F9AE5F4D"><cmd/> |
|
36 <info>Read-only mode </info> |
|
37 <info>Use the <xref href="GUID-818689D6-EB99-382E-A435-D9C6C5D464DE.dita#GUID-818689D6-EB99-382E-A435-D9C6C5D464DE/GUID-534E9428-E03F-3C90-948E-9456365B1D67"><apiname>CUnifiedKeyStore::KeyStore()</apiname></xref> function to |
|
38 get the required <xref href="GUID-2B3202F8-469D-3253-90E8-B553506AD47A.dita"><apiname>MCTKeyStore</apiname></xref> object using an appropriate |
|
39 index of the keystore. </info> |
|
40 </substep> |
|
41 </substeps> |
|
42 </step> |
|
43 </steps> |
|
44 <result><p>Returns a keystore, which can be used to perform operations. </p><p>The |
|
45 following code snippet shows how to retrieve keystores in manager mode. </p> <codeblock id="GUID-E4C9D64F-F1DB-5C81-9574-5E0C149C4756" xml:space="preserve"> |
|
46 //Create a file system session object |
|
47 RFs iFs; |
|
48 CleanupClosePushL(&iFs); |
|
49 |
|
50 ... |
|
51 |
|
52 |
|
53 //Initialise the keystore and member functions |
|
54 CUnifiedKeyStore* keyStore = CUnifiedKeyStore::NewL(fs); |
|
55 keyStore->Initialize(iStatus); //iStatus is a TRequestStatus object |
|
56 |
|
57 ... |
|
58 |
|
59 |
|
60 //Retrieve the keystore present at the specified index |
|
61 //If the keystore index is invalid |
|
62 //or the specified keystore cannot be opened in manager mode |
|
63 //then the manager object is NULL |
|
64 |
|
65 MCTKeyStoreManager& manager = keyStore->KeyStoreManager(0); |
|
66 |
|
67 |
|
68 //Clean up |
|
69 CleanupStack::PopAndDestroy(); // iFs</codeblock> </result> |
|
70 </taskbody></task> |