os/security/cryptoservices/certificateandkeymgmt/swicertstore/CSWICertStoreImpl.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 * CSWICertStoreImpl class implementation
    16 *
    17 */
    18 
    19 
    20 /**
    21  @file 
    22  @internalTechnology
    23 */
    24  
    25 #ifndef __CSWICERTSTOREIMPL_H__
    26 #define __CSWICERTSTOREIMPL_H__
    27 
    28 #include <e32std.h>
    29 #include <e32base.h>
    30 #include <s32file.h>
    31 #include <ct/rmpointerarray.h>
    32 #include <e32property.h>
    33 
    34 class MCTToken;
    35 class CCTCertInfo;
    36 class CSWICertStoreEntryList;
    37 class CCertAttributeFilter;
    38 class TCTTokenObjectHandle;
    39 class CSWICertStoreEntry;
    40 class TCertMetaInfo;
    41 
    42 /**
    43  * This class implements the guts of the SWI cert store.  It is mainly a cut
    44  * down version of the filetokens cert store server.
    45  */
    46 NONSHARABLE_CLASS(CSWICertStoreImpl) : public CActive
    47 	{
    48 public:
    49 	static CSWICertStoreImpl* NewL(MCTToken& aToken, RFs& aFs);
    50 	virtual ~CSWICertStoreImpl();
    51 
    52 public:
    53 	// For MCTCertStore
    54 	void ListL(RMPointerArray<CCTCertInfo>& aCerts,
    55 			   const CCertAttributeFilter& aFilter);
    56 	CCTCertInfo* GetCertL(const TCTTokenObjectHandle& aHandle);		
    57 	void ApplicationsL(const TCTTokenObjectHandle& aHandle, RArray<TUid>& aAplications);
    58 	TBool IsApplicableL(const TCTTokenObjectHandle& aHandle, TUid aApplication);
    59 	TBool TrustedL(const TCTTokenObjectHandle& aHandle);
    60 	void RetrieveL(const TCTTokenObjectHandle& aHandle, TDes8& aEncodedCert);
    61 
    62 	// Addtional meta-data accessors
    63 	const TCertMetaInfo& CertMetaInfoL(const TCTTokenObjectHandle& aHandle) const;	
    64 	
    65 private:
    66 	CSWICertStoreImpl(MCTToken& aToken, RFs& aFs);
    67 	void ConstructL();
    68 
    69 	// Open the Writable certstore and setup the iCEntryList
    70 	void SetupWritableCertStoreL();
    71 
    72 	// Open the ROM certstore and setup the iZEntryList
    73 	void SetupROMCertStoreL();
    74 	void SetupCompositeROMCertStoreL();
    75 	static void FilterCertificateListL(RMPointerArray<CCTCertInfo>& aCerts,
    76 			   const CCertAttributeFilter& aFilter, const CSWICertStoreEntryList& aEntryList);
    77 	static void AddIfMatchesFilterL(RMPointerArray<CCTCertInfo>& aCerts,
    78 			   const CCertAttributeFilter& aFilter, const CSWICertStoreEntry& aEntry);
    79 	const CSWICertStoreEntry* GetCSWICertStoreEntryL(const TCTTokenObjectHandle& aHandle, TBool& aCEntryHandle) const;
    80 	void MergeCertificateEntryListsL(const CSWICertStoreEntryList& aSourceList, TBool aIsZEntryList = EFalse );
    81 	
    82 protected:	//	From CActive
    83 	void DoCancel();
    84 	void RunL();
    85 
    86 private:
    87 	/// Cert store token
    88 	MCTToken& iToken;
    89 	
    90 	/// File server session
    91 	RFs& iFs;
    92 	
    93 	/// Persistent store containg the certs
    94 	CPermanentFileStore* iCStore;
    95 	CPermanentFileStore* iZStore;
    96 
    97 	/// The list of certificates contained in the store.
    98 	CSWICertStoreEntryList* iCEntryList;
    99 	CSWICertStoreEntryList* iZEntryList;
   100 	
   101 	TInt iCertIndex;
   102 	RProperty iSwicertstoreProperty;
   103 	RPointerArray<CPermanentFileStore> iZArrayOfStores;
   104 	/// Used to distinguish variant specific feature from the default. 
   105 	TUint8 iPatchableConst;
   106 	};
   107 	
   108 #endif