os/security/securityanddataprivacytools/securitytools/certapp/test/tcertapp/goodconfigwriter.h
First public contribution.
1 #ifndef __CONFIGWRITER_H__
2 #define __CONFIGWRITER_H__/*
3 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
10 * Initial Contributors:
11 * Nokia Corporation - initial contribution.
24 class GoodConfigWriter
27 GoodConfigWriter(const std::stringstream &aFileName);
32 class FileCertStoreConfigWriter : public GoodConfigWriter
35 FileCertStoreConfigWriter(const std::stringstream &aFileName);
36 ~FileCertStoreConfigWriter();
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();
53 class FileCertClientConfigWriter : public GoodConfigWriter
56 FileCertClientConfigWriter(const std::stringstream &aFileName);
57 ~FileCertClientConfigWriter();
59 void WriteCertClientName(const char *arrayVal);
60 void WriteCertClientUid(const char *arrayVal);
61 void WriteExtraCertClientEntry();
67 class SwiCertStoreConfigWriter : public GoodConfigWriter
70 SwiCertStoreConfigWriter(const std::stringstream &aFileName);
71 ~SwiCertStoreConfigWriter();
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();
90 // to generate script and ini files to run tests on emulator
92 class ScriptAndIniGeneration : public GoodConfigWriter
95 ScriptAndIniGeneration(const std::stringstream &aFileName);
96 ~ScriptAndIniGeneration();
98 void WriteTestCaseToScript(const std::stringstream &aTestCaseType, int &aTestIndex, const char *aTestActionName, const char *aTestActionType, bool aHasActionBody = true);
101 std::ofstream iIniFile;
102 std::string iIniFileName;
106 // to generate script files for the file certstore to run tests on emulator
108 class FileStoreScriptGeneration : public ScriptAndIniGeneration
111 FileStoreScriptGeneration(const std::stringstream &aFileName);
112 ~FileStoreScriptGeneration();
114 void WriteInitialiseCert(const char *aMode, const std::stringstream &aTestCaseType, int &aTestIndex);
115 void WriteListcert(const char *aGoodOwnerType, const std::stringstream &aTestCaseType, int &aTestIndex);
116 void WriteGetCertificateDetails(const char *label, const std::stringstream &aTestCaseType, int &aTestIndex);
117 void WriteGetTrust(const char *label, const char *trust, const std::stringstream &aTestCaseType, int &aTestIndex);
118 void WriteGetApplications(const char *label, const std::stringstream &aTestCaseType, int &aTestIndex);
119 void WriteRetrieveCerts(const char *label, const std::stringstream &aTestCaseType, int &aTestIndex);
123 // to generate script files for the cert cleint store to run tests on emulator
125 class CertClientsStoreScriptGeneration : public ScriptAndIniGeneration
128 CertClientsStoreScriptGeneration(const std::stringstream &aFileName);
129 ~CertClientsStoreScriptGeneration();
131 void WriteInitialiseCertClient(const std::stringstream &aTestCaseType, int &aTestIndex);
132 void WriteGetCount(const int index, const std::stringstream &aTestCaseType, int &aTestIndex);
133 void WriteGetApplicationsList(const std::stringstream &aTestCaseType, int &aTestIndex);
134 void WriteGetAppWithUid(const char *label, const char *uid, const std::stringstream &aTestCaseType, int &aTestIndex);
135 void WriteDestroyManager(const std::stringstream &aTestCaseType, int &aTestIndex);
139 // to generate script files for the swicertstore to run tests on emulator
141 class SWIStoreScriptGeneration : public ScriptAndIniGeneration
144 SWIStoreScriptGeneration(const std::stringstream &aFileName);
145 ~SWIStoreScriptGeneration();
147 void WriteInitialiseCert(const std::stringstream &aTestCaseType, int &aTestIndex);
148 void WriteListcert(const char *aGoodOwnerType, const std::stringstream &aTestCaseType, int &aTestIndex);
149 void WriteGetSystemUpgrade(const char *label , const char *aSystemUpgrade, const std::stringstream &aTestCaseType, int &aTestIndex);
150 void WriteGetCapabilities(const char *label, const std::stringstream &aTestCaseType, int &aTestIndex);
151 void WriteGetMandatoryFlag(const char *label, const char *aMandatory, const std::stringstream &aTestCaseType, int &aTestIndex);
152 void WriteGetTrust(const char *label, const char *trust, const std::stringstream &aTestCaseType, int &aTestIndex);
153 void WriteGetApplications(const char *label, const std::stringstream &aTestCaseType, int &aTestIndex);
154 void WriteRetrieveCerts(const char *label, const std::stringstream &aTestCaseType, int &aTestIndex);
157 class EmptyFileConfigWriter : public GoodConfigWriter
160 EmptyFileConfigWriter(const std::stringstream &aFileName);
161 ~EmptyFileConfigWriter();