crypto/weakcrypto/test/tpbe/texternpbeparams.h
changeset 71 dd83586b62d6
equal deleted inserted replaced
66:8873e6835f7b 71:dd83586b62d6
       
     1 /*
       
     2 * Copyright (c) 2006-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 * Defines class used for testing pbe param internalization and externalization.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 /**
       
    23  @file
       
    24 */
       
    25 
       
    26 #ifndef TEXTERNPBEPARAMS_H
       
    27 #define TEXTERNPBEPARAMS_H
       
    28 
       
    29 #include <pbedata.h>
       
    30 #include "t_testaction.h"
       
    31 #include "t_input.h"
       
    32 
       
    33 class CExternPbeParams : public CTestAction
       
    34 /**
       
    35 	This class tests thatn encryption parameters can be
       
    36 	successfully externalized and restored.  It is also used
       
    37 	to ensure pre-PKSC#12 parameters can be read when PKCS#12
       
    38 	is enabled.
       
    39  */
       
    40 	{
       
    41 public:
       
    42 	static CTestAction* NewL(
       
    43 		RFs& aFs, CConsoleBase& aConsole,
       
    44 		Output& aOut, const TTestActionSpec& aTestActionSpec);
       
    45 	virtual ~CExternPbeParams();
       
    46 	
       
    47 	// implement CTestAction
       
    48 	virtual void PerformAction(TRequestStatus& aStatus);
       
    49 	virtual void DoReportAction();
       
    50 	virtual void DoCheckResult(TInt aError);
       
    51 	
       
    52 	// override CTestAction
       
    53 	virtual void DoPerformPrerequisite(TRequestStatus& aStatus);
       
    54 	virtual void DoPerformPostrequisite(TRequestStatus& aStatus);
       
    55 	
       
    56 private:
       
    57 	CExternPbeParams(CConsoleBase& aConsole, Output& aOut, RFs& aFs);
       
    58 	void ConstructL(const TTestActionSpec& aTestActionSpec);
       
    59 	
       
    60 	void DoPerformPrerequisiteL();
       
    61 	
       
    62 	static HBufC8* ReadHexStringL(const TDesC8& aBody, const TDesC8& aTag);
       
    63 	static TInt ReadDecStringL(const TDesC8& aBody, const TDesC8& aTag);
       
    64 	static HBufC8* ReadStringLC(const TDesC8& aBody, const TDesC8& aTag);
       
    65 	
       
    66 	CPBEncryptParms* InternalizeEncryptionParamsLC(const TDesC& aFileName);
       
    67 	void CompareAgainstTestFileL(const TDesC& aFileName, const CPBEncryptParms& aParams);
       
    68 	void TestDecodeMatchesScriptL(const TDesC& aFileName);
       
    69 	void TestReExternMatchesL(const TDesC& aFileName);
       
    70 	void TestScratchExternL(const TDesC& aFileName);
       
    71 	
       
    72 private:
       
    73 	/** File server session used to write params to, and read params from, files. */
       
    74 	RFs& iFs;
       
    75 	
       
    76 	/** Element body text. */
       
    77 	HBufC8* iBody;
       
    78 
       
    79 	/** Original externalized filename. */
       
    80 	HBufC8* iOrigFileName;
       
    81 	/** Numeric value of expected cipher. */
       
    82 	TInt iExpCipher;
       
    83 	/** Expected salt. */
       
    84 	HBufC8* iExpSalt;
       
    85 	/** Expected IV. */
       
    86 	HBufC8* iExpIv;
       
    87 	/** Expected iteration count. */
       
    88 	TInt iExpIterCount;
       
    89 	/**
       
    90 		Expected key derivation function.  This is not stored
       
    91 		as CPBEncryptParms::TKdf, which is not available when
       
    92 		SYMBIAN_PKCS12 is not defined.
       
    93 	 */
       
    94 	TInt iExpKdf;
       
    95 	};
       
    96 
       
    97 #endif	// #ifndef TEXTERNPBEPARAMS_H
       
    98