os/security/cryptoservices/certificateandkeymgmt/pkixCert/pkixCertChainHelper.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.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of the License "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description: 
sl@0
    15
* CPKIXCertChainHelper class implementation
sl@0
    16
*
sl@0
    17
*/
sl@0
    18
sl@0
    19
sl@0
    20
/**
sl@0
    21
 @file 
sl@0
    22
 @internalTechnology
sl@0
    23
*/
sl@0
    24
 
sl@0
    25
#ifndef __PKIXCERTCHAINHELPER_H__
sl@0
    26
#define __PKIXCERTCHAINHELPER_H__
sl@0
    27
sl@0
    28
#include <e32base.h>
sl@0
    29
sl@0
    30
class RFs;
sl@0
    31
class CPKIXCertChainBase;
sl@0
    32
class CPKIXValidationResult;
sl@0
    33
class CUnifiedCertStore;
sl@0
    34
sl@0
    35
/**
sl@0
    36
 * An helper object that used to implement the valdiation functionality of the
sl@0
    37
 * CPKICCertChain interface.  This is done by creating and initialising a
sl@0
    38
 * unified certificate store, and then calling through to the implementation in
sl@0
    39
 * CPKIXCertChainBase.
sl@0
    40
 */
sl@0
    41
NONSHARABLE_CLASS(CPKIXCertChainHelper) : public CActive
sl@0
    42
	{
sl@0
    43
public:
sl@0
    44
	static CPKIXCertChainHelper* NewL(RFs& aFs);
sl@0
    45
sl@0
    46
	virtual ~CPKIXCertChainHelper();
sl@0
    47
sl@0
    48
	CUnifiedCertStore& CertStore();
sl@0
    49
	
sl@0
    50
	/** Validates the chain. */
sl@0
    51
	void Validate(CPKIXCertChainBase& aCertChain,
sl@0
    52
				  CPKIXValidationResult& aValidationResult, 
sl@0
    53
				  const TTime& aValidationTime,
sl@0
    54
				  TRequestStatus& aStatus);
sl@0
    55
	
sl@0
    56
	/** Validates the chain. */
sl@0
    57
	void Validate(CPKIXCertChainBase& aCertChain,
sl@0
    58
				  CPKIXValidationResult& aValidationResult, 
sl@0
    59
				  const TTime& aValidationTime,
sl@0
    60
				  const CArrayPtr<HBufC>& aInitialPolicies, 
sl@0
    61
				  TRequestStatus& aStatus);
sl@0
    62
sl@0
    63
	/** Cancels an asynchronous Validate() operation. */
sl@0
    64
	void CancelValidate();
sl@0
    65
sl@0
    66
private:
sl@0
    67
	CPKIXCertChainHelper();
sl@0
    68
	void ConstructL(RFs& aFs);
sl@0
    69
	void StartValidate(CPKIXCertChainBase& aCertChain,
sl@0
    70
					   CPKIXValidationResult& aValidationResult, 
sl@0
    71
					   const TTime& aValidationTime,
sl@0
    72
					   const CArrayPtr<HBufC>* aInitialPolicies, 
sl@0
    73
					   TRequestStatus& aStatus);
sl@0
    74
	void InitializeCertStore();
sl@0
    75
	void ValidateChainL();
sl@0
    76
sl@0
    77
private:
sl@0
    78
	virtual void RunL();
sl@0
    79
	virtual TInt RunError(TInt aError);
sl@0
    80
	virtual void DoCancel();
sl@0
    81
	void Complete(TInt aError);
sl@0
    82
	
sl@0
    83
private:
sl@0
    84
	enum TState
sl@0
    85
		{
sl@0
    86
		EIdle,
sl@0
    87
		EInitializeCertStore,
sl@0
    88
		EValidateChain
sl@0
    89
		};
sl@0
    90
	
sl@0
    91
	CUnifiedCertStore*		iCertStore;
sl@0
    92
	TBool					iCertStoreInitialized;
sl@0
    93
	TState					iState;
sl@0
    94
	
sl@0
    95
	// Client parameters
sl@0
    96
	CPKIXCertChainBase*		iCertChain;
sl@0
    97
	CPKIXValidationResult*	iValidationResult;
sl@0
    98
	TTime					iValidationTime;
sl@0
    99
	const CArrayPtr<HBufC>*	iInitialPolicies;
sl@0
   100
	TRequestStatus*			iClientStatus;
sl@0
   101
	};
sl@0
   102
sl@0
   103
#endif