os/security/crypto/weakcryptospi/test/tpbe/texternpbeparams.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of the License "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description: 
sl@0
    15
* Defines class used for testing pbe param internalization and externalization.
sl@0
    16
*
sl@0
    17
*/
sl@0
    18
sl@0
    19
sl@0
    20
sl@0
    21
sl@0
    22
/**
sl@0
    23
 @file
sl@0
    24
*/
sl@0
    25
sl@0
    26
#ifndef TEXTERNPBEPARAMS_H
sl@0
    27
#define TEXTERNPBEPARAMS_H
sl@0
    28
sl@0
    29
#include <pbedata.h>
sl@0
    30
#include "t_testaction.h"
sl@0
    31
#include "t_input.h"
sl@0
    32
sl@0
    33
class CExternPbeParams : public CTestAction
sl@0
    34
/**
sl@0
    35
	This class tests thatn encryption parameters can be
sl@0
    36
	successfully externalized and restored.  It is also used
sl@0
    37
	to ensure pre-PKSC#12 parameters can be read when PKCS#12
sl@0
    38
	is enabled.
sl@0
    39
 */
sl@0
    40
	{
sl@0
    41
public:
sl@0
    42
	static CTestAction* NewL(
sl@0
    43
		RFs& aFs, CConsoleBase& aConsole,
sl@0
    44
		Output& aOut, const TTestActionSpec& aTestActionSpec);
sl@0
    45
	virtual ~CExternPbeParams();
sl@0
    46
	
sl@0
    47
	// implement CTestAction
sl@0
    48
	virtual void PerformAction(TRequestStatus& aStatus);
sl@0
    49
	virtual void DoReportAction();
sl@0
    50
	virtual void DoCheckResult(TInt aError);
sl@0
    51
	
sl@0
    52
	// override CTestAction
sl@0
    53
	virtual void DoPerformPrerequisite(TRequestStatus& aStatus);
sl@0
    54
	virtual void DoPerformPostrequisite(TRequestStatus& aStatus);
sl@0
    55
	
sl@0
    56
private:
sl@0
    57
	CExternPbeParams(CConsoleBase& aConsole, Output& aOut, RFs& aFs);
sl@0
    58
	void ConstructL(const TTestActionSpec& aTestActionSpec);
sl@0
    59
	
sl@0
    60
	void DoPerformPrerequisiteL();
sl@0
    61
	
sl@0
    62
	static HBufC8* ReadHexStringL(const TDesC8& aBody, const TDesC8& aTag);
sl@0
    63
	static TInt ReadDecStringL(const TDesC8& aBody, const TDesC8& aTag);
sl@0
    64
	static HBufC8* ReadStringLC(const TDesC8& aBody, const TDesC8& aTag);
sl@0
    65
	
sl@0
    66
	CPBEncryptParms* InternalizeEncryptionParamsLC(const TDesC& aFileName);
sl@0
    67
	void CompareAgainstTestFileL(const TDesC& aFileName, const CPBEncryptParms& aParams);
sl@0
    68
	void TestDecodeMatchesScriptL(const TDesC& aFileName);
sl@0
    69
	void TestReExternMatchesL(const TDesC& aFileName);
sl@0
    70
	void TestScratchExternL(const TDesC& aFileName);
sl@0
    71
	
sl@0
    72
private:
sl@0
    73
	/** File server session used to write params to, and read params from, files. */
sl@0
    74
	RFs& iFs;
sl@0
    75
	
sl@0
    76
	/** Element body text. */
sl@0
    77
	HBufC8* iBody;
sl@0
    78
sl@0
    79
	/** Original externalized filename. */
sl@0
    80
	HBufC8* iOrigFileName;
sl@0
    81
	/** Numeric value of expected cipher. */
sl@0
    82
	TInt iExpCipher;
sl@0
    83
	/** Expected salt. */
sl@0
    84
	HBufC8* iExpSalt;
sl@0
    85
	/** Expected IV. */
sl@0
    86
	HBufC8* iExpIv;
sl@0
    87
	/** Expected iteration count. */
sl@0
    88
	TInt iExpIterCount;
sl@0
    89
	/**
sl@0
    90
		Expected key derivation function.  This is not stored
sl@0
    91
		as CPBEncryptParms::TKdf, which is not available when
sl@0
    92
		SYMBIAN_PKCS12 is not defined.
sl@0
    93
	 */
sl@0
    94
	TInt iExpKdf;
sl@0
    95
	};
sl@0
    96
sl@0
    97
#endif	// #ifndef TEXTERNPBEPARAMS_H
sl@0
    98