Symbian3/PDK/Source/GUID-36BCDD1F-3713-5DF0-8D8A-CF093694B636-GENID-1-12-1-26-1-1-9-1-12-1-7-1.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 16 Jul 2010 17:23:46 +0100
changeset 12 80ef3a206772
permissions -rw-r--r--
Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
     1
<?xml version="1.0" encoding="utf-8"?>
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
     2
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
     3
<!-- This component and the accompanying materials are made available under the terms of the License 
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
     4
"Eclipse Public License v1.0" which accompanies this distribution, 
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
     5
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
     6
<!-- Initial Contributors:
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
     7
    Nokia Corporation - initial contribution.
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
     8
Contributors: 
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
     9
-->
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    10
<!DOCTYPE concept
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    11
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    12
<concept xml:lang="en" id="GUID-36BCDD1F-3713-5DF0-8D8A-CF093694B636-GENID-1-12-1-26-1-1-9-1-12-1-7-1"><title>Secure store encryption example code</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>This example covers: </p> <ul><li id="GUID-C08CC80E-FDF5-54FB-A289-2D1C4B4AD982-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-2-1"><p> <xref href="GUID-36BCDD1F-3713-5DF0-8D8A-CF093694B636-GENID-1-12-1-26-1-1-9-1-12-1-7-1.dita#GUID-36BCDD1F-3713-5DF0-8D8A-CF093694B636-GENID-1-12-1-26-1-1-9-1-12-1-7-1/GUID-3CE75F7F-B812-5010-99E6-50416C207B41-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-5">Creating and opening a new secure store protected by the supplied password</xref>  </p> </li> <li id="GUID-67FA0BEE-6BC5-5F49-9CD8-9B81CD25894C-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-2-2"><p> <xref href="GUID-36BCDD1F-3713-5DF0-8D8A-CF093694B636-GENID-1-12-1-26-1-1-9-1-12-1-7-1.dita#GUID-36BCDD1F-3713-5DF0-8D8A-CF093694B636-GENID-1-12-1-26-1-1-9-1-12-1-7-1/GUID-58FD2C9E-80E8-5F88-AF83-DC0022FE92E7-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-6">Opening an existing secure store</xref>  </p> </li> <li id="GUID-F3D2DF1D-A547-594C-BCB8-8BADD69D980D-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-2-3"><p> <xref href="GUID-36BCDD1F-3713-5DF0-8D8A-CF093694B636-GENID-1-12-1-26-1-1-9-1-12-1-7-1.dita#GUID-36BCDD1F-3713-5DF0-8D8A-CF093694B636-GENID-1-12-1-26-1-1-9-1-12-1-7-1/GUID-6C8BF1E2-E824-539D-A57F-DED436C24C88-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-7">Writing some data to a new stream in the currently opened store, and returning the ID of the stream</xref>  </p> </li> <li id="GUID-1B9A3CB6-6ADB-508F-8563-03E17BD7BB02-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-2-4"><p> <xref href="GUID-36BCDD1F-3713-5DF0-8D8A-CF093694B636-GENID-1-12-1-26-1-1-9-1-12-1-7-1.dita#GUID-36BCDD1F-3713-5DF0-8D8A-CF093694B636-GENID-1-12-1-26-1-1-9-1-12-1-7-1/GUID-A6AF8D9B-6A03-5CA4-BC0E-0296FBC10EDD-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-8">Reading the data in a given stream from the currently opened store</xref>  </p> </li> <li id="GUID-51A035CA-16CD-5547-828A-049E3FD20D5B-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-2-5"><p> <xref href="GUID-36BCDD1F-3713-5DF0-8D8A-CF093694B636-GENID-1-12-1-26-1-1-9-1-12-1-7-1.dita#GUID-36BCDD1F-3713-5DF0-8D8A-CF093694B636-GENID-1-12-1-26-1-1-9-1-12-1-7-1/GUID-2C2E3C02-8F9D-5FA6-8ACA-1CDBA8EA11A9-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-9">Closing the currently opened store</xref>  </p> </li> <li id="GUID-1E71B260-5C38-51C7-B535-4A3C6EE210AF-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-2-6"><p> <xref href="GUID-36BCDD1F-3713-5DF0-8D8A-CF093694B636-GENID-1-12-1-26-1-1-9-1-12-1-7-1.dita#GUID-36BCDD1F-3713-5DF0-8D8A-CF093694B636-GENID-1-12-1-26-1-1-9-1-12-1-7-1/GUID-4ABE3513-0B3D-5F17-8F1B-CDA12C5DE370-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-10">Changing the password for the currently opened store.</xref>  </p> </li> </ul> <p>Also, see: </p> <ul><li id="GUID-96A01360-DFA8-5FC3-97CD-6B2013756CBC-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-4-1"><p> <xref href="GUID-3385079E-84F4-534F-B937-BD3A568D71BC-GENID-1-12-1-26-1-1-9-1-12-1-3-1.dita">PBE example code</xref>  </p> </li> <li id="GUID-2E08A91C-C02C-5DF6-8051-7209E48FDA02-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-4-2"><p> <xref href="GUID-598B6698-3518-50CA-98DE-D85CB255BA2D-GENID-1-12-1-26-1-1-9-1-12-1-5-1.dita">Secure stream example code</xref>  </p> </li> </ul> <section id="GUID-3CE75F7F-B812-5010-99E6-50416C207B41-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-5"><title>Creating and opening a new secure store protected by the supplied password</title> <ul><li id="GUID-913C5F07-E786-546A-90F6-D26019A52C96-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-5-2-1"><p> <xref href="GUID-7D53E323-CF8D-5C4D-ABCD-4D95C7A4A5B5-GENID-1-12-1-26-1-1-9-1-12-1-8-1.dita">Supporting code for this example</xref>  </p> </li> </ul> <codeblock id="GUID-0BBC7516-B37F-5A01-9853-DFD7B490C931-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-5-3" xml:space="preserve">
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    13
void CSecureStoreExample::CreateNewStoreL(const TDesC&amp; aPassword)
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    14
         {
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    15
         // Check store is not already open
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    16
         ASSERT(!iEncryptSet &amp;&amp; !iSecureStore &amp;&amp; !iFileStore);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    17
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    18
         // Create a standard file store
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    19
         iFileStore = CPermanentFileStore::ReplaceL(iFs, iFilename, EFileRead | EFileWrite | EFileShareExclusive);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    20
         iFileStore-&gt;SetTypeL(KPermanentFileStoreLayoutUid);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    21
         
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    22
         // Create a CPBEncryptSet object (because a store is comprised of multiple
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    23
         // independent objects)
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    24
         TPBPassword password(aPassword);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    25
         iEncryptSet = CPBEncryptSet::NewL(password, ECipherDES_CBC);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    26
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    27
         // Write encryption data and encrypted master key to the root stream of the
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    28
         // store.  We need to store both of these pieces of information to be able
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    29
         // to access the secure store at a later time.
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    30
         RStoreWriteStream writeStream;
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    31
         TStreamId rootId = writeStream.CreateLC(*iFileStore);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    32
         writeStream &lt;&lt; iEncryptSet-&gt;EncryptionData();
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    33
         writeStream &lt;&lt; iEncryptSet-&gt;EncryptedMasterKey();
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    34
         writeStream.CommitL();
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    35
         CleanupStack::PopAndDestroy(&amp;writeStream);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    36
         iFileStore-&gt;SetRootL(rootId);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    37
         iFileStore-&gt;CommitL();
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    38
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    39
         // Create the secure store - this wraps the file store providing transparent
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    40
         // encryption/decryption of streams.
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    41
         iSecureStore = CSecureStore::NewL(*iFileStore, *iEncryptSet);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    42
         }
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    43
            </codeblock> </section> <section id="GUID-58FD2C9E-80E8-5F88-AF83-DC0022FE92E7-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-6"><title>Opening an existing secure store</title> <ul><li id="GUID-9B07EB34-D2C1-53FF-8338-3F18A235ADC5-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-6-2-1"><p> <xref href="GUID-7D53E323-CF8D-5C4D-ABCD-4D95C7A4A5B5-GENID-1-12-1-26-1-1-9-1-12-1-8-1.dita">Supporting code for this example</xref>  </p> </li> </ul> <codeblock id="GUID-6EDC3451-A2DF-537F-BF71-1A4925462790-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-6-3" xml:space="preserve">
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    44
// Leaves with KErrBadPassphrase if the password is 
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    45
// not the same as the one used when creating the store.
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    46
void CSecureStoreExample::OpenExistingStoreL(const TDesC&amp; aPassword)
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    47
         {
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    48
         // Check store is not already open
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    49
         ASSERT(!iEncryptSet &amp;&amp; !iSecureStore &amp;&amp; !iFileStore);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    50
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    51
         // Open a standard file store
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    52
         iFileStore = CPermanentFileStore::OpenL(iFs, iFilename, EFileRead | EFileWrite | EFileShareExclusive);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    53
         
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    54
         // Read the encryption data and encrypted master key from the root stream
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    55
         TStreamId rootId = iFileStore-&gt;Root();
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    56
         RStoreReadStream readStream;
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    57
         readStream.OpenLC(*iFileStore, rootId);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    58
         CPBEncryptionData* encryptionData = CPBEncryptionData::NewLC(readStream);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    59
         HBufC8* encryptedMasterKey = HBufC8::NewLC(readStream, KMaxTInt);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    60
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    61
         // Use these to recreate the CPBEncryptSet object (this leaves if
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    62
         // aPassword is wrong)
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    63
         iEncryptSet = CPBEncryptSet::NewL(*encryptionData, *encryptedMasterKey, aPassword);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    64
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    65
         // Create the secure store
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    66
         iSecureStore = CSecureStore::NewL(*iFileStore, *iEncryptSet);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    67
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    68
         // Free memory
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    69
         CleanupStack::PopAndDestroy(3, &amp;readStream);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    70
         }
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    71
            </codeblock> </section> <section id="GUID-6C8BF1E2-E824-539D-A57F-DED436C24C88-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-7"><title>Writing some data to a new stream in the currently opened store, and returning the ID of the stream</title> <ul><li id="GUID-1FF9BA5F-296F-5AF7-9737-A95B9059061E-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-7-2-1"><p> <xref href="GUID-7D53E323-CF8D-5C4D-ABCD-4D95C7A4A5B5-GENID-1-12-1-26-1-1-9-1-12-1-8-1.dita">Supporting code for this example</xref>  </p> </li> </ul> <codeblock id="GUID-F8539B5E-197A-5FAF-B908-4EAD26BA2A6A-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-7-3" xml:space="preserve">
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    72
TStreamId CSecureStoreExample::WriteEncryptedDataL(const TDesC8&amp; aInput)
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    73
         {
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    74
         // Check store is open
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    75
         ASSERT(iEncryptSet &amp;&amp; iSecureStore &amp;&amp; iFileStore);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    76
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    77
         // Create a new stream in the store 
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    78
         RStoreWriteStream writeStream;
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    79
         TStreamId newStreamId = writeStream.CreateLC(*iSecureStore);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    80
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    81
         // Write data - this is automatically encrypted
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    82
         writeStream &lt;&lt; aInput;
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    83
         writeStream.CommitL();
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    84
         iSecureStore-&gt;CommitL();
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    85
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    86
         CleanupStack::PopAndDestroy(&amp;writeStream);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    87
         return newStreamId;
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    88
         }
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    89
            </codeblock> </section> <section id="GUID-A6AF8D9B-6A03-5CA4-BC0E-0296FBC10EDD-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-8"><title>Reading the data in a given stream from the currently opened store</title> <ul><li id="GUID-8F696865-A038-5649-ACCF-030A482C5C3A-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-8-2-1"><p> <xref href="GUID-7D53E323-CF8D-5C4D-ABCD-4D95C7A4A5B5-GENID-1-12-1-26-1-1-9-1-12-1-8-1.dita">Supporting code for this example</xref>  </p> </li> </ul> <codeblock id="GUID-DC1CABBD-2D1A-5A94-B28E-73C9F94A579E-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-8-3" xml:space="preserve">
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    90
HBufC8* CSecureStoreExample::ReadEncryptedDataLC(TStreamId aStreamId)
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    91
         {
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    92
         // Check store is open
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    93
         ASSERT(iEncryptSet &amp;&amp; iSecureStore &amp;&amp; iFileStore);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    94
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    95
         // Open an existing stream in the store
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    96
         RStoreReadStream readStream;
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    97
         readStream.OpenLC(*iSecureStore, aStreamId);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    98
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
    99
         // Read data - this is automatically decrypted
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   100
         HBufC8* output = HBufC8::NewL(readStream, KMaxTInt);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   101
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   102
         CleanupStack::PopAndDestroy(&amp;readStream);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   103
         CleanupStack::PushL(output);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   104
         return output;
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   105
         }
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   106
            </codeblock> </section> <section id="GUID-2C2E3C02-8F9D-5FA6-8ACA-1CDBA8EA11A9-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-9"><title>Closing the currently opened store</title> <ul><li id="GUID-6C2360BE-435D-5350-8149-AAF679A441D7-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-9-2-1"><p> <xref href="GUID-7D53E323-CF8D-5C4D-ABCD-4D95C7A4A5B5-GENID-1-12-1-26-1-1-9-1-12-1-8-1.dita">Supporting code for this example</xref>  </p> </li> </ul> <codeblock id="GUID-253A7771-4030-5393-83B9-10D4538A0CC6-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-9-3" xml:space="preserve">
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   107
void CSecureStoreExample::CloseStore()
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   108
         {
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   109
         delete iSecureStore;
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   110
         iSecureStore = NULL;
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   111
         delete iEncryptSet;
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   112
         iEncryptSet = NULL;
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   113
         delete iFileStore;
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   114
         iFileStore = NULL;
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   115
         }
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   116
            </codeblock> </section> <section id="GUID-4ABE3513-0B3D-5F17-8F1B-CDA12C5DE370-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-10"><title>Changing the password for the currently opened store</title> <ul><li id="GUID-DFBC3396-7564-5647-8B6C-525F46FA6512-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-10-2-1"><p> <xref href="GUID-7D53E323-CF8D-5C4D-ABCD-4D95C7A4A5B5-GENID-1-12-1-26-1-1-9-1-12-1-8-1.dita">Supporting code for this example</xref>  </p> </li> </ul> <codeblock id="GUID-D7A38D85-EAC1-579F-8ECB-F7420A21E519-GENID-1-12-1-26-1-1-9-1-12-1-7-1-2-10-3" xml:space="preserve">
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   117
void CSecureStoreExample::ChangePasswordL(const TDesC&amp; aNewPassword)
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   118
         {
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   119
         // Check store is open
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   120
         ASSERT(iEncryptSet &amp;&amp; iSecureStore &amp;&amp; iFileStore);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   121
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   122
         // Change password on encrypt set object
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   123
         iEncryptSet-&gt;ChangePasswordL(aNewPassword);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   124
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   125
         // Must now rewrite data in root stream
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   126
         TStreamId rootId = iFileStore-&gt;Root();
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   127
         RStoreWriteStream writeStream;
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   128
         writeStream.ReplaceLC(*iFileStore, rootId);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   129
         writeStream &lt;&lt; iEncryptSet-&gt;EncryptionData();
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   130
         writeStream &lt;&lt; iEncryptSet-&gt;EncryptedMasterKey();
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   131
         writeStream.CommitL();
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   132
         iFileStore-&gt;CommitL();
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   133
         
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   134
         CleanupStack::PopAndDestroy(&amp;writeStream);
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   135
         }
80ef3a206772 Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.
Dominic Pinkman <dominic.pinkman@nokia.com>
parents:
diff changeset
   136
            </codeblock> </section> </conbody></concept>