vpnengine/pkiservice/inc/pkiwrapper.h
changeset 0 33413c0669b9
child 1 c9c2ad51f972
equal deleted inserted replaced
-1:000000000000 0:33413c0669b9
       
     1 /*
       
     2 * Copyright (c) 2003-2008 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:   Defines common API for handling PKI certificates and keys.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #if !defined (__PKIWRAPPER_H__)
       
    21 #define __PKIWRAPPER_H__
       
    22 
       
    23 #include <e32base.h>
       
    24 
       
    25 #include "pkidefs.h"
       
    26 #include "pkiserviceclientservercommon.h"
       
    27 
       
    28 class CMapDescriptor;
       
    29 class CPKISupport;
       
    30 class CPKIMapper;
       
    31 
       
    32 class CPKIWrapper : public CActive
       
    33 {
       
    34     public:
       
    35         
       
    36         // Constructors, destructor
       
    37         static CPKIWrapper* NewL(CPKIMapper& aMapper);
       
    38         ~CPKIWrapper();
       
    39 
       
    40         ////////////////////////////////////////////////////////////////////////////////////////////
       
    41         // Interface
       
    42         ////////////////////////////////////////////////////////////////////////////////////////////
       
    43         TInt InitOperation(const RMessage2& aMessage);
       
    44         void CancelPendingOperation();
       
    45         TInt GetRequiredBufferSizeL(const RMessage2& aMessage);
       
    46         void CompleteRequestAndCleanupL();
       
    47 
       
    48         void InitializeL(const RMessage2& aMessage);        
       
    49         void SetTrusted(TBool aValue);
       
    50         void SetApplications(const RArray<TUid>& aApplUids);
       
    51                 
       
    52         void SetCertStoreType(TPkiServiceStoreType aStoreType);
       
    53                
       
    54         TPkiServiceStoreType CertStoreType() const;               
       
    55         
       
    56         void SetInformational(const TBool aInfoOnly);
       
    57         
       
    58         static void SaveIdentityL(CMapDescriptor &aCertMapping, 
       
    59                            const TDesC8& aCertDataIn,
       
    60                            TCertificateOwnerType aOwner);
       
    61     private: // From CActive    
       
    62         void RunL();
       
    63         void DoCancel();
       
    64         TInt RunError(TInt aError);
       
    65     
       
    66     private: // implementation   
       
    67         CPKIWrapper(CPKIMapper& aMapper);     
       
    68         void ConstructL();
       
    69 
       
    70         // ===================================================================================================================
       
    71         // Start phase functions
       
    72         // ===================================================================================================================              
       
    73         void StartSetTrustL();
       
    74         void StartTrustedL();
       
    75         void StartSetApplicabilityL();
       
    76         void StartApplicationsL();
       
    77 
       
    78         void StartRemoveCertificateL();
       
    79 
       
    80         // Certificate operations
       
    81         void StartReadCertificateL();
       
    82         // Peer or CA certificate
       
    83         void StartStoreCertificateL();
       
    84         // Enrollrd certificate
       
    85         void StartAttachCertificateL();
       
    86         
       
    87         // ===================================================================================================================
       
    88         // Execution phase functions
       
    89         // ===================================================================================================================
       
    90         // Crypto operations        
       
    91         void ExecuteSetTrustL();
       
    92         void ExecuteTrustedL();
       
    93         void ExecuteSetApplicabilityL();
       
    94         void ExecuteApplicationsL();
       
    95         void ExecuteRemoveCertificateL();
       
    96 
       
    97         // Certificate operations
       
    98         void ExecuteReadCertificateL();        
       
    99         // Peer or CA certificate
       
   100         void ExecuteStoreCertificateL();
       
   101         // Enrollrd certificate
       
   102         void ExecuteAttachCertificateL();
       
   103         
       
   104         
       
   105         enum TWrapperState
       
   106             {
       
   107             EExecute,
       
   108             EComplete
       
   109             };
       
   110         
       
   111         
       
   112         CPKIMapper&                         iMapper;
       
   113         CPKISupport*                        iPKISupport;
       
   114         TInt                                iIndex;
       
   115         CMapDescriptor*                     iCurrentMapping;
       
   116         TBuf<MAX_FILENAME_LENGTH>*          iObjectName;
       
   117         TInt                                iCurrentStatus;
       
   118         TWrapperState                       iCurrentState;
       
   119         TPckgBuf<TSecurityObjectDescriptor> iCurrentDescriptor;
       
   120         RMessage2                           iMessage;        
       
   121         HBufC8*                             iCertBuffer;
       
   122         TPtr8                               iPtrCertBuffer;
       
   123         TInt                                iRequiredBufferLength;
       
   124         RArray<TUid>                        iUidArray;
       
   125         TUint                               iCount;
       
   126 		TUint                               iMaxCount;		
       
   127 		TBool                               iTrusted;
       
   128 		
       
   129 		TBool                               iInfoOnly;
       
   130 
       
   131 };
       
   132 
       
   133 #endif