cryptoservices/certificateandkeymgmt/tasn1/main.cpp
author Santosh Patil <santosh.v.patil@nokia.com>
Wed, 08 Jul 2009 11:25:26 +0100
changeset 0 2c201484c85f
child 8 35751d3474b7
permissions -rw-r--r--
Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
     1
/*
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
     8
*
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    11
*
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    12
* Contributors:
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    13
*
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    14
* Description: 
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    15
* TPKIXCERTMAIN.CPP
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    16
*
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    17
*/
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    18
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    19
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    20
#include <e32base.h>
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    21
#include "t_testhandler.h"
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    22
#include "tasn1normaltest.h"
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    23
#include "tscripttests.h"
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    24
#include "tscriptsetup.h"
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    25
#include <random.h>
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    26
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    27
LOCAL_D void callExampleL() // initialize and call example code under cleanup stack
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    28
    {
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    29
    CSystemRandom *rng = CSystemRandom::NewL();
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    30
    SetThreadRandomLC(rng);
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    31
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    32
	START_SCRIPT_LIST
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    33
	SCRIPT_ITEM(CASN1NormalTest, _L8("Normal"))
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    34
	END_SCRIPT_LIST
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    35
	
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    36
	TDriveUnit sysDrive (RFs::GetSystemDrive());
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    37
	TDriveName driveName(sysDrive.Name());
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    38
	TBuf<64> scriptFile (driveName);
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    39
	scriptFile.Append(_L("\\tasn1\\scripts\\tasn1.txt"));
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    40
	CScriptSetup::CreateAndRunTestsL(theTestTypes, scriptFile, _L("tasn1.log"));
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    41
	
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    42
	DestroyThreadRandom();
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    43
	CleanupStack::Pop(); // Pop the cleanup item which would have reset/delete the threadrandom
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    44
    }
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    45
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    46
GLDEF_C TInt E32Main() // main function called by E32
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    47
    {
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    48
	__UHEAP_MARK;
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    49
	CTrapCleanup* cleanup = CTrapCleanup::New(); // get clean-up stack
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    50
	TRAP_IGNORE(callExampleL());
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    51
	// dont panic in case its a syntax error in script.
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    52
	//__ASSERT_ALWAYS(!error,User::Panic(_L("CERT"),error));
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    53
	delete cleanup; // destroy clean-up stack
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    54
	__UHEAP_MARKEND;
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    55
	return 0;
2c201484c85f Move the Security package to EPL, and add the implementations of the cryptographic algorithms
Santosh Patil <santosh.v.patil@nokia.com>
parents:
diff changeset
    56
    }