diff -r 000000000000 -r 2c201484c85f cryptoservices/certificateandkeymgmt/tx509/extensiontest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cryptoservices/certificateandkeymgmt/tx509/extensiontest.h Wed Jul 08 11:25:26 2009 +0100 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* CExtensionTest class implementation +* +*/ + + + + +/** + @file + @internalTechnology +*/ + +#ifndef __EXTENSIONTEST_H +#define __EXTENSIONTEST_H + +#include + +#include "t_testaction.h" +#include "tcertwriter.h" + +class CExtensionTest : public CTestAction + { +public: + static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole, + Output& aOut, const TTestActionSpec& aTestActionSpec); + static CTestAction* NewLC(RFs& aFs, CConsoleBase& aConsole, + Output& aOut, const TTestActionSpec& aTestActionSpec); + void TestValidation(TRequestStatus& aStatus); + ~CExtensionTest(); + + void PerformAction(TRequestStatus& aStatus); + void DoReportAction(); + void DoCheckResult(TInt aError); + +private: + CExtensionTest(RFs& aFs, CConsoleBase& aConsole, Output& aOut); + void ConstructL(const TTestActionSpec& aTestActionSpec); + + // compares arrays of things returning true if they are equal + TBool IsEqual(const RArray& aArray1, const RArray& aArray2); + TBool IsEqual(const RPointerArray& aArray1, const RPointerArray& aArray2); + + // return true if the extension data matches the expected value + void CheckExtensionsL(const CX509Certificate& cert, TBool& match, TBool& result); + TBool CheckDeviceIdListL(const CX509Certificate& cert); + TBool CheckSidListL(const CX509Certificate& cert); + TBool CheckVidListL(const CX509Certificate& cert); + TBool CheckCapabilitiesL(const CX509Certificate& cert); + + // populate expected value data structures from scritps + void BuildIntList(RArray& aInts, const TDesC& aBuf, const TDesC& aTag); + void BuildStringListL(RPointerArray& aStrings, const TDesC& aBuf, const TDesC& aTag); + void BuildCapabilitySet(TCapabilitySet& aCapabilitySet, const TDesC& aBuf); + + void PrintLine(const TDesC& aText); + void Print(const TDesC& aText); + +private: + RFs& iFs; + TFileName iCertFileName; + + // Whether the input data is expeceted to match the certificate extension. + TBool iExpectedMatch; + + // Whether the parsing of extension is expected to fail. + TBool iExpectedCorrupt; + + // Whether the constraints are expected within the certificate + TBool iDeviceIdsPresent; + TBool iSidsPresent; + TBool iVidsPresent; + TBool iCapabilitiesPresent; + + // The expected values associated with the extensions + RPointerArray iExpectedDeviceIdList; + RArray iExpectedSidList; + RArray iExpectedVidList; + TCapabilitySet iExpectedCapabilities; + }; + +#endif