os/security/cryptoservices/certificateandkeymgmt/inc/unifiedcertstore_v2.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/cryptoservices/certificateandkeymgmt/inc/unifiedcertstore_v2.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,606 @@
     1.4 +/*
     1.5 +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +* UNIFIEDCERTSTORE.H
    1.19 +* The unified certificate store implementation
    1.20 +*
    1.21 +*/
    1.22 +
    1.23 +
    1.24 +/**
    1.25 + @file 
    1.26 + @publishedAll
    1.27 + @released
    1.28 +*/
    1.29 + 
    1.30 +#ifndef __UNIFIEDCERTSTORE_H__
    1.31 +#define __UNIFIEDCERTSTORE_H__
    1.32 +
    1.33 +class CCertificate;
    1.34 +
    1.35 +#include <signed.h>
    1.36 +#include <e32std.h>
    1.37 +#include <f32file.h>
    1.38 +#include <e32property.h>
    1.39 +#include <sacls.h>
    1.40 +#include <mcertstore.h>
    1.41 +#include <ct/rmpointerarray.h>
    1.42 +#include <ct/rcpointerarray.h>
    1.43 +
    1.44 +
    1.45 +
    1.46 +
    1.47 +/**  
    1.48 + *
    1.49 + * Publish and Subscribe - UnifiedCertSTore Category
    1.50 + * Aliased here to System Category to prevent SC break.
    1.51 + *
    1.52 + */
    1.53 +const TUid KUnifiedCertStorePropertyCat = {KUidSystemCategoryValue};
    1.54 +
    1.55 +/**  
    1.56 + *
    1.57 + * Publish and subscribe key for UnifiedCertSTore.
    1.58 + */
    1.59 +enum TUnifiedCertStoreKey
    1.60 +	{
    1.61 +	/**  
    1.62 + 	 *
    1.63 + 	 * The Publish and subscribe key for the certstore changes.
    1.64 +	 * If the client of the UnifiedCertstore needs to be notified when
    1.65 +	 * certificate addition, removal and trust&application setting occurs,
    1.66 +	 * the client needs to subscribe to KUnifiedCertStorePropertyCat and
    1.67 +	 * EUnifiedCertStoreFlag.
    1.68 +	 *
    1.69 +	 * Aliased here to KUidUnifiedCertstore flag to avoid SC break.
    1.70 + 	 */
    1.71 + 	EUnifiedCertStoreFlag = KUidUnifiedCertstoreFlag
    1.72 + 	};
    1.73 +
    1.74 +/**
    1.75 + *
    1.76 + * The Unique ID for unknown hardware certstore, used as the input parameter when it is to be filtered.
    1.77 + * @deprecated. Used only for Data compatibility.
    1.78 + */
    1.79 +
    1.80 +const TInt KUnknownHardwareCertStore = 0;
    1.81 +
    1.82 +
    1.83 +/**
    1.84 + *
    1.85 + * The Unique ID for mutable software certstore, used as the input parameter when it is to be filtered.
    1.86 + *
    1.87 + */
    1.88 +
    1.89 +const TInt KThirdPartyCertStore = 1;
    1.90 +
    1.91 +
    1.92 +/**
    1.93 + *
    1.94 + * The Unique ID for SIM certstore, used as the input parameter when it is to be filtered.
    1.95 + *
    1.96 + */
    1.97 +
    1.98 +const TInt KSIMCertStore  = 2;
    1.99 +
   1.100 +/**
   1.101 + *
   1.102 + * The Unique ID for WIM certstore, used as the input parameter when it is to be filtered.
   1.103 + *  
   1.104 + */
   1.105 +
   1.106 +const TInt KWIMCertStore  = 3;
   1.107 +
   1.108 +/**  
   1.109 + *
   1.110 + * The Unique ID for UICC certstore, used as the input parameter when it is to be filtered.
   1.111 + *  
   1.112 + */
   1.113 +const TInt KUICCCertStore = 4;
   1.114 +
   1.115 +/**  
   1.116 + *
   1.117 + * The Unique ID for immutable software certstore, used as the input parameter when it is to be filtered.
   1.118 + *  
   1.119 + */
   1.120 +
   1.121 +const TInt KManufactureCertStore = 5;
   1.122 +
   1.123 +// Forward declarations
   1.124 +class MCTCertStore;
   1.125 +class MCTWritableCertStore;
   1.126 +class MCTTokenInterface;
   1.127 +class MCTToken;
   1.128 +class MCTTokenType;
   1.129 +class CCTCertInfo;
   1.130 +class CCertAttributeFilter;
   1.131 +class CCTTokenTypeInfo;
   1.132 +class TCTTokenObjectHandle;
   1.133 +class CCheckedCertStore;
   1.134 +
   1.135 +// This class is forward declared to avoid including its definition in this
   1.136 +// exported header file because it must only be used internally.
   1.137 +class CUnifiedCertStoreWorkingVars;
   1.138 +class CX500DistinguishedName;
   1.139 +
   1.140 +/**
   1.141 + * The unified certificate store.
   1.142 + * 
   1.143 + * This class provides a certificate store whose contents are the sum of the
   1.144 + * contents of all certificate store implementations on the device.  It is
   1.145 + * intended as the single point of access for clients wishing to use certificate
   1.146 + * stores.
   1.147 + *
   1.148 + * Since this class is intended for widespread use, capability checks relating
   1.149 + * to certificate access are documented here even though the checks are actually
   1.150 + * made in the individual cert store implementations.
   1.151 + * 
   1.152 + */
   1.153 +NONSHARABLE_CLASS(CUnifiedCertStore) : public CActive, public MCertStore
   1.154 +	{
   1.155 +public:
   1.156 +	/** 
   1.157 +	 * Creates a new CUnifiedCertStore
   1.158 +	 *
   1.159 +	 * @param aFs			A file server session. It must already be open.
   1.160 +	 * @param aOpenForWrite	ETrue if the stores must be opened with write access
   1.161 +	 *						(e.g. for adding certificates) and EFalse if the user 
   1.162 +	 *						only needs read-only access.
   1.163 +	 * @return				A pointer to an instance of the CUnifiedCertStore class.
   1.164 +	 */
   1.165 +	IMPORT_C static CUnifiedCertStore* NewL(RFs& aFs, TBool aOpenForWrite);
   1.166 +	
   1.167 +	/** 
   1.168 +	 * Creates a new CUnifiedCertStore and pushes it on the cleanup stack.
   1.169 +	 *
   1.170 +	 * @param aFs			A file server session. It must already be open.
   1.171 +	 * @param aOpenForWrite	ETrue if the stores must be opened with write access
   1.172 +	 *						(e.g. for adding certificates) and EFalse if the user
   1.173 +	 *						only needs read-only access.
   1.174 +	 * @return				A pointer to an instance of the CUnifiedCertStore class.
   1.175 +	 */
   1.176 +	IMPORT_C static CUnifiedCertStore* NewLC(RFs& aFs, TBool aOpenForWrite);
   1.177 + 	/** 
   1.178 + 	 * Creates a new CUnifiedCertStore with the sequence filter, so that multiple certstores that are managed
   1.179 +	 * by it will be filtered and ordered.
   1.180 + 	 *
   1.181 + 	 * @param aFs			A file server session. It must already be open.
   1.182 + 	 * @param aOpenForWrite	ETrue if the stores must be opened with write access
   1.183 + 	 *						(e.g. for adding certificates) and EFalse if the user
   1.184 + 	 *						only needs read-only access. Ownership is taken.
   1.185 + 	 * @param aOrderFilter  An array of the unique sequence IDs specifying CertStore ordering.
   1.186 + 	 * @return				A pointer to an instance of the CUnifiedCertStore class.
   1.187 + 	 */
   1.188 + 	IMPORT_C static CUnifiedCertStore* NewL(RFs& aFs, 
   1.189 + 	                                        TBool aOpenForWrite,
   1.190 + 	                                        RArray<TInt>& aOrderFilter);
   1.191 + 	/** 
   1.192 + 	 * Creates a new CUnifiedCertStore with the sequence filter, so that multiple certstores that are managed
   1.193 +	 * by it will be filtered and ordered, and it is pushed on the cleanup stack.
   1.194 + 	 *
   1.195 + 	 * @param aFs			A file server session. It must already be open.
   1.196 + 	 * @param aOpenForWrite	ETrue if the stores must be opened with write access
   1.197 + 	 *						(e.g. for adding certificates) and EFalse if the user
   1.198 + 	 *						only needs read-only access. Ownership is taken.
   1.199 + 	 * @param aOrderFilter  An array of the unique sequence IDs specifying CertStore ordering.
   1.200 + 	 * @return				A pointer to an instance of the CUnifiedCertStore class.
   1.201 + 	 */
   1.202 + 	IMPORT_C static CUnifiedCertStore* NewLC(RFs& aFs, 
   1.203 + 	                                         TBool aOpenForWrite,
   1.204 + 	                                         RArray<TInt>& aOrderFilter);
   1.205 +	
   1.206 +	/**
   1.207 +	 * The destructor destroys all the resources owned by this object.
   1.208 +	 */
   1.209 +	IMPORT_C ~CUnifiedCertStore();
   1.210 +	
   1.211 +	/**
   1.212 +	 * Initializes the manager. 
   1.213 +	 * 
   1.214 +	 * It must be called after the manager has been constructed
   1.215 +	 * and before any call to the manager functions.
   1.216 +	 * 
   1.217 +	 * This is an asynchronous request.
   1.218 +	 * 
   1.219 +	 * @param aStatus	The request status object; contains the result of the Initialize() 
   1.220 +	 * 					request when complete. Set to KErrCancel if any outstanding request is cancelled.
   1.221 +	 */
   1.222 +	IMPORT_C void Initialize(TRequestStatus& aStatus);
   1.223 +
   1.224 +	/** 
   1.225 +	 * Cancels an ongoing Initialize() operation.
   1.226 +	 *
   1.227 +	 * The operation completes with KErrCancel.
   1.228 +	 */
   1.229 +	IMPORT_C void CancelInitialize();
   1.230 +
   1.231 +public:	// Implementation of MCertStore interface
   1.232 +
   1.233 +	/** Lists all certificates that satisfy the supplied filter.
   1.234 +	*
   1.235 +	* @param aCertInfos	An array that the returned certificates are added to .
   1.236 +	* @param aFilter	A filter to restrict which certificates are returned.
   1.237 +	* @param aStatus	The request status object.
   1.238 +	* 
   1.239 +	*/
   1.240 +	virtual void List(RMPointerArray<CCTCertInfo>& aCertInfos,
   1.241 +					  const CCertAttributeFilter& aFilter, TRequestStatus& aStatus);
   1.242 +	virtual void CancelList();
   1.243 +	virtual void GetCert(CCTCertInfo*& aCertInfo, const TCTTokenObjectHandle& aHandle, 
   1.244 +						 TRequestStatus& aStatus);
   1.245 +	virtual void CancelGetCert();
   1.246 +
   1.247 +	/** Gets the list of applications . Applications are represented by UIDs .
   1.248 +	* 	
   1.249 +	* @param aCertInfos		An array of certificates .
   1.250 +	* @param aApplications	An array that the returned application UIDs are added to.
   1.251 +	* @param aStatus		The request status object.
   1.252 +	*
   1.253 +	*/
   1.254 +	virtual void Applications(const CCTCertInfo& aCertInfo, 
   1.255 +							  RArray<TUid>& aApplications, TRequestStatus &aStatus);
   1.256 +	virtual void CancelApplications();
   1.257 +	virtual void IsApplicable(const CCTCertInfo& aCertInfo, TUid aApplication, 
   1.258 +							  TBool& aIsApplicable, TRequestStatus& aStatus);
   1.259 +	virtual void CancelIsApplicable();
   1.260 +	virtual void Trusted(const CCTCertInfo& aCertInfo, TBool& aTrusted, 
   1.261 +						 TRequestStatus& aStatus);
   1.262 +	virtual void CancelTrusted();
   1.263 +	virtual void Retrieve(const CCTCertInfo& aCertInfo, TDes8& aEncodedCert,
   1.264 +						  TRequestStatus& aStatus);
   1.265 +	virtual void CancelRetrieve();
   1.266 +
   1.267 +public:	// Functions defined in MCTWritableCertStore except Add functions
   1.268 +
   1.269 +	/**
   1.270 +	 * Removes a certificate.
   1.271 +	 * 
   1.272 +	 * @param aCertInfo				The certificate to be removed.
   1.273 +	 * @param aStatus				The request status object; contains the result of the Remove() 
   1.274 +	 * 								request when complete. Set to KErrCancel if an outstanding request is cancelled.
   1.275 +	 *
   1.276 +	 * @capability WriteUserData	This requires the WriteUserData capability when
   1.277 +	 *								applied to user certificates.
   1.278 +	 * @capability WriteDeviceData	This requires the WriteDeviceData capability
   1.279 +	 *								when applied to CA certificates.
   1.280 +	 * @leave KErrPermissionDenied	If the caller doesn't have the required
   1.281 +	 *								capabilities.
   1.282 +	 */
   1.283 +	IMPORT_C void Remove(const CCTCertInfo& aCertInfo, TRequestStatus& aStatus);
   1.284 +	
   1.285 +	/** 
   1.286 +	 * Cancels an ongoing Remove() operation.
   1.287 +	 *
   1.288 +	 * The operation completes with KErrCancel.
   1.289 +	 */
   1.290 +	IMPORT_C void CancelRemove();
   1.291 +	
   1.292 +	/**
   1.293 +	 * Replaces the current applicability settings with the settings in the
   1.294 +	 * supplied array.
   1.295 +	 * 
   1.296 +	 * This should only be called for CA certificates - it has no meaning for
   1.297 +	 * user certificates.
   1.298 +	 * 
   1.299 +	 * @param aCertInfo		The certificate whose applicability should be updated.
   1.300 +	 * @param aApplications	The new applicability settings. Ownership of this
   1.301 +	 * 						remains with the caller, and it must remain valid for the
   1.302 +	 * 						lifetime of the call.
   1.303 +	 * @param aStatus		The request status object; contains the result of the SetApplicability() 
   1.304 +	 * 						request when complete. Set to KErrCancel, if an outstanding request is cancelled.
   1.305 +	 *
   1.306 +	 * @capability WriteDeviceData	This requires the WriteDeviceData capability.
   1.307 +	 * @leave KErrPermissionDenied	If the caller doesn't have the required capabilities.
   1.308 +	 */
   1.309 +	IMPORT_C void SetApplicability(const CCTCertInfo& aCertInfo, 
   1.310 +		const RArray<TUid>& aApplications, TRequestStatus &aStatus);
   1.311 +	
   1.312 +	/** 
   1.313 +	 * Cancels an ongoing SetApplicability() operation.
   1.314 +	 *
   1.315 +	 * The operation completes with KErrCancel.
   1.316 +	 */
   1.317 +	IMPORT_C void CancelSetApplicability();
   1.318 +	
   1.319 +	/**
   1.320 +	 * Changes the trust settings.
   1.321 +	 * 
   1.322 +	 * A CA certificate is trusted if the user is willing to use it for authenticating
   1.323 +	 * servers. It has no meaning with other types of certificates.
   1.324 +	 * 
   1.325 +	 * @param aCertInfo	The certificate to be updated.
   1.326 +	 * @param aTrusted	ETrue, if trusted; EFalse, otherwise.
   1.327 +	 * @param aStatus	The request status object; contains the result of the SetTrust() 
   1.328 +	 * 					request when complete. Set to KErrCancel, if an outstanding request is cancelled.
   1.329 +	 *
   1.330 +	 * @capability WriteDeviceData This requires the WriteDeviceData capability.
   1.331 +	 * @leave KErrPermissionDenied If the caller doesn't have the required capabilities.
   1.332 +	 */
   1.333 +	IMPORT_C void SetTrust(const CCTCertInfo& aCertInfo, TBool aTrusted, 
   1.334 +		TRequestStatus& aStatus);
   1.335 +	
   1.336 +	/** 
   1.337 +	 * Cancels an ongoing SetTrust() operation.
   1.338 +	 *
   1.339 +	 * The operation completes with KErrCancel.
   1.340 +	 */
   1.341 +	IMPORT_C void CancelSetTrust();
   1.342 +
   1.343 +public:
   1.344 +	/**
   1.345 +	 * Lists all certificates that have a particular subject DN.
   1.346 +	 * 
   1.347 +	 * @param aCertInfos	An array that the returned certificates are added to
   1.348 +	 * @param aFilter		A filter to restrict which certificates are returned.
   1.349 +	 * @param aIssuer		Only certificates with this issuer DN will be returned
   1.350 +	 * @param aStatus		Asynchronous request status.
   1.351 +	 */
   1.352 +	IMPORT_C void List(RMPointerArray<CCTCertInfo>& aCertInfos,
   1.353 +					   const CCertAttributeFilter& aFilter, 
   1.354 +					   const TDesC8& aIssuer, 
   1.355 +					   TRequestStatus& aStatus);
   1.356 +
   1.357 +	/**
   1.358 +	 * Lists all certificates that have a particular issuer.
   1.359 +	 * 
   1.360 +	 * @param aCertInfos	An array that the returned certificates are added to
   1.361 +	 * @param aFilter		A filter to restrict which certificates are returned.
   1.362 +	 * @param aIssuers		Only certificates with this issuer will be returned
   1.363 +	 * @param aStatus		Asynchronous request status.
   1.364 +	 */
   1.365 +	IMPORT_C void List(RMPointerArray<CCTCertInfo>& aCertInfos,
   1.366 +					   const CCertAttributeFilter& aFilter, 
   1.367 +					   RPointerArray<const TDesC8> aIssuers, 
   1.368 +					   TRequestStatus& aStatus);
   1.369 +
   1.370 +	/**
   1.371 +	 * Retrieves a certificate as a parsed object.
   1.372 +	 *
   1.373 +	 * This will only work for certificates that have a CCertificate-derived
   1.374 +	 * representation, in other words X509 and WTLS certificates.  If called for
   1.375 +	 * a URL certificate, KErrNotSupported is returned.
   1.376 +	 * 
   1.377 +	 * @param aCertInfo	The certificate to retrieve
   1.378 +	 * @param aCert		The returned certificate.  This object can safely be up-cast
   1.379 +	 *					to a CX509Certificate or CWTLSCertificate if it's known that
   1.380 +	 *					that is the certificate format.
   1.381 +	 * @param aStatus	Asynchronous request status.
   1.382 +	 * 
   1.383 +	 * @capability ReadUserData		This requires the ReadUserData capability when
   1.384 +	 *								applied to user certificates, as these may contain
   1.385 +	 *								sensitive user data.
   1.386 +	 * @leave KErrPermissionDenied	If called for a user certificate when the
   1.387 +	 *								caller doesn't have the ReadUserData capability.
   1.388 +	 */
   1.389 +	IMPORT_C void Retrieve(const CCTCertInfo& aCertInfo, CCertificate*& aCert,
   1.390 +						   TRequestStatus& aStatus);
   1.391 +	
   1.392 +	/** 
   1.393 +	 * Gets the number of certificate stores.
   1.394 +	 *
   1.395 +	 * @return	The total number of certificate stores.
   1.396 +	 */
   1.397 +	IMPORT_C TInt CertStoreCount() const;
   1.398 +	
   1.399 +	/**
   1.400 +	 * Gets a particular certificate store.
   1.401 +	 * 
   1.402 +	 * @param aIndex	The index of the required certificate store.
   1.403 +	 *					A number between 0 and CertStoreCount() - 1.
   1.404 +	 * @return			The certificate store.
   1.405 +	 */
   1.406 +	IMPORT_C MCTCertStore& CertStore(TInt aIndex);
   1.407 +	
   1.408 +	/** 
   1.409 +	 * Gets the number of writeable certificate stores.
   1.410 +	 *
   1.411 +	 * @return	The number of writeable certificate stores.
   1.412 +	 */
   1.413 +	IMPORT_C TInt WritableCertStoreCount() const;
   1.414 +	
   1.415 +	/**
   1.416 +	 * Gets a particular writeable certificate store.
   1.417 +	 *
   1.418 +	 * @param aIndex	The index of the required certificate store.
   1.419 +	 *					A number between 0 and WriteableCertStoreCount() - 1.
   1.420 +	 * @return			The writeable certificate store.
   1.421 +	 */
   1.422 +	IMPORT_C MCTWritableCertStore& WritableCertStore(TInt aIndex);
   1.423 +	
   1.424 +	/** 
   1.425 +	 * Gets the number of read-only certificate stores.
   1.426 +	 *
   1.427 +	 * @return	The number of read-only certificate stores.
   1.428 +	 */
   1.429 +	IMPORT_C TInt ReadOnlyCertStoreCount() const;
   1.430 +	
   1.431 +	/**
   1.432 +	 * Gets a particular read-only certificate store.
   1.433 +	 * 
   1.434 +	 * @param aIndex	The index of the required certificate store.
   1.435 +	 *					A number between 0 and ReadOnlyCertStoreCount() - 1.
   1.436 +	 * @return			The read-only certificate store.
   1.437 +	 */
   1.438 +	IMPORT_C MCTCertStore& ReadOnlyCertStore(TInt aIndex);
   1.439 +
   1.440 +private:
   1.441 +	enum TState
   1.442 +		{
   1.443 +		EIdle,
   1.444 +
   1.445 +		EInitializeGetTokenList,
   1.446 +		EInitializeGetToken,
   1.447 +		EInitializeGetWritableInterface,
   1.448 +		EInitializeGetReadableInterface,
   1.449 +		EInitializeGetReadableInterfaceFinished,
   1.450 +		EInitializeFinished,
   1.451 +
   1.452 +		EList,
   1.453 +		ERetrieve,
   1.454 +		ERetrieveForList,
   1.455 +
   1.456 +		EGetCert,
   1.457 +		EApplications,
   1.458 +		EIsApplicable,
   1.459 +		ETrusted,
   1.460 +		ERetrieveData,
   1.461 +		ERemove,
   1.462 +		ESetApplicability,
   1.463 +		ESetTrust
   1.464 +		};
   1.465 +	enum TCompareResults
   1.466 +		{
   1.467 +		ENo,
   1.468 +		EYes,
   1.469 +		EMaybe
   1.470 +		};
   1.471 +private:
   1.472 +	CUnifiedCertStore(RFs& aFs, TBool aOpenForWrite);
   1.473 +	void ConstructL(RArray<TInt>& aOrderFilter);
   1.474 +	void DoCancel();
   1.475 +	void RunL();
   1.476 +	TInt RunError(TInt aError);
   1.477 +
   1.478 +	// Implementations for asynchronous operations
   1.479 +	void InitializeL();
   1.480 +	void ListL(RMPointerArray<CCTCertInfo>& aCertInfos,
   1.481 +			   const CCertAttributeFilter& aFilter);
   1.482 +	void ListL(RMPointerArray<CCTCertInfo>& aCertInfos,
   1.483 +			  const CCertAttributeFilter& aFilter, 
   1.484 +			  RPointerArray<const TDesC8> aIssuers);
   1.485 +	void RetrieveL(const CCTCertInfo& aCertInfo, CCertificate*& aCert);
   1.486 +	void GetCertL(CCTCertInfo*& aCertInfo, const TCTTokenObjectHandle& aHandle);
   1.487 +	void ApplicationsL(const CCTCertInfo& aCertInfo, RArray<TUid>& aApplications);
   1.488 +	void IsApplicableL(const CCTCertInfo& aCertInfo, TUid aApplication, 
   1.489 +					   TBool& aIsApplicable);
   1.490 +	void TrustedL(const CCTCertInfo& aCertInfo, TBool& aTrusted);
   1.491 +	void RetrieveDataL(const CCTCertInfo& aCertInfo, TDes8& aEncodedCert);
   1.492 +	void RemoveL(const CCTCertInfo& aCertInfo);
   1.493 +	void SetApplicabilityL(const CCTCertInfo& aCertInfo,
   1.494 +						   const RArray<TUid>& aApplications);
   1.495 +	void SetTrustL(const CCTCertInfo& aCertInfo, TBool aTrusted);
   1.496 +
   1.497 +	// Helper functions
   1.498 +	void AllocWorkingVarsL();
   1.499 +	void BeginAsyncOp(TRequestStatus& aStatus, TState aState);	
   1.500 +	void DestroyTemporaryMembers();
   1.501 +	MCTCertStore* GetCertStore(const TCTTokenObjectHandle& aHandle);
   1.502 +	void FindCertStoreL(const TCTTokenObjectHandle& aHandle);
   1.503 +	void FindWritableCertStoreL(const TCTTokenObjectHandle& aHandle);
   1.504 +	TCompareResults CompareCertInfoDN(const CCTCertInfo* aCertInfo);
   1.505 +	TBool MatchL(const CX500DistinguishedName& aName) const;
   1.506 +	void Complete(TInt aError);
   1.507 +	void CancelOutstandingRequest();
   1.508 + 	
   1.509 + 	// Filters CertStores according to specified order.
   1.510 + 	void ApplyOrderingL(RCPointerArray<CCTTokenTypeInfo>& aTokenTypes);
   1.511 + 	
   1.512 + 	void FilterTokenTypesL(RCPointerArray<CCTTokenTypeInfo>& aSearchTokenTypes,
   1.513 +						RCPointerArray<CCTTokenTypeInfo>& aTempTokenTypes,
   1.514 +						TInt aOrderAttribute);
   1.515 + 
   1.516 +private:
   1.517 +	/**
   1.518 +	 * A file server session, this is not logically a part of this class
   1.519 +	 * but is needed for the client store and the file certstore.
   1.520 +	 */
   1.521 +	RFs& iFs;
   1.522 +
   1.523 +	TBool iOpenedForWrite;
   1.524 +
   1.525 +	RPointerArray<CCheckedCertStore> iReadOnlyCertStores;
   1.526 +	RPointerArray<CCheckedCertStore> iWritableCertStores;
   1.527 +	RPointerArray<CCheckedCertStore> iCertStores;
   1.528 +
   1.529 +	TBool iCurrentlyDoingReadOnly;
   1.530 +
   1.531 +	/**
   1.532 +	 * This a TokenType retrieved from the iTokenTypes array.
   1.533 +	 * We use this to get a list of Tokens and to open these Tokens.
   1.534 +	 */
   1.535 +	MCTTokenType* iTokenType;
   1.536 +
   1.537 +	/**
   1.538 +	 * This is the list of Tokens for one of the Token Types of iTokenTypes.
   1.539 +	 */
   1.540 +	RCPointerArray<HBufC> iTokens;
   1.541 +
   1.542 +	/** All the UIDs of hardware token types */
   1.543 +	RArray<TUid> iHardwareTypeUids;
   1.544 +	/**
   1.545 +	 * This is used as an index for the iTokens array when we try 
   1.546 +	 * to get an interface to each of the tokens.
   1.547 +	 */
   1.548 +	TInt iIndexTokens;
   1.549 +
   1.550 +	/**
   1.551 +	 * A Token interface. We will use the interface to get a readable or writable
   1.552 +	 * certstore interface. The value is updated at EInitializeGetToken and used
   1.553 +	 * at EInitializeGetWritableInterface.
   1.554 +	 */
   1.555 +	MCTToken* iToken;
   1.556 +
   1.557 +	/**
   1.558 +	 * We use this to (temporarily) store the interface we obtained from iToken.
   1.559 +	 * It will be inserted in iWritableCertStores or iCertStores.
   1.560 +	 */
   1.561 +	MCTTokenInterface* iTokenInterface;
   1.562 +
   1.563 + 	/**
   1.564 + 	The index of the plugin certstore that is being processed
   1.565 + 	*/
   1.566 +	TInt iIndex;
   1.567 +
   1.568 +	/**
   1.569 +	 * This is the status of the caller of an asynchronous function. It must be set
   1.570 +	 * to KRequestPending by the function while doing the processing.
   1.571 +	 */
   1.572 +	TRequestStatus* iClientStatus;
   1.573 +
   1.574 +	TState iState;
   1.575 +
   1.576 +	TBool iIsInitialized;
   1.577 +
   1.578 +	/**
   1.579 +	 * This member holds all the variables that are only used to store temporary results
   1.580 +	 * while performing a given operation. It must be initialized at the start of the
   1.581 +	 * operation and deleted at the end of it whether the opeartion completes successfully
   1.582 +	 * or not. When no operation is being performed it must be 0.
   1.583 +	 */
   1.584 +	CUnifiedCertStoreWorkingVars* iWorkingVars;
   1.585 +
   1.586 +	/**
   1.587 +	 * The cert store in use by an outstanding async operation.
   1.588 +	 */
   1.589 +	MCTCertStore *iCurrentCertStore;
   1.590 +
   1.591 +	/**
   1.592 +	 * The writable cert store in use by an outstanding async operation.
   1.593 +	 */
   1.594 +	MCTWritableCertStore *iCurrentWritableCertStore;
   1.595 +
   1.596 +	// Padding to keep class size constant
   1.597 +	TInt32 iUnused1;
   1.598 +	TInt32 iUnused2;
   1.599 +	                  
   1.600 + 	// An array of Uids specifying Token Type ordering
   1.601 + 	RArray<TInt> iOrderAttributes;
   1.602 + 	
   1.603 + 	// Publish and subscribe property which is used to notify the 
   1.604 +	// cerificate addition,removal and application&trust setting.
   1.605 + 	RProperty iPSCertstoreChangeProperty;
   1.606 +
   1.607 +	};
   1.608 +
   1.609 +#endif