First public contribution.
2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #include "tpkcs7server.h"
20 #include "tpkcs7step.h"
23 _LIT(KServerName,"tPKCS7Server");
25 CTPKCS7Server* CTPKCS7Server::NewL()
27 * @return - Instance of the test server
28 * Called inside the MainL() function to create and start the
29 * CTestServer derived server.
32 CTPKCS7Server * server = new (ELeave) CTPKCS7Server();
33 CleanupStack::PushL(server);
34 // CServer base class call
35 server->StartL(KServerName);
36 CleanupStack::Pop(server);
39 RFs& CTPKCS7Server::Fs()
45 // Just an E32Main and a MainL()
48 * Much simpler, uses the new Rendezvous() call to sync with the client
51 // Leave the hooks in for platform security
52 #if (defined __DATA_CAGING__)
53 RProcess().DataCaging(RProcess::EDataCagingOn);
54 RProcess().SecureApi(RProcess::ESecureApiOn);
56 CActiveScheduler* sched=NULL;
57 sched=new(ELeave) CActiveScheduler;
58 CActiveScheduler::Install(sched);
59 CTPKCS7Server* server = NULL;
60 // Create the CTestServer derived server
61 TRAPD(err,server = CTPKCS7Server::NewL());
64 // Sync with the client and enter the active scheduler
65 RProcess::Rendezvous(KErrNone);
72 // Only a DLL on emulator for typhoon and earlier
74 GLDEF_C TInt E32Main()
76 * @return - Standard Epoc error code on exit
79 CTrapCleanup* cleanup = CTrapCleanup::New();
89 // Create a thread in the calling process
90 // Emulator typhoon and earlier
92 CTestStep* CTPKCS7Server::CreateTestStep(const TDesC& aStepName)
94 * @return - A CTestStep derived instance
95 * Implementation of CTestServer pure virtual
98 CTPKCS7StepBase* testStep = NULL;
101 // __EDIT_ME__ - Create your own test steps here
102 // This server creates just one step but create as many as you want
103 // They are created "just in time" when the worker thread is created
104 if(aStepName == KTPKCS7CorruptTest)
105 testStep = new CTPKCS7CorruptTest();
106 else if(aStepName == KTPKCS7ValidTest)
107 testStep = new CTPKCS7ValidTest();
108 else if(aStepName == KTPKCS7ContentTest)
109 testStep = new CTPKCS7CorruptTest();
110 else if(aStepName == KTPKCS7CertificateTest)
111 testStep = new CTPKCS7CertificateTest();
112 else if(aStepName == KTPKCS7SignerTest)
113 testStep = new CTPKCS7SignerTest();
114 else if(aStepName == KTPKCS7EncryptedDataTest)
115 testStep = new CTPKCS7EncryptedDataTest();
116 else if(aStepName == KTPKCS7DigestInfoTest)
117 testStep = new CTPKCS7DigestInfoTest();
118 else if(aStepName == KTPKCS7EncryptedDataCorruptTest)
119 testStep = new CTPKCS7EncryptedDataCorruptTest();
120 else if(aStepName == KTPKCS7DigestInfoCorruptTest)
121 testStep = new CTPKCS7DigestInfoCorruptTest();
122 else if(aStepName == KTPKCS7OOMTest)
123 testStep = new CTPKCS7OOMTest();
127 testStep->SetServer(this);
130 CTestStep* cmsTestStep(NULL);
131 if (aStepName == KTCmsSignedDataTest)
133 cmsTestStep = new CTCmsSignedDataStep();
136 else if (aStepName == KTCmsSignedDataDecodingTest)
138 cmsTestStep = new CTCmsSignedDataDecodingStep();
141 else if (aStepName == KTCmsDataTest)
143 cmsTestStep = new CTCmsDataStep();
146 else if (aStepName == KTCmsDataDecodingTest)
148 cmsTestStep = new CTCmsDataDecodingStep();
151 else if (aStepName == KTCmsContentInfoDecodingTest)
153 cmsTestStep = new CTCmsContentInfoDecodingStep();
159 else if (aStepName == KTPKCS7SignedDataTest)
161 cmsTestStep = new CTPKCS7SignedDataStep();