cryptoservices/certificateandkeymgmt/inc/unifiedcertstore_v2.h
changeset 0 2c201484c85f
child 8 35751d3474b7
equal deleted inserted replaced
-1:000000000000 0:2c201484c85f
       
     1 /*
       
     2 * Copyright (c) 2001-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 * UNIFIEDCERTSTORE.H
       
    16 * The unified certificate store implementation
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 /**
       
    24  @file 
       
    25  @internalTechnology
       
    26  @released
       
    27 */
       
    28  
       
    29 #ifndef __UNIFIEDCERTSTORE_H__
       
    30 #define __UNIFIEDCERTSTORE_H__
       
    31 
       
    32 class CCertificate;
       
    33 
       
    34 #include <signed.h>
       
    35 #include <e32std.h>
       
    36 #include <f32file.h>
       
    37 #include <e32property.h>
       
    38 #include <sacls.h>
       
    39 #include <mcertstore.h>
       
    40 #include <ct/rmpointerarray.h>
       
    41 #include <ct/rcpointerarray.h>
       
    42 
       
    43 
       
    44 
       
    45 
       
    46 /**  
       
    47  *
       
    48  * Publish and Subscribe - UnifiedCertSTore Category
       
    49  * Aliased here to System Category to prevent SC break.
       
    50  *
       
    51  */
       
    52 const TUid KUnifiedCertStorePropertyCat = {KUidSystemCategoryValue};
       
    53 
       
    54 /**  
       
    55  *
       
    56  * Publish and subscribe key for UnifiedCertSTore.
       
    57  */
       
    58 enum TUnifiedCertStoreKey
       
    59 	{
       
    60 	/**  
       
    61  	 *
       
    62  	 * The Publish and subscribe key for the certstore changes.
       
    63 	 * If the client of the UnifiedCertstore needs to be notified when
       
    64 	 * certificate addition, removal and trust&application setting occurs,
       
    65 	 * the client needs to subscribe to KUnifiedCertStorePropertyCat and
       
    66 	 * EUnifiedCertStoreFlag.
       
    67 	 *
       
    68 	 * Aliased here to KUidUnifiedCertstore flag to avoid SC break.
       
    69  	 */
       
    70  	EUnifiedCertStoreFlag = KUidUnifiedCertstoreFlag
       
    71  	};
       
    72 
       
    73 /**
       
    74  *
       
    75  * The Unique ID for unknown hardware certstore, used as the input parameter when it is to be filtered.
       
    76  * @deprecated. Used only for Data compatibility.
       
    77  */
       
    78 
       
    79 const TInt KUnknownHardwareCertStore = 0;
       
    80 
       
    81 
       
    82 /**
       
    83  *
       
    84  * The Unique ID for mutable software certstore, used as the input parameter when it is to be filtered.
       
    85  *
       
    86  */
       
    87 
       
    88 const TInt KThirdPartyCertStore = 1;
       
    89 
       
    90 
       
    91 /**
       
    92  *
       
    93  * The Unique ID for SIM certstore, used as the input parameter when it is to be filtered.
       
    94  *
       
    95  */
       
    96 
       
    97 const TInt KSIMCertStore  = 2;
       
    98 
       
    99 /**
       
   100  *
       
   101  * The Unique ID for WIM certstore, used as the input parameter when it is to be filtered.
       
   102  *  
       
   103  */
       
   104 
       
   105 const TInt KWIMCertStore  = 3;
       
   106 
       
   107 /**  
       
   108  *
       
   109  * The Unique ID for UICC certstore, used as the input parameter when it is to be filtered.
       
   110  *  
       
   111  */
       
   112 const TInt KUICCCertStore = 4;
       
   113 
       
   114 /**  
       
   115  *
       
   116  * The Unique ID for immutable software certstore, used as the input parameter when it is to be filtered.
       
   117  *  
       
   118  */
       
   119 
       
   120 const TInt KManufactureCertStore = 5;
       
   121 
       
   122 // Forward declarations
       
   123 class MCTCertStore;
       
   124 class MCTWritableCertStore;
       
   125 class MCTTokenInterface;
       
   126 class MCTToken;
       
   127 class MCTTokenType;
       
   128 class CCTCertInfo;
       
   129 class CCertAttributeFilter;
       
   130 class CCTTokenTypeInfo;
       
   131 class TCTTokenObjectHandle;
       
   132 class CCheckedCertStore;
       
   133 
       
   134 // This class is forward declared to avoid including its definition in this
       
   135 // exported header file because it must only be used internally.
       
   136 class CUnifiedCertStoreWorkingVars;
       
   137 class CX500DistinguishedName;
       
   138 
       
   139 /**
       
   140  * The unified certificate store.
       
   141  * 
       
   142  * This class provides a certificate store whose contents are the sum of the
       
   143  * contents of all certificate store implementations on the device.  It is
       
   144  * intended as the single point of access for clients wishing to use certificate
       
   145  * stores.
       
   146  *
       
   147  * Since this class is intended for widespread use, capability checks relating
       
   148  * to certificate access are documented here even though the checks are actually
       
   149  * made in the individual cert store implementations.
       
   150  * 
       
   151  * @publishedAll
       
   152  * @released
       
   153  */
       
   154 NONSHARABLE_CLASS(CUnifiedCertStore) : public CActive, public MCertStore
       
   155 	{
       
   156 public:
       
   157 	/** 
       
   158 	 * Creates a new CUnifiedCertStore
       
   159 	 *
       
   160 	 * @param aFs			A file server session. It must already be open.
       
   161 	 * @param aOpenForWrite	ETrue if the stores must be opened with write access
       
   162 	 *						(e.g. for adding certificates) and EFalse if the user 
       
   163 	 *						only needs read-only access.
       
   164 	 * @return				A pointer to an instance of the CUnifiedCertStore class.
       
   165 	 */
       
   166 	IMPORT_C static CUnifiedCertStore* NewL(RFs& aFs, TBool aOpenForWrite);
       
   167 	
       
   168 	/** 
       
   169 	 * Creates a new CUnifiedCertStore and pushes it on the cleanup stack.
       
   170 	 *
       
   171 	 * @param aFs			A file server session. It must already be open.
       
   172 	 * @param aOpenForWrite	ETrue if the stores must be opened with write access
       
   173 	 *						(e.g. for adding certificates) and EFalse if the user
       
   174 	 *						only needs read-only access.
       
   175 	 * @return				A pointer to an instance of the CUnifiedCertStore class.
       
   176 	 */
       
   177 	IMPORT_C static CUnifiedCertStore* NewLC(RFs& aFs, TBool aOpenForWrite);
       
   178  	/** 
       
   179  	 * Creates a new CUnifiedCertStore with the sequence filter, so that multiple certstores that are managed
       
   180 	 * by it will be filtered and ordered.
       
   181  	 *
       
   182  	 * @param aFs			A file server session. It must already be open.
       
   183  	 * @param aOpenForWrite	ETrue if the stores must be opened with write access
       
   184  	 *						(e.g. for adding certificates) and EFalse if the user
       
   185  	 *						only needs read-only access. Ownership is taken.
       
   186  	 * @param aOrderFilter  An array of the unique sequence IDs specifying CertStore ordering.
       
   187  	 * @return				A pointer to an instance of the CUnifiedCertStore class.
       
   188  	 */
       
   189  	IMPORT_C static CUnifiedCertStore* NewL(RFs& aFs, 
       
   190  	                                        TBool aOpenForWrite,
       
   191  	                                        RArray<TInt>& aOrderFilter);
       
   192  	/** 
       
   193  	 * Creates a new CUnifiedCertStore with the sequence filter, so that multiple certstores that are managed
       
   194 	 * by it will be filtered and ordered, and it is pushed on the cleanup stack.
       
   195  	 *
       
   196  	 * @param aFs			A file server session. It must already be open.
       
   197  	 * @param aOpenForWrite	ETrue if the stores must be opened with write access
       
   198  	 *						(e.g. for adding certificates) and EFalse if the user
       
   199  	 *						only needs read-only access. Ownership is taken.
       
   200  	 * @param aOrderFilter  An array of the unique sequence IDs specifying CertStore ordering.
       
   201  	 * @return				A pointer to an instance of the CUnifiedCertStore class.
       
   202  	 */
       
   203  	IMPORT_C static CUnifiedCertStore* NewLC(RFs& aFs, 
       
   204  	                                         TBool aOpenForWrite,
       
   205  	                                         RArray<TInt>& aOrderFilter);
       
   206 	
       
   207 	/**
       
   208 	 * The destructor destroys all the resources owned by this object.
       
   209 	 */
       
   210 	IMPORT_C ~CUnifiedCertStore();
       
   211 	
       
   212 	/**
       
   213 	 * Initializes the manager. 
       
   214 	 * 
       
   215 	 * It must be called after the manager has been constructed
       
   216 	 * and before any call to the manager functions.
       
   217 	 * 
       
   218 	 * This is an asynchronous request.
       
   219 	 * 
       
   220 	 * @param aStatus	The request status object; contains the result of the Initialize() 
       
   221 	 * 					request when complete. Set to KErrCancel if any outstanding request is cancelled.
       
   222 	 */
       
   223 	IMPORT_C void Initialize(TRequestStatus& aStatus);
       
   224 
       
   225 	/** 
       
   226 	 * Cancels an ongoing Initialize() operation.
       
   227 	 *
       
   228 	 * The operation completes with KErrCancel.
       
   229 	 */
       
   230 	IMPORT_C void CancelInitialize();
       
   231 
       
   232 public:	// Implementation of MCertStore interface
       
   233 
       
   234 	/** Lists all certificates that satisfy the supplied filter.
       
   235 	*
       
   236 	* @param aCertInfos	An array that the returned certificates are added to .
       
   237 	* @param aFilter	A filter to restrict which certificates are returned.
       
   238 	* @param aStatus	The request status object.
       
   239 	* 
       
   240 	*/
       
   241 	virtual void List(RMPointerArray<CCTCertInfo>& aCertInfos,
       
   242 					  const CCertAttributeFilter& aFilter, TRequestStatus& aStatus);
       
   243 	virtual void CancelList();
       
   244 	virtual void GetCert(CCTCertInfo*& aCertInfo, const TCTTokenObjectHandle& aHandle, 
       
   245 						 TRequestStatus& aStatus);
       
   246 	virtual void CancelGetCert();
       
   247 
       
   248 	/** Gets the list of applications . Applications are represented by UIDs .
       
   249 	* 	
       
   250 	* @param aCertInfos		An array of certificates .
       
   251 	* @param aApplications	An array that the returned application UIDs are added to.
       
   252 	* @param aStatus		The request status object.
       
   253 	*
       
   254 	*/
       
   255 	virtual void Applications(const CCTCertInfo& aCertInfo, 
       
   256 							  RArray<TUid>& aApplications, TRequestStatus &aStatus);
       
   257 	virtual void CancelApplications();
       
   258 	virtual void IsApplicable(const CCTCertInfo& aCertInfo, TUid aApplication, 
       
   259 							  TBool& aIsApplicable, TRequestStatus& aStatus);
       
   260 	virtual void CancelIsApplicable();
       
   261 	virtual void Trusted(const CCTCertInfo& aCertInfo, TBool& aTrusted, 
       
   262 						 TRequestStatus& aStatus);
       
   263 	virtual void CancelTrusted();
       
   264 	virtual void Retrieve(const CCTCertInfo& aCertInfo, TDes8& aEncodedCert,
       
   265 						  TRequestStatus& aStatus);
       
   266 	virtual void CancelRetrieve();
       
   267 
       
   268 public:	// Functions defined in MCTWritableCertStore except Add functions
       
   269 
       
   270 	/**
       
   271 	 * Removes a certificate.
       
   272 	 * 
       
   273 	 * @param aCertInfo				The certificate to be removed.
       
   274 	 * @param aStatus				The request status object; contains the result of the Remove() 
       
   275 	 * 								request when complete. Set to KErrCancel if an outstanding request is cancelled.
       
   276 	 *
       
   277 	 * @capability WriteUserData	This requires the WriteUserData capability when
       
   278 	 *								applied to user certificates.
       
   279 	 * @capability WriteDeviceData	This requires the WriteDeviceData capability
       
   280 	 *								when applied to CA certificates.
       
   281 	 * @leave KErrPermissionDenied	If the caller doesn't have the required
       
   282 	 *								capabilities.
       
   283 	 */
       
   284 	IMPORT_C void Remove(const CCTCertInfo& aCertInfo, TRequestStatus& aStatus);
       
   285 	
       
   286 	/** 
       
   287 	 * Cancels an ongoing Remove() operation.
       
   288 	 *
       
   289 	 * The operation completes with KErrCancel.
       
   290 	 */
       
   291 	IMPORT_C void CancelRemove();
       
   292 	
       
   293 	/**
       
   294 	 * Replaces the current applicability settings with the settings in the
       
   295 	 * supplied array.
       
   296 	 * 
       
   297 	 * This should only be called for CA certificates - it has no meaning for
       
   298 	 * user certificates.
       
   299 	 * 
       
   300 	 * @param aCertInfo		The certificate whose applicability should be updated.
       
   301 	 * @param aApplications	The new applicability settings. Ownership of this
       
   302 	 * 						remains with the caller, and it must remain valid for the
       
   303 	 * 						lifetime of the call.
       
   304 	 * @param aStatus		The request status object; contains the result of the SetApplicability() 
       
   305 	 * 						request when complete. Set to KErrCancel, if an outstanding request is cancelled.
       
   306 	 *
       
   307 	 * @capability WriteDeviceData	This requires the WriteDeviceData capability.
       
   308 	 * @leave KErrPermissionDenied	If the caller doesn't have the required capabilities.
       
   309 	 */
       
   310 	IMPORT_C void SetApplicability(const CCTCertInfo& aCertInfo, 
       
   311 		const RArray<TUid>& aApplications, TRequestStatus &aStatus);
       
   312 	
       
   313 	/** 
       
   314 	 * Cancels an ongoing SetApplicability() operation.
       
   315 	 *
       
   316 	 * The operation completes with KErrCancel.
       
   317 	 */
       
   318 	IMPORT_C void CancelSetApplicability();
       
   319 	
       
   320 	/**
       
   321 	 * Changes the trust settings.
       
   322 	 * 
       
   323 	 * A CA certificate is trusted if the user is willing to use it for authenticating
       
   324 	 * servers. It has no meaning with other types of certificates.
       
   325 	 * 
       
   326 	 * @param aCertInfo	The certificate to be updated.
       
   327 	 * @param aTrusted	ETrue, if trusted; EFalse, otherwise.
       
   328 	 * @param aStatus	The request status object; contains the result of the SetTrust() 
       
   329 	 * 					request when complete. Set to KErrCancel, if an outstanding request is cancelled.
       
   330 	 *
       
   331 	 * @capability WriteDeviceData This requires the WriteDeviceData capability.
       
   332 	 * @leave KErrPermissionDenied If the caller doesn't have the required capabilities.
       
   333 	 */
       
   334 	IMPORT_C void SetTrust(const CCTCertInfo& aCertInfo, TBool aTrusted, 
       
   335 		TRequestStatus& aStatus);
       
   336 	
       
   337 	/** 
       
   338 	 * Cancels an ongoing SetTrust() operation.
       
   339 	 *
       
   340 	 * The operation completes with KErrCancel.
       
   341 	 */
       
   342 	IMPORT_C void CancelSetTrust();
       
   343 
       
   344 public:
       
   345 	/**
       
   346 	 * Lists all certificates that have a particular subject DN.
       
   347 	 * 
       
   348 	 * @param aCertInfos	An array that the returned certificates are added to
       
   349 	 * @param aFilter		A filter to restrict which certificates are returned.
       
   350 	 * @param aIssuer		Only certificates with this issuer DN will be returned
       
   351 	 * @param aStatus		Asynchronous request status.
       
   352 	 */
       
   353 	IMPORT_C void List(RMPointerArray<CCTCertInfo>& aCertInfos,
       
   354 					   const CCertAttributeFilter& aFilter, 
       
   355 					   const TDesC8& aIssuer, 
       
   356 					   TRequestStatus& aStatus);
       
   357 
       
   358 	/**
       
   359 	 * Lists all certificates that have a particular issuer.
       
   360 	 * 
       
   361 	 * @param aCertInfos	An array that the returned certificates are added to
       
   362 	 * @param aFilter		A filter to restrict which certificates are returned.
       
   363 	 * @param aIssuers		Only certificates with this issuer will be returned
       
   364 	 * @param aStatus		Asynchronous request status.
       
   365 	 */
       
   366 	IMPORT_C void List(RMPointerArray<CCTCertInfo>& aCertInfos,
       
   367 					   const CCertAttributeFilter& aFilter, 
       
   368 					   RPointerArray<const TDesC8> aIssuers, 
       
   369 					   TRequestStatus& aStatus);
       
   370 
       
   371 	/**
       
   372 	 * Retrieves a certificate as a parsed object.
       
   373 	 *
       
   374 	 * This will only work for certificates that have a CCertificate-derived
       
   375 	 * representation, in other words X509 and WTLS certificates.  If called for
       
   376 	 * a URL certificate, KErrNotSupported is returned.
       
   377 	 * 
       
   378 	 * @param aCertInfo	The certificate to retrieve
       
   379 	 * @param aCert		The returned certificate.  This object can safely be up-cast
       
   380 	 *					to a CX509Certificate or CWTLSCertificate if it's known that
       
   381 	 *					that is the certificate format.
       
   382 	 * @param aStatus	Asynchronous request status.
       
   383 	 * 
       
   384 	 * @capability ReadUserData		This requires the ReadUserData capability when
       
   385 	 *								applied to user certificates, as these may contain
       
   386 	 *								sensitive user data.
       
   387 	 * @leave KErrPermissionDenied	If called for a user certificate when the
       
   388 	 *								caller doesn't have the ReadUserData capability.
       
   389 	 */
       
   390 	IMPORT_C void Retrieve(const CCTCertInfo& aCertInfo, CCertificate*& aCert,
       
   391 						   TRequestStatus& aStatus);
       
   392 	
       
   393 	/** 
       
   394 	 * Gets the number of certificate stores.
       
   395 	 *
       
   396 	 * @return	The total number of certificate stores.
       
   397 	 */
       
   398 	IMPORT_C TInt CertStoreCount() const;
       
   399 	
       
   400 	/**
       
   401 	 * Gets a particular certificate store.
       
   402 	 * 
       
   403 	 * @param aIndex	The index of the required certificate store.
       
   404 	 *					A number between 0 and CertStoreCount() - 1.
       
   405 	 * @return			The certificate store.
       
   406 	 */
       
   407 	IMPORT_C MCTCertStore& CertStore(TInt aIndex);
       
   408 	
       
   409 	/** 
       
   410 	 * Gets the number of writeable certificate stores.
       
   411 	 *
       
   412 	 * @return	The number of writeable certificate stores.
       
   413 	 */
       
   414 	IMPORT_C TInt WritableCertStoreCount() const;
       
   415 	
       
   416 	/**
       
   417 	 * Gets a particular writeable certificate store.
       
   418 	 *
       
   419 	 * @param aIndex	The index of the required certificate store.
       
   420 	 *					A number between 0 and WriteableCertStoreCount() - 1.
       
   421 	 * @return			The writeable certificate store.
       
   422 	 */
       
   423 	IMPORT_C MCTWritableCertStore& WritableCertStore(TInt aIndex);
       
   424 	
       
   425 	/** 
       
   426 	 * Gets the number of read-only certificate stores.
       
   427 	 *
       
   428 	 * @return	The number of read-only certificate stores.
       
   429 	 */
       
   430 	IMPORT_C TInt ReadOnlyCertStoreCount() const;
       
   431 	
       
   432 	/**
       
   433 	 * Gets a particular read-only certificate store.
       
   434 	 * 
       
   435 	 * @param aIndex	The index of the required certificate store.
       
   436 	 *					A number between 0 and ReadOnlyCertStoreCount() - 1.
       
   437 	 * @return			The read-only certificate store.
       
   438 	 */
       
   439 	IMPORT_C MCTCertStore& ReadOnlyCertStore(TInt aIndex);
       
   440 
       
   441 private:
       
   442 	enum TState
       
   443 		{
       
   444 		EIdle,
       
   445 
       
   446 		EInitializeGetTokenList,
       
   447 		EInitializeGetToken,
       
   448 		EInitializeGetWritableInterface,
       
   449 		EInitializeGetReadableInterface,
       
   450 		EInitializeGetReadableInterfaceFinished,
       
   451 		EInitializeFinished,
       
   452 
       
   453 		EList,
       
   454 		ERetrieve,
       
   455 		ERetrieveForList,
       
   456 
       
   457 		EGetCert,
       
   458 		EApplications,
       
   459 		EIsApplicable,
       
   460 		ETrusted,
       
   461 		ERetrieveData,
       
   462 		ERemove,
       
   463 		ESetApplicability,
       
   464 		ESetTrust
       
   465 		};
       
   466 	enum TCompareResults
       
   467 		{
       
   468 		ENo,
       
   469 		EYes,
       
   470 		EMaybe
       
   471 		};
       
   472 private:
       
   473 	CUnifiedCertStore(RFs& aFs, TBool aOpenForWrite);
       
   474 	void ConstructL(RArray<TInt>& aOrderFilter);
       
   475 	void DoCancel();
       
   476 	void RunL();
       
   477 	TInt RunError(TInt aError);
       
   478 
       
   479 	// Implementations for asynchronous operations
       
   480 	void InitializeL();
       
   481 	void ListL(RMPointerArray<CCTCertInfo>& aCertInfos,
       
   482 			   const CCertAttributeFilter& aFilter);
       
   483 	void ListL(RMPointerArray<CCTCertInfo>& aCertInfos,
       
   484 			  const CCertAttributeFilter& aFilter, 
       
   485 			  RPointerArray<const TDesC8> aIssuers);
       
   486 	void RetrieveL(const CCTCertInfo& aCertInfo, CCertificate*& aCert);
       
   487 	void GetCertL(CCTCertInfo*& aCertInfo, const TCTTokenObjectHandle& aHandle);
       
   488 	void ApplicationsL(const CCTCertInfo& aCertInfo, RArray<TUid>& aApplications);
       
   489 	void IsApplicableL(const CCTCertInfo& aCertInfo, TUid aApplication, 
       
   490 					   TBool& aIsApplicable);
       
   491 	void TrustedL(const CCTCertInfo& aCertInfo, TBool& aTrusted);
       
   492 	void RetrieveDataL(const CCTCertInfo& aCertInfo, TDes8& aEncodedCert);
       
   493 	void RemoveL(const CCTCertInfo& aCertInfo);
       
   494 	void SetApplicabilityL(const CCTCertInfo& aCertInfo,
       
   495 						   const RArray<TUid>& aApplications);
       
   496 	void SetTrustL(const CCTCertInfo& aCertInfo, TBool aTrusted);
       
   497 
       
   498 	// Helper functions
       
   499 	void AllocWorkingVarsL();
       
   500 	void BeginAsyncOp(TRequestStatus& aStatus, TState aState);	
       
   501 	void DestroyTemporaryMembers();
       
   502 	MCTCertStore* GetCertStore(const TCTTokenObjectHandle& aHandle);
       
   503 	void FindCertStoreL(const TCTTokenObjectHandle& aHandle);
       
   504 	void FindWritableCertStoreL(const TCTTokenObjectHandle& aHandle);
       
   505 	TCompareResults CompareCertInfoDN(const CCTCertInfo* aCertInfo);
       
   506 	TBool MatchL(const CX500DistinguishedName& aName) const;
       
   507 	void Complete(TInt aError);
       
   508 	void CancelOutstandingRequest();
       
   509  	
       
   510  	// Filters CertStores according to specified order.
       
   511  	void ApplyOrderingL(RCPointerArray<CCTTokenTypeInfo>& aTokenTypes);
       
   512  	
       
   513  	void FilterTokenTypesL(RCPointerArray<CCTTokenTypeInfo>& aSearchTokenTypes,
       
   514 						RCPointerArray<CCTTokenTypeInfo>& aTempTokenTypes,
       
   515 						TInt aOrderAttribute);
       
   516  
       
   517 private:
       
   518 	/**
       
   519 	 * A file server session, this is not logically a part of this class
       
   520 	 * but is needed for the client store and the file certstore.
       
   521 	 */
       
   522 	RFs& iFs;
       
   523 
       
   524 	TBool iOpenedForWrite;
       
   525 
       
   526 	RPointerArray<CCheckedCertStore> iReadOnlyCertStores;
       
   527 	RPointerArray<CCheckedCertStore> iWritableCertStores;
       
   528 	RPointerArray<CCheckedCertStore> iCertStores;
       
   529 
       
   530 	TBool iCurrentlyDoingReadOnly;
       
   531 
       
   532 	/**
       
   533 	 * This a TokenType retrieved from the iTokenTypes array.
       
   534 	 * We use this to get a list of Tokens and to open these Tokens.
       
   535 	 */
       
   536 	MCTTokenType* iTokenType;
       
   537 
       
   538 	/**
       
   539 	 * This is the list of Tokens for one of the Token Types of iTokenTypes.
       
   540 	 */
       
   541 	RCPointerArray<HBufC> iTokens;
       
   542 
       
   543 	/** All the UIDs of hardware token types */
       
   544 	RArray<TUid> iHardwareTypeUids;
       
   545 	/**
       
   546 	 * This is used as an index for the iTokens array when we try 
       
   547 	 * to get an interface to each of the tokens.
       
   548 	 */
       
   549 	TInt iIndexTokens;
       
   550 
       
   551 	/**
       
   552 	 * A Token interface. We will use the interface to get a readable or writable
       
   553 	 * certstore interface. The value is updated at EInitializeGetToken and used
       
   554 	 * at EInitializeGetWritableInterface.
       
   555 	 */
       
   556 	MCTToken* iToken;
       
   557 
       
   558 	/**
       
   559 	 * We use this to (temporarily) store the interface we obtained from iToken.
       
   560 	 * It will be inserted in iWritableCertStores or iCertStores.
       
   561 	 */
       
   562 	MCTTokenInterface* iTokenInterface;
       
   563 
       
   564  	/**
       
   565  	The index of the plugin certstore that is being processed
       
   566  	*/
       
   567 	TInt iIndex;
       
   568 
       
   569 	/**
       
   570 	 * This is the status of the caller of an asynchronous function. It must be set
       
   571 	 * to KRequestPending by the function while doing the processing.
       
   572 	 */
       
   573 	TRequestStatus* iClientStatus;
       
   574 
       
   575 	TState iState;
       
   576 
       
   577 	TBool iIsInitialized;
       
   578 
       
   579 	/**
       
   580 	 * This member holds all the variables that are only used to store temporary results
       
   581 	 * while performing a given operation. It must be initialized at the start of the
       
   582 	 * operation and deleted at the end of it whether the opeartion completes successfully
       
   583 	 * or not. When no operation is being performed it must be 0.
       
   584 	 */
       
   585 	CUnifiedCertStoreWorkingVars* iWorkingVars;
       
   586 
       
   587 	/**
       
   588 	 * The cert store in use by an outstanding async operation.
       
   589 	 */
       
   590 	MCTCertStore *iCurrentCertStore;
       
   591 
       
   592 	/**
       
   593 	 * The writable cert store in use by an outstanding async operation.
       
   594 	 */
       
   595 	MCTWritableCertStore *iCurrentWritableCertStore;
       
   596 
       
   597 	// Padding to keep class size constant
       
   598 	TInt32 iUnused1;
       
   599 	TInt32 iUnused2;
       
   600 	                  
       
   601  	// An array of Uids specifying Token Type ordering
       
   602  	RArray<TInt> iOrderAttributes;
       
   603  	
       
   604  	// Publish and subscribe property which is used to notify the 
       
   605 	// cerificate addition,removal and application&trust setting.
       
   606  	RProperty iPSCertstoreChangeProperty;
       
   607 
       
   608 	};
       
   609 
       
   610 #endif