cryptoservices/certificateandkeymgmt/tx509/extensiontest.h
changeset 0 2c201484c85f
child 8 35751d3474b7
equal deleted inserted replaced
-1:000000000000 0:2c201484c85f
       
     1 /*
       
     2 * Copyright (c) 2005-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 * CExtensionTest class implementation
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 /**
       
    23  @file 
       
    24  @internalTechnology
       
    25 */
       
    26  
       
    27 #ifndef __EXTENSIONTEST_H
       
    28 #define __EXTENSIONTEST_H
       
    29 
       
    30 #include <x509certext.h>
       
    31 
       
    32 #include "t_testaction.h"
       
    33 #include "tcertwriter.h"
       
    34 
       
    35 class CExtensionTest : public CTestAction
       
    36 	{
       
    37 public:
       
    38 	static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole, 
       
    39 		Output& aOut, const TTestActionSpec& aTestActionSpec);
       
    40 	static CTestAction* NewLC(RFs& aFs, CConsoleBase& aConsole,
       
    41 		Output& aOut, const TTestActionSpec& aTestActionSpec);
       
    42 	void TestValidation(TRequestStatus& aStatus);
       
    43 	~CExtensionTest();
       
    44 
       
    45 	void PerformAction(TRequestStatus& aStatus);
       
    46 	void DoReportAction();
       
    47 	void DoCheckResult(TInt aError);
       
    48 
       
    49 private:
       
    50 	CExtensionTest(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
       
    51 	void ConstructL(const TTestActionSpec& aTestActionSpec);
       
    52 	
       
    53 	// compares arrays of things returning true if they are equal
       
    54 	TBool IsEqual(const RArray<TInt>& aArray1, const RArray<TInt>& aArray2);
       
    55 	TBool IsEqual(const RPointerArray<HBufC>& aArray1, const RPointerArray<HBufC>& aArray2);
       
    56 	
       
    57 	// return true if the extension data matches the expected value
       
    58 	void CheckExtensionsL(const CX509Certificate& cert, TBool& match, TBool& result);
       
    59 	TBool CheckDeviceIdListL(const CX509Certificate& cert);
       
    60 	TBool CheckSidListL(const CX509Certificate& cert);
       
    61 	TBool CheckVidListL(const CX509Certificate& cert);
       
    62 	TBool CheckCapabilitiesL(const CX509Certificate& cert);
       
    63 	
       
    64 	// populate expected value data structures from scritps
       
    65 	void BuildIntList(RArray<TInt>& aInts, const TDesC& aBuf, const TDesC& aTag);
       
    66 	void BuildStringListL(RPointerArray<HBufC>& aStrings, const TDesC& aBuf, const TDesC& aTag);
       
    67 	void BuildCapabilitySet(TCapabilitySet& aCapabilitySet, const TDesC& aBuf);
       
    68 	
       
    69 	void PrintLine(const TDesC& aText);
       
    70 	void Print(const TDesC& aText);
       
    71 
       
    72 private:
       
    73 	RFs& iFs;		
       
    74 	TFileName iCertFileName;
       
    75 		
       
    76 	// Whether the input data is expeceted to match the certificate extension.
       
    77 	TBool iExpectedMatch;
       
    78 	
       
    79 	// Whether the parsing of extension is expected to fail.
       
    80 	TBool iExpectedCorrupt;	
       
    81 	
       
    82 	// Whether the constraints are expected within the certificate
       
    83 	TBool iDeviceIdsPresent;
       
    84 	TBool iSidsPresent;
       
    85 	TBool iVidsPresent;
       
    86 	TBool iCapabilitiesPresent;
       
    87 	
       
    88 	// The expected values associated with the extensions
       
    89 	RPointerArray<HBufC> iExpectedDeviceIdList;
       
    90 	RArray<TInt> iExpectedSidList;
       
    91 	RArray<TInt> iExpectedVidList;
       
    92 	TCapabilitySet iExpectedCapabilities;
       
    93 	};
       
    94 
       
    95 #endif