os/security/cryptoservices/certificateandkeymgmt/tpkixcert_tef/src/tpkixcertserver.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 /*
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     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".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: 
    15 *
    16 */
    17 
    18 
    19 #include "tpkixcertserver.h"
    20 #include "apiteststeps.h"
    21 #include "validateteststep.h"
    22 #include "datetimefatalteststep.h"
    23 
    24 _LIT(KServerName,"tpkixcert_tefserver");
    25 
    26 
    27 CPkixCertTestServer* CPkixCertTestServer::NewL()
    28 	{
    29 	CPkixCertTestServer* server = new (ELeave) CPkixCertTestServer();
    30 	CleanupStack::PushL(server);
    31 	server->ConstructL(KServerName);
    32 	CleanupStack::Pop(server);
    33 	return server;
    34 	}
    35 
    36 	
    37 CTestStep* CPkixCertTestServer::CreateTestStep(const TDesC& aStepName)
    38 	{
    39 	CTestStep* testStep = NULL;
    40 
    41 	if (aStepName == KAddSupportedOidsTestStep)
    42 		{
    43 		testStep = new CPkixCertAddSupportedOidsStep;
    44 		}
    45 	else if (aStepName == KRemoveSupportedOidsTestStep)
    46 		{
    47 		testStep = new CPkixCertRemoveSupportedOidsStep;
    48 		}
    49 	else if (aStepName == KSetSupportedOidsTestStep)
    50 		{
    51 		testStep = new CPkixCertSetSupportedOidsStep;
    52 		}
    53 	else if (aStepName == KResetSupportedOidsTestStep)
    54 		{
    55 		testStep = new CPkixCertResetSupportedOidsStep;
    56 		}
    57 	else if (aStepName == KValidateCertChainStep)
    58 		{
    59 		testStep = new CValidateCertChainStep;
    60 		}
    61 	else if (aStepName == KDateTimeFatalTestStep)
    62 		{
    63 		testStep = new CDateTimeFatalValidateStep;
    64 		}
    65 					
    66 	return testStep;	
    67 	}
    68 
    69 
    70 
    71 LOCAL_C void MainL()
    72     {
    73     // Leave the hooks in for platform security
    74 #if (defined __DATA_CAGING__)
    75     RProcess().DataCaging(RProcess::EDataCagingOn);
    76     RProcess().SecureApi(RProcess::ESecureApiOn);
    77 #endif
    78     CActiveScheduler* sched=NULL;
    79     sched=new(ELeave) CActiveScheduler;
    80     CActiveScheduler::Install(sched);
    81     CPkixCertTestServer* server = NULL;
    82     TRAPD(err,server = CPkixCertTestServer::NewL());
    83     if(!err)
    84         {
    85         // Sync with the client and enter the active scheduler
    86         RProcess::Rendezvous(KErrNone);
    87         sched->Start();
    88         }
    89     delete server;
    90     delete sched;
    91     }
    92 
    93 
    94 GLDEF_C TInt E32Main()
    95      {
    96 	__UHEAP_MARK;
    97 	CTrapCleanup* cleanup = CTrapCleanup::New();
    98 	if(cleanup == NULL)
    99 		{
   100 		return KErrNoMemory;
   101 		}
   102 	TRAP_IGNORE(MainL());
   103 	delete cleanup;
   104 	__UHEAP_MARKEND;
   105 	return KErrNone;
   106     }
   107