1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/crypto/weakcrypto/test/tpbe/texternpbeparams.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,98 @@
1.4 +/*
1.5 +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of the License "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +* Defines class used for testing pbe param internalization and externalization.
1.19 +*
1.20 +*/
1.21 +
1.22 +
1.23 +
1.24 +
1.25 +/**
1.26 + @file
1.27 +*/
1.28 +
1.29 +#ifndef TEXTERNPBEPARAMS_H
1.30 +#define TEXTERNPBEPARAMS_H
1.31 +
1.32 +#include <pbedata.h>
1.33 +#include "t_testaction.h"
1.34 +#include "t_input.h"
1.35 +
1.36 +class CExternPbeParams : public CTestAction
1.37 +/**
1.38 + This class tests thatn encryption parameters can be
1.39 + successfully externalized and restored. It is also used
1.40 + to ensure pre-PKSC#12 parameters can be read when PKCS#12
1.41 + is enabled.
1.42 + */
1.43 + {
1.44 +public:
1.45 + static CTestAction* NewL(
1.46 + RFs& aFs, CConsoleBase& aConsole,
1.47 + Output& aOut, const TTestActionSpec& aTestActionSpec);
1.48 + virtual ~CExternPbeParams();
1.49 +
1.50 + // implement CTestAction
1.51 + virtual void PerformAction(TRequestStatus& aStatus);
1.52 + virtual void DoReportAction();
1.53 + virtual void DoCheckResult(TInt aError);
1.54 +
1.55 + // override CTestAction
1.56 + virtual void DoPerformPrerequisite(TRequestStatus& aStatus);
1.57 + virtual void DoPerformPostrequisite(TRequestStatus& aStatus);
1.58 +
1.59 +private:
1.60 + CExternPbeParams(CConsoleBase& aConsole, Output& aOut, RFs& aFs);
1.61 + void ConstructL(const TTestActionSpec& aTestActionSpec);
1.62 +
1.63 + void DoPerformPrerequisiteL();
1.64 +
1.65 + static HBufC8* ReadHexStringL(const TDesC8& aBody, const TDesC8& aTag);
1.66 + static TInt ReadDecStringL(const TDesC8& aBody, const TDesC8& aTag);
1.67 + static HBufC8* ReadStringLC(const TDesC8& aBody, const TDesC8& aTag);
1.68 +
1.69 + CPBEncryptParms* InternalizeEncryptionParamsLC(const TDesC& aFileName);
1.70 + void CompareAgainstTestFileL(const TDesC& aFileName, const CPBEncryptParms& aParams);
1.71 + void TestDecodeMatchesScriptL(const TDesC& aFileName);
1.72 + void TestReExternMatchesL(const TDesC& aFileName);
1.73 + void TestScratchExternL(const TDesC& aFileName);
1.74 +
1.75 +private:
1.76 + /** File server session used to write params to, and read params from, files. */
1.77 + RFs& iFs;
1.78 +
1.79 + /** Element body text. */
1.80 + HBufC8* iBody;
1.81 +
1.82 + /** Original externalized filename. */
1.83 + HBufC8* iOrigFileName;
1.84 + /** Numeric value of expected cipher. */
1.85 + TInt iExpCipher;
1.86 + /** Expected salt. */
1.87 + HBufC8* iExpSalt;
1.88 + /** Expected IV. */
1.89 + HBufC8* iExpIv;
1.90 + /** Expected iteration count. */
1.91 + TInt iExpIterCount;
1.92 + /**
1.93 + Expected key derivation function. This is not stored
1.94 + as CPBEncryptParms::TKdf, which is not available when
1.95 + SYMBIAN_PKCS12 is not defined.
1.96 + */
1.97 + TInt iExpKdf;
1.98 + };
1.99 +
1.100 +#endif // #ifndef TEXTERNPBEPARAMS_H
1.101 +