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.
     1 /*
     2 * Copyright (c) 2004-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 * CPKIXCertChainHelper class implementation
    16 *
    17 */
    18 
    19 
    20 /**
    21  @file 
    22  @internalTechnology
    23 */
    24  
    25 #ifndef __PKIXCERTCHAINHELPER_H__
    26 #define __PKIXCERTCHAINHELPER_H__
    27 
    28 #include <e32base.h>
    29 
    30 class RFs;
    31 class CPKIXCertChainBase;
    32 class CPKIXValidationResult;
    33 class CUnifiedCertStore;
    34 
    35 /**
    36  * An helper object that used to implement the valdiation functionality of the
    37  * CPKICCertChain interface.  This is done by creating and initialising a
    38  * unified certificate store, and then calling through to the implementation in
    39  * CPKIXCertChainBase.
    40  */
    41 NONSHARABLE_CLASS(CPKIXCertChainHelper) : public CActive
    42 	{
    43 public:
    44 	static CPKIXCertChainHelper* NewL(RFs& aFs);
    45 
    46 	virtual ~CPKIXCertChainHelper();
    47 
    48 	CUnifiedCertStore& CertStore();
    49 	
    50 	/** Validates the chain. */
    51 	void Validate(CPKIXCertChainBase& aCertChain,
    52 				  CPKIXValidationResult& aValidationResult, 
    53 				  const TTime& aValidationTime,
    54 				  TRequestStatus& aStatus);
    55 	
    56 	/** Validates the chain. */
    57 	void Validate(CPKIXCertChainBase& aCertChain,
    58 				  CPKIXValidationResult& aValidationResult, 
    59 				  const TTime& aValidationTime,
    60 				  const CArrayPtr<HBufC>& aInitialPolicies, 
    61 				  TRequestStatus& aStatus);
    62 
    63 	/** Cancels an asynchronous Validate() operation. */
    64 	void CancelValidate();
    65 
    66 private:
    67 	CPKIXCertChainHelper();
    68 	void ConstructL(RFs& aFs);
    69 	void StartValidate(CPKIXCertChainBase& aCertChain,
    70 					   CPKIXValidationResult& aValidationResult, 
    71 					   const TTime& aValidationTime,
    72 					   const CArrayPtr<HBufC>* aInitialPolicies, 
    73 					   TRequestStatus& aStatus);
    74 	void InitializeCertStore();
    75 	void ValidateChainL();
    76 
    77 private:
    78 	virtual void RunL();
    79 	virtual TInt RunError(TInt aError);
    80 	virtual void DoCancel();
    81 	void Complete(TInt aError);
    82 	
    83 private:
    84 	enum TState
    85 		{
    86 		EIdle,
    87 		EInitializeCertStore,
    88 		EValidateChain
    89 		};
    90 	
    91 	CUnifiedCertStore*		iCertStore;
    92 	TBool					iCertStoreInitialized;
    93 	TState					iState;
    94 	
    95 	// Client parameters
    96 	CPKIXCertChainBase*		iCertChain;
    97 	CPKIXValidationResult*	iValidationResult;
    98 	TTime					iValidationTime;
    99 	const CArrayPtr<HBufC>*	iInitialPolicies;
   100 	TRequestStatus*			iClientStatus;
   101 	};
   102 
   103 #endif