Symbian3/PDK/Source/GUID-85EAD2EA-6ADB-5866-9784-5E2B30E661AF.dita
changeset 1 25a17d01db0c
child 3 46218c8b8afa
equal deleted inserted replaced
0:89d6a7a84779 1:25a17d01db0c
       
     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-85EAD2EA-6ADB-5866-9784-5E2B30E661AF" xml:lang="en"><title>Deleting
       
    13 Keys </title><shortdesc>This section provides information on deleting keys. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody>
       
    14 <context><p>The unified keystore allows the deletion of any key. The following
       
    15 steps explain the process of deleting a key: </p></context>
       
    16 <steps id="GUID-AFEDFA3B-FA51-5BF8-87A5-7E5DCD3C8D95">
       
    17 <step id="GUID-42688893-8588-5CF6-8F6C-959AA0495222"><cmd/>
       
    18 <info>Create a file system session using an <xref href="GUID-E263C747-946F-35AA-9F1D-41833BD350FC.dita"><apiname>RFs</apiname></xref> object. </info>
       
    19 </step>
       
    20 <step id="GUID-CAE0DEDF-139F-52C3-9D3A-A2BD14CFA621"><cmd/>
       
    21 <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>
       
    22 </step>
       
    23 <step id="GUID-4F4C4296-50F5-593F-AA89-8FA043FA9908"><cmd/>
       
    24 <info>Initialise the member functions and keystore using the asynchronous
       
    25 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>
       
    26 </step>
       
    27 <step id="GUID-19E5AAF5-1402-51F9-AE95-0970F286EF1C"><cmd/>
       
    28 <info>Use the <xref href="GUID-818689D6-EB99-382E-A435-D9C6C5D464DE.dita#GUID-818689D6-EB99-382E-A435-D9C6C5D464DE/GUID-8B22E1BC-D779-32DC-9C0A-CA37E4C0A81B"><apiname>CUnifiedKeyStore::List()</apiname></xref> function to list
       
    29 the keys of the keystore. Retrieve the handle of the key to be deleted. </info>
       
    30 </step>
       
    31 <step id="GUID-435FCA01-D219-5BE3-B425-B4530F4C7F36"><cmd>Use the <codeph>CUnifiedKeyStore::DeleteKey()</codeph> function
       
    32 to delete the key. </cmd>
       
    33 </step>
       
    34 </steps>
       
    35 <result><p>The selected key is deleted from the keystore. </p> </result>
       
    36 <example><title>Example</title> <p>The following code snippet shows how to
       
    37 initialise the unified keystore, list the keys in a keystore, select a particular
       
    38 key and delete it. </p> <codeblock id="GUID-C18C5FBD-400F-5DFB-8E02-916F5C8C11FA" xml:space="preserve">//Create a file system session object
       
    39 RFs iFs;
       
    40 CleanupClosePushL(&amp;iFs);
       
    41 
       
    42 
       
    43 
       
    44 //Initialise the keystore and member functions
       
    45 CUnifiedKeyStore* keyStore = CUnifiedKeyStore::NewL(iFs);
       
    46 keyStore-&gt;Initialize(iStatus); //iStatus is a TRequestStatus object
       
    47 
       
    48 
       
    49 //List the keys of the keystore
       
    50 RPointerArray&lt;CCTKeyInfo&gt; iKeys; // This variable will contain the key for deletion
       
    51 TCTKeyAttributeFilter  filter.iUsage = EPKCS15UsageAll;
       
    52 keyStore-&gt;List(iKeys, filter, iStatus);
       
    53 
       
    54 
       
    55 ...
       
    56 
       
    57 
       
    58 
       
    59 //Retrieve the handle of the key to be deleted
       
    60 _LIT(KLabel,”keylabel”);
       
    61 
       
    62 
       
    63 
       
    64 //Select the key with the label you are looking for
       
    65 for (TInt j = 0; j &lt; iKeys.Count(); j++)
       
    66     {
       
    67     if (Keys[j]-&gt;Label() == KLabel) 
       
    68         {
       
    69          keyIndex = j;
       
    70          break;
       
    71         }
       
    72     }
       
    73 
       
    74 
       
    75 ...
       
    76 
       
    77 
       
    78 
       
    79 //Delete the selected key
       
    80 keyStore-&gt;DeleteKey(*iKeys[keyIndex], iStatus);
       
    81 
       
    82 
       
    83 //Clean up
       
    84 CleanupStack::PopAndDestroy(); // iFs</codeblock> </example>
       
    85 </taskbody><related-links>
       
    86 <link href="GUID-C4389D60-2A8D-532D-9D92-E57B0CCD14CF.dita"><linktext>Unified Keystore</linktext>
       
    87 </link>
       
    88 </related-links></task>