securityanddataprivacytools/securitytools/certapp/encdec/filecertstore.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 06 Jul 2010 16:21:56 +0300
changeset 80 b4bf7a662141
parent 8 35751d3474b7
child 108 ca9a0fc2f082
permissions -rw-r--r--
Revision: 201027 Kit: 2010127
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
     1
/*
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
     2
* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
     3
* All rights reserved.
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
     4
* This component and the accompanying materials are made available
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
     6
* which accompanies this distribution, and is available
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
     8
*
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
     9
* Initial Contributors:
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    10
* Nokia Corporation - initial contribution.
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    11
*
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    12
* Contributors:
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    13
*
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    14
* Description: 
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    15
*
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    16
*/
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    17
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    18
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    19
#include "filecertstore.h"
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    20
#include "appuidmap.h"
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    21
#include "logger.h"
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    22
#include "stringconv.h"
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    23
#include "utils.h"
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    24
#include <iomanip>
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    25
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    26
EncDecContainerItem *AppUidListEntry::Factory()
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    27
{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    28
	return new AppUidListEntry(AppUidMap::EnumEntries());
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    29
}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    30
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    31
AppUidListEntry::AppUidListEntry(const EnumEntry *aEnumEntries)
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    32
	: EncDecContainerItem(), iUid("Application", aEnumEntries)
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    33
{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    34
}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    35
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    36
AppUidListEntry::~AppUidListEntry()
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    37
{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    38
}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    39
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    40
const char *AppUidListEntry::ItemType() const
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    41
{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    42
	return 0; // n/a
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    43
}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    44
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    45
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    46
void AppUidListEntry::Encode(REncodeWriteStream &aWriteStream)
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    47
{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    48
	aWriteStream << iUid;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    49
}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    50
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    51
void AppUidListEntry::Decode(RDecodeReadStream &aReadStream)
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    52
{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    53
	aReadStream >> iUid;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    54
}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    55
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    56
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    57
EncDecContainerItem *CertStoreEntry::Factory()
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    58
{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    59
	return new CertStoreEntry;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    60
}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    61
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    62
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    63
static const EnumEntry enumDetailsForTBool[] =
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    64
{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    65
    { "false", 0x00},
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    66
    { "true", 0x01},
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    67
    { "EFalse", false},
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    68
    { "ETrue", true},
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    69
	{ 0,0 }
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    70
};
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    71
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    72
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    73
CertStoreEntry::CertStoreEntry()
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    74
	: EncDecContainerItem(), 
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    75
	  iCertInfo(false),
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    76
	  iCertApps("ApplicationList", AppUidListEntry::Factory),
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    77
	  iTrusted("Trusted", enumDetailsForTBool), 
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    78
	  iReadDataStreamId("DataStreamId(read)", true),
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    79
	  iWriteDataStreamId("DataStreamId(write)", false),
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    80
	  iDataFileName("DataFileName"),
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    81
	  iCertData(),
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    82
	  iSwiMode(false)
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    83
{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    84
	// We only need to initialise EncDecObject members which wrap non-class types
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    85
	iReadDataStreamId.Value() = 0;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    86
	iWriteDataStreamId.Value() = 0;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    87
}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    88
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    89
CertStoreEntry::CertStoreEntry(bool aSwiMode)
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    90
	: EncDecContainerItem(), 
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    91
	  iCertInfo(aSwiMode),
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    92
	  iCertApps("ApplicationList", AppUidListEntry::Factory),
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    93
	  iTrusted("Trusted", enumDetailsForTBool), 
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    94
	  iReadDataStreamId("DataStreamId(read)", true),
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    95
	  iWriteDataStreamId("DataStreamId(write)", false),
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    96
	  iDataFileName("DataFileName"),
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    97
	  iCertData(),
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    98
	  iSwiMode(aSwiMode)
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    99
{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   100
	// We only need to initialise EncDecObject members which wrap non-class types
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   101
	iReadDataStreamId.Value() = 0;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   102
	iWriteDataStreamId.Value() = 0;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   103
}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   104
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   105
CertStoreEntry::~CertStoreEntry()
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   106
{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   107
}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   108
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   109
const TCertLabel &CertStoreEntry::Label() const
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   110
{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   111
	return iCertInfo.Label();
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   112
}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   113
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   114
CertInfo &CertStoreEntry::Info()
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   115
{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   116
	return iCertInfo;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   117
}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   118
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   119
const CertInfo &CertStoreEntry::Info() const
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   120
{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   121
	return iCertInfo;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   122
}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   123
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   124
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   125
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   126
const char *CertStoreEntry::ItemType() const
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   127
{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   128
	return "Entry";
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   129
}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   130
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   131
std::string CertStoreEntry::ItemName() const
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   132
{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   133
	return stringFromUtf16(Label());
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   134
}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   135
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   136
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   137
void CertStoreEntry::SetItemName(const std::string &aName)
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   138
{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   139
	TInt outputWords;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   140
	TText *outputBuf = utf16FromUtf8((const TUint8 *)aName.data(), aName.size(), outputWords);
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   141
	iCertInfo.Label() = TPtrC16(outputBuf, outputWords);
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   142
	delete [] outputBuf;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   143
}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   144
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   145
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   146
void CertStoreEntry::Encode(REncodeWriteStream &aWriteStream)
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   147
{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   148
	iCertInfo.Encode(aWriteStream);
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   149
	aWriteStream << iCertApps;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   150
	aWriteStream << iTrusted;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   151
	if(aWriteStream.HumanReadable())
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   152
		{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   153
		// Write data to a file
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   154
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   155
		// Generate a file name
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   156
		std::string certFileName = aWriteStream.CertFileName(iCertInfo.CertificateFormat(), iCertInfo.OutputCertificateId());
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   157
		iDataFileName.Value().Copy(TPtrC8((const TUint8*)certFileName.data(), certFileName.size()));
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   158
		
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   159
		// Write file name
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   160
		aWriteStream << iDataFileName;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   161
		
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   162
		std::fstream certDataFile;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   163
		OpenUtf8FStreamForWrite(certDataFile, certFileName.c_str());
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   164
		if(certDataFile.fail())
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   165
			{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   166
			dbg << Log::Indent() << "Failed to open '" << certDataFile << "' for output!" << Log::Endl();
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   167
			FatalError();
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   168
			}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   169
		if((iCertInfo.CertificateFormat() == EX509Certificate) && aWriteStream.PemOut())
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   170
			{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   171
			std::string pemCert;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   172
			Der2Pem(iCertData, pemCert);
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   173
			certDataFile.write(pemCert.data(), pemCert.size());
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   174
			}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   175
		else
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   176
			{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   177
			certDataFile.write(iCertData.data(), iCertData.size());
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   178
			}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   179
		
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   180
		certDataFile.close();
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   181
		if(certDataFile.fail())
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   182
			{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   183
			dbg << Log::Indent() << "Failed to write cert data to '" << certDataFile <<  Log::Endl();
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   184
			FatalError();
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   185
			}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   186
		aWriteStream << iReadDataStreamId;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   187
		}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   188
	else
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   189
		{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   190
		// Write to the store
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   191
		if(iCertData.size() != iCertInfo.CertSize())
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   192
			{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   193
			dbg << Log::Indent() << "Internal error - cert data size does not match meta data" << Log::Endl();
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   194
			FatalError();
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   195
			}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   196
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   197
		RStoreWriteStream dataStream;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   198
		TStreamId dataStreamId = dataStream.CreateLC(*aWriteStream.StoreObject());
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   199
		prog << Log::Indent() << "Created store stream " << dataStreamId << " for certificate data" << Log::Endl();
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   200
		iWriteDataStreamId.Value() = dataStreamId;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   201
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   202
		prog << Log::Indent() << "Writing " << iCertData.size() << " bytes of binary data" << Log::Endl();
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   203
		dataStream.WriteL((const TUint8 *)iCertData.data(), iCertData.size());
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   204
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   205
		CleanupStack::PopAndDestroy(&dataStream);
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   206
		aWriteStream << iWriteDataStreamId;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   207
		}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   208
}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   209
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   210
void CertStoreEntry::Decode(RDecodeReadStream &aReadStream)
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   211
{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   212
	iCertInfo.Decode(aReadStream);
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   213
	aReadStream >> iCertApps;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   214
	if((!aReadStream.HumanReadable()) ||
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   215
	   (aReadStream.PeakToken() == iTrusted.Name()))
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   216
		{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   217
		aReadStream >> iTrusted;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   218
		}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   219
	else
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   220
		{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   221
		iTrusted.SetValue(true);
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   222
		}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   223
	aReadStream >> iReadDataStreamId;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   224
	if(aReadStream.HumanReadable())
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   225
		{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   226
		aReadStream >> iDataFileName;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   227
		// Read data from the specified file
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   228
		std::string nFileName = stringFromUtf16(iDataFileName.Value());
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   229
		
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   230
		std::fstream certDataFile;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   231
		OpenUtf8FStreamForRead(certDataFile, nFileName.c_str());
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   232
		if(certDataFile.fail())
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   233
			{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   234
			dbg << Log::Indent() << "Failed to open '" << nFileName << "' for input!" << Log::Endl();
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   235
			FatalError();
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   236
			}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   237
		
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   238
		certDataFile.seekg(0, std::ios_base::end);
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   239
		TUint32 certSize = certDataFile.tellg();
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   240
		
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   241
		char *rawCertData = new char[certSize];
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   242
		
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   243
		certDataFile.seekg(0, std::ios_base::beg);
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   244
		certDataFile.read(rawCertData, certSize);
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   245
		
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   246
		certDataFile.close();
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   247
		if(certDataFile.fail())
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   248
			{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   249
			dbg << Log::Indent() << "Failed to read cert data from '" << certDataFile << Log::Endl();
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   250
			FatalError();
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   251
			}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   252
		iCertData.assign(rawCertData, certSize);
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   253
		delete [] rawCertData;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   254
		
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   255
		if(iCertInfo.CertificateFormat() == EX509Certificate)
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   256
			{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   257
			// It might be a PEM cert
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   258
			std::string derFromPem;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   259
			if(Pem2Der(iCertData, derFromPem))
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   260
				{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   261
				prog << Log::Indent() << "Converted PEM cert to DER" << Log::Endl();
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   262
				iCertData = derFromPem;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   263
				certSize = iCertData.size();
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   264
				}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   265
			}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   266
		iCertInfo.SetCertSize(certSize);
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   267
		}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   268
	else 
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   269
		{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   270
		// Read data from the store
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   271
		RStoreReadStream dataStream;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   272
		dataStream.OpenLC(*aReadStream.iStore, iReadDataStreamId.Value());
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   273
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   274
		TUint32 certSize = iCertInfo.CertSize();
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   275
		TUint8 * certData = new TUint8[certSize];
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   276
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   277
		prog << Log::Indent() << "Reading " << certSize << " byte certificate from store stream " << iReadDataStreamId.Value() << Log::Endl();
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   278
		
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   279
		dataStream.ReadL(certData, certSize);
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   280
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   281
		iCertData.assign((const char *)certData, certSize);
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   282
		
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   283
		CleanupStack::PopAndDestroy(&dataStream);
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   284
		}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   285
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   286
	if(iCertInfo.CertificateFormat() == EX509Certificate)
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   287
		{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   288
		TKeyIdentifier subjectKeyId;
80
b4bf7a662141 Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   289
		bool isCA = ( iCertInfo.CertificateOwnerType() != EUserCertificate );
b4bf7a662141 Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   290
8
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   291
		// nb. If processing a swicertstore we ignore any SubjectKeyId in the extension.
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   292
		if(X509SubjectKeyId((iSwiMode)?(KIgnoreCertificateExtension) : (KUseCertificateExtension), 
80
b4bf7a662141 Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 8
diff changeset
   293
							false, isCA,
8
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   294
							iCertData,
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   295
							iCertSubject, subjectKeyId))
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   296
			{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   297
			prog << Log::Indent() << "Subject = '" << iCertSubject << "'" << Log::Endl();
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   298
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   299
			prog << Log::Indent() << "Calculated SubjectKeyId is ";
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   300
			const TUint8 *p = subjectKeyId.Ptr();
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   301
			for(int i=0; i<subjectKeyId.Length(); ++i)
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   302
				{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   303
				if(i) prog << ":";
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   304
				prog.Stream() << std::setfill('0') << std::setw(2) << int(p[i]);
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   305
				}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   306
			prog.Stream() << std::setw(0);
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   307
			prog << Log::Endl();
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   308
			
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   309
			if(aReadStream.HumanReadable() && iCertInfo.SubjectKeyId().iAutoKey)
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   310
				{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   311
				// Reading config file and auto set so copy generated
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   312
				// SubjectKeyId to value.
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   313
				prog << Log::Indent() << "Field set to auto so using calculated SubjectKeyId" << Log::Endl();;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   314
				iCertInfo.SubjectKeyId().iHash = subjectKeyId;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   315
				}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   316
			else
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   317
				{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   318
				// If the read value matches the calculated value then
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   319
				// set iAutoKey so we dump it as auto (with the value
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   320
				// as a comment).
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   321
				if(iCertInfo.SubjectKeyId().iHash == subjectKeyId)
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   322
					{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   323
					prog << Log::Indent() << "Calculated SubjectKeyId matches value read from input so setting to auto" << Log::Endl();;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   324
					iCertInfo.SubjectKeyId().iAutoKey = true;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   325
					}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   326
				else
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   327
					{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   328
					prog << Log::Indent() << "Calculated SubjectKeyId does NOT match value read from input so setting to value read" << Log::Endl();;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   329
					}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   330
				
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   331
				}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   332
			}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   333
		}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   334
}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   335
	
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   336
CertStoreEntry& CertStoreEntry::operator= (const CertStoreEntry& aRhs)
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   337
{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   338
	if(this == &aRhs) return *this; // handle self assignment
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   339
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   340
	EncDecContainerItem::operator=(*static_cast<const EncDecContainerItem *>(&aRhs));
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   341
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   342
	iCertInfo = aRhs.iCertInfo;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   343
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   344
	iCertApps.reset();
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   345
	for(TUint32 i=0; i<aRhs.iCertApps.size(); ++i)
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   346
		{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   347
		AppUidListEntry *newApp = new AppUidListEntry(AppUidMap::EnumEntries());
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   348
		const AppUidListEntry *oldApp = static_cast<const AppUidListEntry *>(&aRhs.iCertApps[i]);
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   349
		*newApp = *oldApp;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   350
		iCertApps.push_back(newApp);
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   351
		}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   352
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   353
	iTrusted = aRhs.iTrusted;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   354
	iReadDataStreamId = aRhs.iReadDataStreamId;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   355
	iWriteDataStreamId = aRhs.iWriteDataStreamId;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   356
	iDataFileName = aRhs.iDataFileName;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   357
	iCertData = aRhs.iCertData;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   358
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   359
	iCertSubject = aRhs.iCertSubject;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   360
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   361
	iSwiMode = aRhs.iSwiMode;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   362
		
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   363
	return *this;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   364
}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   365
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   366
const TUint8 * CertStoreEntry::CertData() const
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   367
{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   368
	return (const TUint8 *)iCertData.data();
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   369
}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   370
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   371
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   372
const std::string &CertStoreEntry::CertSubject() const
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   373
{
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   374
	return iCertSubject;
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   375
}
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   376
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   377
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   378
35751d3474b7 Revision: 200935
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   379
// End of file