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