pkiutilities/DeviceToken/Inc/DevandTruSrvCertStoreServer.h
changeset 0 164170e6151a
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2 * Copyright (c) 2006 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 "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:   The header file of DevandTruSrvCertStoreServer
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __DEVANDTRUSRVCERTSTORESERVER_H__
       
    21 #define __DEVANDTRUSRVCERTSTORESERVER_H__
       
    22 
       
    23 #include <s32file.h>
       
    24 #include <e32std.h>
       
    25 #include <securitydefs.h>
       
    26 
       
    27 class CDevTokenCertInfo;
       
    28 class CDevandTruSrvCertStoreSession;
       
    29 class CDevandTruSrvCertStoreConduit;
       
    30 class CDevandTruSrvCertStoreEntry;
       
    31 class CDevandTruSrvCertStoreEntryList;
       
    32 class CCertAttributeFilter;
       
    33 class CTrustedSitesServer;
       
    34 
       
    35 struct TDevTokenAddCertDataStruct;
       
    36 
       
    37 /**
       
    38  *  class CDevandTruSrvCertStoreServer
       
    39  *
       
    40  * This class implements a certificate store which is stored on a file on the
       
    41  * device.  NewL calls the constructor and ConstructL. The constructor does
       
    42  * nothing except initializing to 0. ConstructL calls OpenStoreL, then RestoreL
       
    43  * and then sets the values of iStoreInfo.  OpenStoreL opens the store and
       
    44  * copies it from the ROM if necessary.  RestoreL()
       
    45  *
       
    46  *  @lib 
       
    47  *  @since S60 3.2
       
    48  */
       
    49 class CDevandTruSrvCertStoreServer : public CBase
       
    50     {
       
    51     public:
       
    52         
       
    53         static CDevandTruSrvCertStoreServer* NewL( CTrustedSitesServer* aTrustedSitesServer);
       
    54         
       
    55         virtual ~CDevandTruSrvCertStoreServer();
       
    56         
       
    57         CDevandTruSrvCertStoreSession* CreateSessionL();
       
    58 
       
    59     public:
       
    60         
       
    61         // List certs, returned pointers are owned by this class
       
    62         void ListL(const CCertAttributeFilter& aFilter, RPointerArray<CDevTokenCertInfo>& aCertsOut, const RMessage2& aMessage, TBool aFromTruSiteSrv ) const;
       
    63         
       
    64         // Get cert info, returned pointer owned by this class, leaves if not found
       
    65         const CDevTokenCertInfo& GetCertL(TInt aHandle) const;
       
    66         
       
    67         const RArray<TUid>& ApplicationsL(TInt aHandle) const;  
       
    68         
       
    69         TBool IsApplicableL(TInt aHandle, TUid aApplication) const;
       
    70         
       
    71         TBool TrustedL(TInt aHandle) const;
       
    72         
       
    73         HBufC8* RetrieveLC(TInt aHandle, const RMessage2& aMessage, TBool aFromTruSiteSrv ) const;
       
    74         
       
    75         void AddL(const TDevTokenAddCertDataStruct& aInfo,
       
    76                   const TDesC8& aCert,
       
    77                   const RMessage2& aMessage, TBool aFromTruSiteSrv );
       
    78         
       
    79         void RemoveL(TInt aHandle, const RMessage2& aMessage, TBool aFromTruSiteSrv );
       
    80         
       
    81         void SetApplicabilityL(TInt aHandle,
       
    82                                const RArray<TUid>& aApplications,
       
    83                                const RMessage2& aMessage);
       
    84         
       
    85         void SetTrustL(TInt aHandle,
       
    86                        TBool aTrusted,
       
    87                        const RMessage2& aMessage);
       
    88 
       
    89     private:
       
    90         
       
    91         CDevandTruSrvCertStoreServer( CTrustedSitesServer* aTrustedSitesServer );
       
    92         
       
    93         void ConstructL();
       
    94         
       
    95         // Security policy
       
    96         const TSecurityPolicy& AddRemovePolicy(TCertificateOwnerType aOwnerType) const;
       
    97         
       
    98         const TSecurityPolicy& RetrievePolicy(TCertificateOwnerType aOwnerType) const;
       
    99         
       
   100         const TSecurityPolicy& ListPolicy(TCertificateOwnerType aOwnerType) const;
       
   101         
       
   102         const TSecurityPolicy& WriteTrustSettingsPolicy() const;
       
   103         
       
   104         TBool CertEntryMatchesFilter(const CCertAttributeFilter& aFilter,
       
   105         
       
   106         const CDevandTruSrvCertStoreEntry& aEntry) const;
       
   107         
       
   108         void DoAddL(const CDevTokenCertInfo& aCertInfo, const TDesC8& aCertData);
       
   109         
       
   110         TStreamId WriteCertDataStreamL(const TDesC8& aData);
       
   111         
       
   112         // Write the cert entry list to the store
       
   113         void UpdateStoreL();
       
   114         
       
   115         void CompactStoreL();
       
   116         
       
   117         // Open the store and load the index from a file
       
   118         void RestoreL(const TDesC& aFilename);
       
   119         
       
   120         // Open the store file, copying from ROM or creating it first if necessary
       
   121         void OpenStoreL();
       
   122         
       
   123         // Create an empty store file, and leave it closed
       
   124         void CreateStoreFileL(const TDesC& aFile);
       
   125         
       
   126         void DoCreateStoreFileL(const TDesC& aFile);
       
   127 
       
   128     private:
       
   129         
       
   130         // Conduit for marshalling/unmarshalling client communications
       
   131         
       
   132         CDevandTruSrvCertStoreConduit* iConduit;
       
   133         
       
   134         RFs iFs;
       
   135         
       
   136         CPermanentFileStore* iStore;
       
   137         
       
   138         // The list of certificates contained in the store.
       
   139         
       
   140         CDevandTruSrvCertStoreEntryList* iEntryList;
       
   141         
       
   142         // The store stream containing the list of certs
       
   143         TStreamId iStreamId;
       
   144         
       
   145         CTrustedSitesServer* iTrustedSitesServer; //Not owned;
       
   146     };
       
   147 
       
   148 #endif  //__DEVANDTRUSRVCERTSTORESERVER_H__
       
   149 
       
   150 //EOF
       
   151