diff -r 675a964f4eb5 -r 35751d3474b7 securityanddataprivacytools/securitytools/certapp/test/tcertapp/goodconfigwriter.cpp --- a/securityanddataprivacytools/securitytools/certapp/test/tcertapp/goodconfigwriter.cpp Tue Jul 21 01:04:32 2009 +0100 +++ b/securityanddataprivacytools/securitytools/certapp/test/tcertapp/goodconfigwriter.cpp Thu Sep 10 14:01:51 2009 +0300 @@ -1,693 +1,634 @@ -/* -* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#include "goodconfigwriter.h" -#include -#include -#include "tcertapp_good.h" - -// Array for the StatCA- holds all relevant details -const char *swicertemu_array[]= - { - "X509", - "c7014670ad9c8ac296c2ae665c4e78f3d4df4a99" - }; - -const char *cert_array[]= - { - "X509", - "ca", - "7ce306295116207214d425affd185b6d5e48af6f", - "", - "1" - }; - -// uids required for cacerts -const char *emu_cacertsUid[]= - { - "268452523", - "268478646" - }; - - -/** -Class required to create files to write data -*/ -GoodConfigWriter::GoodConfigWriter(const std::stringstream &aFileName) -{ - std::string name = aFileName.str(); - iFile.open(name.c_str(), std::ios_base::trunc | std::ios_base::out); - if(iFile.fail()) - { - std::cout << "Failed to open '" << name.c_str()<< "' for output!" << std::endl; - exit(-1); - } -} - -GoodConfigWriter::~GoodConfigWriter() -{ - iFile.close(); -} - -/** -Class definition for creating cacerts config files -*/ -FileCertStoreConfigWriter::FileCertStoreConfigWriter(const std::stringstream &aFileName) - : GoodConfigWriter(aFileName), iEntryCount(0) -{ - iFile << "StartCertStoreEntries" << std::endl; -} - -FileCertStoreConfigWriter::~FileCertStoreConfigWriter() -{ - iFile << "EndCertStoreEntries" << std::endl; -} - -void FileCertStoreConfigWriter::WriteExtraFileEntry() -{ - iFile << "\tStartEntry " << "\"AugmentData\"" << std::endl; - iFile << "\t\tDeletable " << "\"true\"" << std::endl; - iFile << "\t\tFormat " << "\"EX509Certificate\"" << std::endl; - iFile << "\t\tCertOwnerType " << "\"ECACertificate\"" << std::endl; - iFile << "\t\tSubjectKeyId " << "auto" << std::endl; - iFile << "\t\tIssuerKeyId " << "auto" << std::endl; - iFile << "\t\tStartApplicationList" << std::endl; - iFile << "\t\t\t#Entry 1" << std::endl; - iFile << "\t\t\t\tApplication " << "\"0x100042ab\"" << std::endl; - iFile << "\t\t\t\tApplication " << "\"0x1000a8b6\"" << std::endl; - iFile << "\t\tEndApplicationList" << std::endl; - iFile << "\t\tTrusted " << "\"true\"" << std::endl; - iFile << "\t\tDataFileName " << "\"cert0.der\"" << std::endl; - iFile <<"\tEndEntry" <"<" << "Initializing a CUnifiedCertStore" <<""<< std::endl; - iFile << "\t" << "init" <<""<< std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" <"<< std::endl; - iFile << "\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" << "KErrNone" << "" << std::endl; - iFile << "\t" << std::endl; - iFile <<""<"<" << "Get the list of certificates" <<""<< std::endl; - iFile << "\t" << "listcert" <<""<< std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" << std::endl; - iFile << "\t\t\t" << aGoodOwnerType << "" << std::endl; - iFile << "\t\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" <<"KErrNone"<< "" << std::endl; - for(int z =0; z<6; z++) - { - iFile << "\t\t" <" << std::endl; - iFile <<""<"<" << "Get the list of certificates" <<""<< std::endl; - iFile << "\t" << "listcert" <<""<< std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" << std::endl; - iFile << "\t\t\t" <" <" << std::endl; - iFile <<""<" << array[i++] << "" << std::endl; - iFile << "\t\t\t" << array[i++] << "" << std::endl; - iFile << "\t\t\t" << array[i++]<< "" << std::endl; - iFile << "\t\t\t" <" << std::endl; - iFile << "\t\t\t" << array[i++] << "" << std::endl; - iFile << "\t\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" <<"KErrNone"<< "" << std::endl; - } - - -void FileStoreScriptGeneration::WriteGetTrust(const char *label, const char *trust) -{ - iFile << "# TEST" << iCount++ << std::endl; - iFile <<""<" << "Get Trust certificate" <<""<< std::endl; - iFile << "\t" << "gettrusters" <<""<< std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" <<"KErrNone"<< "" << std::endl; - iFile << "\t\t\t" << trust << "" <" << std::endl; - iFile <<""<"<" << "Get applications" <<""<< std::endl; - iFile << "\t" << "getapplications" <<""<< std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" <<"KErrNone"<< "" << std::endl; - iFile << "\t\t\t"; - - for(int j = 0; j<2; j++) - { - iFile << emu_cacertsUid[j]<<" "; - } - iFile <<""<" << std::endl; - iFile <<""<"<" << "Retrieve Certificate" <<""<< std::endl; - iFile << "\t" << "retrieve" <<""<< std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" <<"KErrNone"<< "" << std::endl; - iFile << "\t" << std::endl; - iFile <<""<"<" << "Initialise a SWICertStore" <<""<< std::endl; - iFile << "\t" << "initswicertstore" <<""<< std::endl; - iFile << "\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" << "KErrNone" << "" << std::endl; - iFile << "\t" << std::endl; - iFile <<""<"<" << "Get the list of certificates" <<""<< std::endl; - iFile << "\t" << "listcert" <<""<< std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" << std::endl; - iFile << "\t\t\t" << aGoodOwnerType << "" << std::endl; - iFile << "\t\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" <<"KErrNone"<< "" << std::endl; - for(int i =0; i<6; i++) - { - iFile << "\t\tTrue" <" << std::endl; - iFile <<""<" << array[i++] << "" << std::endl; - iFile << "\t\t\t" << array[i++]<< "" << std::endl; - iFile << "\t\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" <<"KErrNone"<< "" << std::endl; - } - -void SWIStoreScriptGeneration::WriteGetSystemUpgrade(const char *label, const char *aSystemUpgrade) -{ - iFile << "# TEST" << iCount++ << std::endl; - iFile <<""<" << "Get the systemupgrade flag" <<""<< std::endl; - iFile << "\t" << "getsystemupgrade" <<""<< std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" <<"KErrNone"<< "" << std::endl; - iFile << "\t\t" << aSystemUpgrade <<"" << std::endl; - iFile << "\t" << std::endl; - iFile <<""<"<" << "Retrieve Certificate" <<""<< std::endl; - iFile << "\t" << "retrieve" <<""<< std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" <<"KErrNone"<< "" << std::endl; - iFile << "\t" << std::endl; - iFile <<""<"<" << "Get applications" <<""<< std::endl; - iFile << "\t" << "getapplications" <<""<< std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" <<"KErrNone"<< "" << std::endl; - - iFile << "\t\t\t"; - for(int j = 0; j<2; j++) - { - iFile << emu_cacertsUid[j] << " "; - } - iFile <<""<" << std::endl; - iFile <<""<"<" << "Get Trust certificate" <<""<< std::endl; - iFile << "\t" << "gettrusters" <<""<< std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" <<"KErrNone"<< "" << std::endl; - iFile << "\t\t\t" << trust << "" <" << std::endl; - iFile <<""<"<" << "Get the capabilities" <<""<< std::endl; - iFile << "\t" << "getcapabilities" <<""<< std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" <<"KErrNone"<< "" << std::endl; - - for(int i=0; i<20; i++) - { - iFile << "\t\t" << goodCapabilitySets[i] <<"" << std::endl; - } - iFile << "\t" << std::endl; - iFile <<""<"<" << "Get the mandatory flag" <<""<< std::endl; - iFile << "\t" << "getmandatory" <<""<< std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" <<"KErrNone"<< "" << std::endl; - iFile << "\t\t" << aMandatory <<"" << std::endl; - iFile << "\t" << std::endl; - iFile <<""<"<" << "Initialise a CertClientStore" <<""<< std::endl; - iFile << "\t" << "InitManager" <<""<< std::endl; - iFile << "\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" << "KErrNone" << "" << std::endl; - iFile << "\t" << std::endl; - iFile <<""<"<" << "Get Count of Applications" <<""<< std::endl; - iFile << "\t" << "AppCount" <<""<< std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" << aApp_uidIndex << "" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" <<"KErrNone"<< "" << std::endl; - iFile << "\t" << std::endl; - iFile <<""<"<" << "Getting the application list" <<""<< std::endl; - iFile << "\t" << "GetApplications" <<""<< std::endl; - iFile << "\t" << std::endl; - for(int i = 0 ; i<4 ; i++) - { - iFile << "\t\t" << gooddecimalUid_array[i] << ""<<"" << goodcertclient_array[i] << "" << std::endl; - } - iFile << "\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" <<"KErrNone"<< "" << std::endl; - iFile << "\t" << std::endl; - iFile <<""<"<" << "Get application with given id" <<""<< std::endl; - iFile << "\t" << "GetApp" <<""<< std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" << uid << ""<< std::endl; - iFile << "\t\t" << goodlabel << "" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" <<"KErrNone"<< "" << std::endl; - iFile << "\t" << std::endl; - iFile <<""<"<" << "Destroy the manager" <<""<< std::endl; - iFile << "\t" << "DestroyManager" <<""<< std::endl; - iFile << "\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t" << std::endl; - iFile << "\t\t" << "KErrNone" << "" << std::endl; - iFile << "\t" << std::endl; - iFile <<""< +#include +#include +#include "tcertapp_good.h" + +// Array for the StatCA- holds all relevant details +const char *swicertemu_array[]= + { + "X509", + "c7014670ad9c8ac296c2ae665c4e78f3d4df4a99" + }; + +const char *cert_array[]= + { + "X509", + "ca", + "7ce306295116207214d425affd185b6d5e48af6f", + "", + "1" + }; + +// uids required for cacerts +const char *emu_cacertsUid[]= + { + "268452523", + "268478646" + }; + + +/** +Class required to create files to write data +*/ +GoodConfigWriter::GoodConfigWriter(const std::stringstream &aFileName) +{ + std::string name = aFileName.str(); + iFile.open(name.c_str(), std::ios_base::trunc | std::ios_base::out); + if(iFile.fail()) + { + std::cout << "Failed to open '" << name.c_str()<< "' for output!" << std::endl; + exit(-1); + } +} + +GoodConfigWriter::~GoodConfigWriter() +{ + iFile.close(); +} + +/** +Class definition for creating cacerts config files +*/ +FileCertStoreConfigWriter::FileCertStoreConfigWriter(const std::stringstream &aFileName) + : GoodConfigWriter(aFileName), iEntryCount(0) +{ + iFile << "StartCertStoreEntries" << std::endl; +} + +FileCertStoreConfigWriter::~FileCertStoreConfigWriter() +{ + iFile << "EndCertStoreEntries" << std::endl; +} + +void FileCertStoreConfigWriter::WriteExtraFileEntry() +{ + iFile << "\tStartEntry " << "\"AugmentData\"" << std::endl; + iFile << "\t\tDeletable " << "\"true\"" << std::endl; + iFile << "\t\tFormat " << "\"EX509Certificate\"" << std::endl; + iFile << "\t\tCertOwnerType " << "\"ECACertificate\"" << std::endl; + iFile << "\t\tSubjectKeyId " << "auto" << std::endl; + iFile << "\t\tIssuerKeyId " << "auto" << std::endl; + iFile << "\t\tStartApplicationList" << std::endl; + iFile << "\t\t\t#Entry 1" << std::endl; + iFile << "\t\t\t\tApplication " << "\"0x100042ab\"" << std::endl; + iFile << "\t\t\t\tApplication " << "\"0x1000a8b6\"" << std::endl; + iFile << "\t\tEndApplicationList" << std::endl; + iFile << "\t\tTrusted " << "\"true\"" << std::endl; + iFile << "\t\tDataFileName " << "\"cert0.der\"" << std::endl; + iFile <<"\tEndEntry" <=0) + { + iIniFileName = aFileName.str().substr(0,last_dot); + iIniFileName.append(".ini"); + iIniFile.open(iIniFileName.c_str(), std::ios_base::trunc | std::ios_base::out); + if(iIniFile.fail()) + { + std::cout << "Failed to open '" << iIniFileName.c_str()<< "' for output!" << std::endl; + exit(-1); + } + } +} + +ScriptAndIniGeneration::~ScriptAndIniGeneration() +{ + iIniFile.close(); +} + +void ScriptAndIniGeneration::WriteTestCaseToScript(const std::stringstream &aTestCaseType,int &aTestIndex,const char *aTestActionName,const char *aTestActionType,bool aHasActionBody) +{ + // set test case ID string + char testCaseIndexBuffer[6]; + sprintf(testCaseIndexBuffer, "-%04d", aTestIndex); + + iFile << "START_TESTCASE " << aTestCaseType.str() << testCaseIndexBuffer << std::endl; + iFile << "//! @SYMTestCaseID " << aTestCaseType.str() << testCaseIndexBuffer << std::endl; + iFile << "//! @SYMTestCaseDesc " << aTestActionName << std::endl; + iFile << "RUN_TEST_STEP -1\tCTestHandler\t" << aTestActionType; + if(aHasActionBody) + { + iFile << "\t" << iIniFileName << "\t" << aTestCaseType.str() << testCaseIndexBuffer << "-001"; + iIniFile << "[" << aTestCaseType.str() << testCaseIndexBuffer << "-001" << "]" << std::endl; + } + iFile << std::endl; + iFile << "END_TESTCASE " << aTestCaseType.str() << testCaseIndexBuffer << std::endl; + iFile << std::endl; +} + + +FileStoreScriptGeneration::FileStoreScriptGeneration(const std::stringstream &aFileName) + : ScriptAndIniGeneration(aFileName) +{ + +} + +FileStoreScriptGeneration::~FileStoreScriptGeneration() +{ +} + +void FileStoreScriptGeneration:: WriteInitialiseCert(const char *aMode, const std::stringstream &aTestCaseType, int &aTestIndex) +{ + const char *testcasename = "Initializing a CUnifiedCertStore"; + const char *testcasetype = "init"; + WriteTestCaseToScript(aTestCaseType, ++aTestIndex, testcasename, testcasetype); + iIniFile << "" << std::endl; + iIniFile << "\t" << aMode << "" << std::endl; + iIniFile << "" << std::endl; + iIniFile << std::endl; +} + + + +void FileStoreScriptGeneration::WriteListcert(const char *aGoodOwnerType, const std::stringstream &aTestCaseType, int &aTestIndex) +{ + const char *testcasename = "Get the list of certificates"; + const char *testcasetype = "listcert"; + WriteTestCaseToScript(aTestCaseType, ++aTestIndex, testcasename, testcasetype); + iIniFile << "" << std::endl; + iIniFile << "\t" << std::endl; + iIniFile << "\t\t" << aGoodOwnerType << "" << std::endl; + iIniFile << "\t" << std::endl; + iIniFile << "" << std::endl; + iIniFile << "" << std::endl; + for(int z =0; z<6; z++) + { + iIniFile << "\t" << std::endl; + } + iIniFile << "" << std::endl; + iIniFile << std::endl; +} + +void FileStoreScriptGeneration::WriteGetCertificateDetails(const char *label, const std::stringstream &aTestCaseType, int &aTestIndex) +{ + const char *testcasename = "Get certificate details"; + const char *testcasetype = "listcert"; + WriteTestCaseToScript(aTestCaseType, ++aTestIndex, testcasename, testcasetype); + int i = 0; + iIniFile << "" << std::endl; + iIniFile << "\t" << std::endl; + iIniFile << "\t\t" << std::endl; + iIniFile << "\t\t" << cert_array[i++]<< "" << std::endl; + iIniFile << "\t\t" << cert_array[i++] << "" << std::endl; + iIniFile << "\t\t" << cert_array[i++] << "" << std::endl; + iIniFile << "\t\t" <" << std::endl; + iIniFile << "\t\t" << cert_array[i++] << "" << std::endl; + iIniFile << "\t" << std::endl; + iIniFile << "" << std::endl; + iIniFile << "" << std::endl; + iIniFile << "\t" << std::endl; + iIniFile << "" << std::endl; + iIniFile << std::endl; +} + + +void FileStoreScriptGeneration::WriteGetTrust(const char *label, const char *trust, const std::stringstream &aTestCaseType, int &aTestIndex) +{ + const char *testcasename = "Get Trust certificate"; + const char *testcasetype = "gettrusters"; + WriteTestCaseToScript(aTestCaseType, ++aTestIndex, testcasename, testcasetype); + iIniFile << "" << std::endl; + iIniFile << "\t" << std::endl; + iIniFile << "" << std::endl; + iIniFile << "" << std::endl; + iIniFile << "\t" << trust << "" << std::endl; + iIniFile << "" << std::endl; + iIniFile << std::endl; +} + + +void FileStoreScriptGeneration::WriteGetApplications(const char *label, const std::stringstream &aTestCaseType, int &aTestIndex) +{ + const char *testcasename = "Get applications"; + const char *testcasetype = "getapplications"; + WriteTestCaseToScript(aTestCaseType, ++aTestIndex, testcasename, testcasetype); + iIniFile << "" << std::endl; + iIniFile << "\t" << std::endl; + iIniFile << "" << std::endl; + iIniFile << "" << std::endl; + iIniFile << "\t"; + for(int j = 0; j<2; j++) + { + iIniFile << emu_cacertsUid[j] << " "; + } + iIniFile << "" << std::endl; + iIniFile << "" << std::endl; + iIniFile << std::endl; +} + + +void FileStoreScriptGeneration::WriteRetrieveCerts(const char *label, const std::stringstream &aTestCaseType, int &aTestIndex) +{ + const char *testcasename = "Retrieve Certificate"; + const char *testcasetype = "retrieve"; + WriteTestCaseToScript(aTestCaseType, ++aTestIndex, testcasename, testcasetype); + iIniFile << "" << std::endl; + iIniFile << "\t" << std::endl; + iIniFile << "" << std::endl; + iIniFile << std::endl; +} + + + +//Swi store script generator for emulator tests +SWIStoreScriptGeneration::SWIStoreScriptGeneration(const std::stringstream &aFileName) + : ScriptAndIniGeneration(aFileName) +{ + +} + +SWIStoreScriptGeneration::~SWIStoreScriptGeneration() +{ +} + +void SWIStoreScriptGeneration:: WriteInitialiseCert(const std::stringstream &aTestCaseType, int &aTestIndex) +{ + const char *testcasename = "Initialise a SWICertStore"; + const char *testcasetype = "initswicertstore"; + WriteTestCaseToScript(aTestCaseType, ++aTestIndex, testcasename, testcasetype, false); +} + + +void SWIStoreScriptGeneration::WriteListcert(const char *aGoodOwnerType, const std::stringstream &aTestCaseType, int &aTestIndex) +{ + const char *testcasename = "Get the list of certificates"; + const char *testcasetype = "listcert"; + WriteTestCaseToScript(aTestCaseType, ++aTestIndex, testcasename, testcasetype); + iIniFile << "" << std::endl; + iIniFile << "\t" << std::endl; + iIniFile << "\t\t" << aGoodOwnerType << "" << std::endl; + iIniFile << "\t" << std::endl; + iIniFile << "" << std::endl; + iIniFile << "" << std::endl; + for(int i =0; i<6; i++) + { + iIniFile << "\tTrue" << std::endl; + } + iIniFile << "" << std::endl; + iIniFile << std::endl; +} + +void SWIStoreScriptGeneration::WriteGetSystemUpgrade(const char *label, const char *aSystemUpgrade, const std::stringstream &aTestCaseType, int &aTestIndex) +{ + const char *testcasename = "Get the systemupgrade flag"; + const char *testcasetype = "getsystemupgrade"; + WriteTestCaseToScript(aTestCaseType, ++aTestIndex, testcasename, testcasetype); + iIniFile << "" << std::endl; + iIniFile << "\t" << std::endl; + iIniFile << "" << std::endl; + iIniFile << "" << std::endl; + iIniFile << "\t" << aSystemUpgrade << "" << std::endl; + iIniFile << "" << std::endl; + iIniFile << std::endl; +} + + +void SWIStoreScriptGeneration::WriteRetrieveCerts(const char *label, const std::stringstream &aTestCaseType, int &aTestIndex) +{ + const char *testcasename = "Retrieve Certificate"; + const char *testcasetype = "retrieve"; + WriteTestCaseToScript(aTestCaseType, ++aTestIndex, testcasename, testcasetype); + iIniFile << "" << std::endl; + iIniFile << "\t" << std::endl; + iIniFile << "" << std::endl; + iIniFile << std::endl; +} + + + +void SWIStoreScriptGeneration::WriteGetApplications(const char *label, const std::stringstream &aTestCaseType, int &aTestIndex) +{ + const char *testcasename = "Get applications"; + const char *testcasetype = "getapplications"; + WriteTestCaseToScript(aTestCaseType, ++aTestIndex, testcasename, testcasetype); + iIniFile << "" << std::endl; + iIniFile << "\t" << std::endl; + iIniFile << "" << std::endl; + iIniFile << "" << std::endl; + iIniFile << "\t"; + for(int j = 0; j<2; j++) + { + iIniFile << emu_cacertsUid[j] << " "; + } + iIniFile << "" << std::endl; + iIniFile << "" << std::endl; + iIniFile << std::endl; +} + + +void SWIStoreScriptGeneration::WriteGetTrust(const char *label, const char *trust, const std::stringstream &aTestCaseType, int &aTestIndex) +{ + const char *testcasename = "Get Trust certificate"; + const char *testcasetype = "gettrusters"; + WriteTestCaseToScript(aTestCaseType, ++aTestIndex, testcasename, testcasetype); + iIniFile << "" << std::endl; + iIniFile << "\t" << std::endl; + iIniFile << "" << std::endl; + iIniFile << "" << std::endl; + iIniFile << "\t" << trust << "" << std::endl; + iIniFile << "" << std::endl; + iIniFile << std::endl; +} + + + +void SWIStoreScriptGeneration::WriteGetCapabilities(const char *label, const std::stringstream &aTestCaseType, int &aTestIndex) +{ + const char *testcasename = "Get the capabilities"; + const char *testcasetype = "getcapabilities"; + WriteTestCaseToScript(aTestCaseType, ++aTestIndex, testcasename, testcasetype); + iIniFile << "" << std::endl; + iIniFile << "\t" << std::endl; + iIniFile << "" << std::endl; + iIniFile << "" << std::endl; + for(int i=0; i<20; i++) + { + iIniFile << "\t" << goodCapabilitySets[i] << "" << std::endl; + } + iIniFile << "" << std::endl; + iIniFile << std::endl; +} + + +void SWIStoreScriptGeneration::WriteGetMandatoryFlag(const char *label, const char *aMandatory, const std::stringstream &aTestCaseType, int &aTestIndex) +{ + const char *testcasename = "Get the mandatory flag"; + const char *testcasetype = "getmandatory"; + WriteTestCaseToScript(aTestCaseType, ++aTestIndex, testcasename, testcasetype); + iIniFile << "" << std::endl; + iIniFile << "\t" << std::endl; + iIniFile << "" << std::endl; + iIniFile << "" << std::endl; + iIniFile << "\t" << aMandatory << "" << std::endl; + iIniFile << "" << std::endl; + iIniFile << std::endl; +} + + +//Cert client script generator +CertClientsStoreScriptGeneration::CertClientsStoreScriptGeneration(const std::stringstream &aFileName) + : ScriptAndIniGeneration(aFileName) +{ +} + +CertClientsStoreScriptGeneration::~CertClientsStoreScriptGeneration() +{ +} + +void CertClientsStoreScriptGeneration::WriteInitialiseCertClient(const std::stringstream &aTestCaseType, int &aTestIndex) +{ + const char *testcasename = "Initialise a CertClientStore"; + const char *testcasetype = "InitManager"; + WriteTestCaseToScript(aTestCaseType, ++aTestIndex, testcasename, testcasetype, false); +} + +void CertClientsStoreScriptGeneration::WriteGetCount(const int aApp_uidIndex, const std::stringstream &aTestCaseType, int &aTestIndex) +{ + const char *testcasename = "Get Count of Applications"; + const char *testcasetype = "AppCount"; + WriteTestCaseToScript(aTestCaseType, ++aTestIndex, testcasename, testcasetype); + iIniFile << "" << std::endl; + iIniFile << "\t" << aApp_uidIndex << "" << std::endl; + iIniFile << "" << std::endl; + iIniFile << std::endl; +} + + +void CertClientsStoreScriptGeneration::WriteGetApplicationsList(const std::stringstream &aTestCaseType, int &aTestIndex) +{ + const char *testcasename = "Getting the application list"; + const char *testcasetype = "GetApplications"; + WriteTestCaseToScript(aTestCaseType, ++aTestIndex, testcasename, testcasetype); + iIniFile << "" << std::endl; + for(int i = 0 ; i<4 ; i++) + { + iIniFile << "\t" << gooddecimalUid_array[i] << ""<<"" << goodcertclient_array[i] << "" << std::endl; + } + iIniFile << "" << std::endl; + iIniFile << std::endl; +} + + +void CertClientsStoreScriptGeneration::WriteGetAppWithUid(const char *goodlabel,const char *uid,const std::stringstream &aTestCaseType,int &aTestIndex) +{ + const char *testcasename = "Get application with given id"; + const char *testcasetype = "GetApp"; + WriteTestCaseToScript(aTestCaseType, ++aTestIndex, testcasename, testcasetype); + iIniFile << "" << std::endl; + iIniFile << "\t" << uid << "" << std::endl; + iIniFile << "\t" << goodlabel << "" << std::endl; + iIniFile << "" << std::endl; + iIniFile << std::endl; +} + + +void CertClientsStoreScriptGeneration::WriteDestroyManager(const std::stringstream &aTestCaseType, int &aTestIndex) +{ + const char *testcasename = "Destroy the manager"; + const char *testcasetype = "DestroyManager"; + WriteTestCaseToScript(aTestCaseType, ++aTestIndex, testcasename, testcasetype, false); +} + + +/** +Class definition for creating cacerts +*/ +EmptyFileConfigWriter::EmptyFileConfigWriter(const std::stringstream &aFileName) + : GoodConfigWriter(aFileName) +{ + iFile << "StartCertStoreEntries" << std::endl; +} + +EmptyFileConfigWriter::~EmptyFileConfigWriter() +{ + iFile << "EndCertStoreEntries" << std::endl; +} + +// End of file +