|
1 #ifndef __CONFIGWRITER_H__ |
|
2 #define __CONFIGWRITER_H__/* |
|
3 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 * All rights reserved. |
|
5 * This component and the accompanying materials are made available |
|
6 * under the terms of the License "Eclipse Public License v1.0" |
|
7 * which accompanies this distribution, and is available |
|
8 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
9 * |
|
10 * Initial Contributors: |
|
11 * Nokia Corporation - initial contribution. |
|
12 * |
|
13 * Contributors: |
|
14 * |
|
15 * Description: |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include <string> |
|
21 #include <fstream> |
|
22 #include <sstream> |
|
23 |
|
24 class GoodConfigWriter |
|
25 { |
|
26 public: |
|
27 GoodConfigWriter(const std::stringstream &aFileName); |
|
28 ~GoodConfigWriter(); |
|
29 std::ofstream iFile; |
|
30 }; |
|
31 |
|
32 class FileCertStoreConfigWriter : public GoodConfigWriter |
|
33 { |
|
34 public: |
|
35 FileCertStoreConfigWriter(const std::stringstream &aFileName); |
|
36 ~FileCertStoreConfigWriter(); |
|
37 |
|
38 void WriteFileEntry(const char *aGoodLabel= "\"Root5CA\"", |
|
39 const char *aGoodDeletable = "\"true\"", |
|
40 const char *aGoodFormat= "\"EX509Certificate\"", |
|
41 const char *aGoodCertOwnerType = "\"ECACertificate\"", |
|
42 const char *aGoodSubjectKeyId ="auto", |
|
43 const char *aGoodIssuerKeyId = "auto", |
|
44 const char *aGoodApplication = "\"SW Install\"", |
|
45 const char *aGoodTrusted = "\"true\"", |
|
46 const char *aGoodDataFileName = "\"cert0.der\""); |
|
47 void WriteExtraFileEntry(); |
|
48 |
|
49 private: |
|
50 int iEntryCount; |
|
51 }; |
|
52 |
|
53 class FileCertClientConfigWriter : public GoodConfigWriter |
|
54 { |
|
55 public: |
|
56 FileCertClientConfigWriter(const std::stringstream &aFileName); |
|
57 ~FileCertClientConfigWriter(); |
|
58 |
|
59 void WriteCertClientName(const char *arrayVal); |
|
60 void WriteCertClientUid(const char *arrayVal); |
|
61 void WriteExtraCertClientEntry(); |
|
62 private: |
|
63 int iEntryCount; |
|
64 }; |
|
65 |
|
66 |
|
67 class SwiCertStoreConfigWriter : public GoodConfigWriter |
|
68 { |
|
69 public: |
|
70 SwiCertStoreConfigWriter(const std::stringstream &aFileName); |
|
71 ~SwiCertStoreConfigWriter(); |
|
72 |
|
73 void WriteSwiEntry(const char *aGoodLabel= "\"certificate_Label\"", |
|
74 /*const char *aGoodDeletable = "\"true\"",*/ |
|
75 const char *aGoodFormat= "EX509Certificate", |
|
76 const char *aGoodCertOwnerType = "\"ECACertificate\"", |
|
77 const char *aGoodSubjectKeyId ="auto", |
|
78 const char *aGoodIssuerKeyId = "auto", |
|
79 const char *aGoodApplication = "\"SW Install\"", |
|
80 const char *aGoodTrusted = "\"true\"", |
|
81 const char *aGoodCapabilitySet = "TCB", |
|
82 const char *aGoodMandatory = "\"true\"", |
|
83 const char *aGoodSystemUpgrade = "\"true\""); |
|
84 void WriteExtraSwiEntry(); |
|
85 private: |
|
86 int iEntryCount; |
|
87 }; |
|
88 |
|
89 |
|
90 |
|
91 // to generate script files for the file certstore to run tests on emulator |
|
92 |
|
93 class FileStoreScriptGeneration : public GoodConfigWriter |
|
94 { |
|
95 public: |
|
96 FileStoreScriptGeneration(const std::stringstream &aFileName); |
|
97 ~FileStoreScriptGeneration(); |
|
98 |
|
99 void WriteInitialiseCert(const char *aMode); |
|
100 void WriteListcert(const char *aGoodOwnerType); |
|
101 void WriteGetCertificateDetails(const char *label); |
|
102 void WriteGetTrust(const char *label, const char *trust); |
|
103 void WriteGetApplications(const char *label); |
|
104 void WriteRetrieveCerts(const char *label); |
|
105 void WriteDetailsToArray(const char *array[]); |
|
106 |
|
107 private: |
|
108 int iCount; |
|
109 }; |
|
110 |
|
111 |
|
112 // to generate script files for the cert cleint store to run tests on emulator |
|
113 |
|
114 class CertClientsStoreScriptGeneration : public GoodConfigWriter |
|
115 { |
|
116 public: |
|
117 CertClientsStoreScriptGeneration(const std::stringstream &aFileName); |
|
118 ~CertClientsStoreScriptGeneration(); |
|
119 |
|
120 void WriteInitialiseCertClient(); |
|
121 void WriteGetCount(const int index); |
|
122 void WriteGetApplicationsList(); |
|
123 void WriteGetAppWithUid(const char *label, const char *uid); |
|
124 void WriteDestroyManager(); |
|
125 |
|
126 private: |
|
127 int iCount; |
|
128 }; |
|
129 |
|
130 |
|
131 // to generate script files for the swicertstore to run tests on emulator |
|
132 |
|
133 class SWIStoreScriptGeneration : public GoodConfigWriter |
|
134 { |
|
135 public: |
|
136 SWIStoreScriptGeneration(const std::stringstream &aFileName); |
|
137 ~SWIStoreScriptGeneration(); |
|
138 |
|
139 void WriteInitialiseCert(); |
|
140 void WriteListcert(const char *aGoodOwnerType); |
|
141 void WriteGetSystemUpgrade(const char *label , const char *aSystemUpgrade); |
|
142 void WriteGetCapabilities(const char *label); |
|
143 void WriteGetMandatoryFlag(const char *label, const char *aMandatory); |
|
144 void WriteGetTrust(const char *label, const char *trust); |
|
145 void WriteGetApplications(const char *label); |
|
146 void WriteRetrieveCerts(const char *label); |
|
147 void WriteDetailsToArray(const char *array[]); |
|
148 private: |
|
149 int iCount; |
|
150 }; |
|
151 |
|
152 class EmptyFileConfigWriter : public GoodConfigWriter |
|
153 { |
|
154 public: |
|
155 EmptyFileConfigWriter(const std::stringstream &aFileName); |
|
156 ~EmptyFileConfigWriter(); |
|
157 }; |
|
158 |
|
159 #endif |