cpsecplugins/cpadvancedsecplugin/inc/advsecsettingscertmover_symbian.h
changeset 63 989397f9511c
equal deleted inserted replaced
62:3255e7d5bd67 63:989397f9511c
       
     1 /*
       
     2 * Copyright (c) 2010 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:  Helper class to move certificates
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef ADVSECSETTINGSCERTMOVER_SYMBIAN_H
       
    19 #define ADVSECSETTINGSCERTMOVER_SYMBIAN_H
       
    20 
       
    21 #include <e32base.h>                    // CActive
       
    22 #include <ct/rmpointerarray.h>          // RMPointerArray
       
    23 #include <ct/tcttokenobjecthandle.h>    // TCTTokenObjectHandle
       
    24 
       
    25 class RFs;
       
    26 class CUnifiedCertStore;
       
    27 class CUnifiedKeyStore;
       
    28 class CCTCertInfo;
       
    29 class CCTKeyInfo;
       
    30 class CCertAttributeFilter;
       
    31 class TCTKeyAttributeFilter;
       
    32 class MCTWritableCertStore;
       
    33 class MCTKeyStoreManager;
       
    34 
       
    35 
       
    36 /**
       
    37  * Certificate mover helper class.
       
    38  */
       
    39 class CAdvSecSettingsCertMover : public CActive
       
    40 {
       
    41 public:     // constructor and destructor
       
    42     static CAdvSecSettingsCertMover *NewL(RFs &aFs);
       
    43     ~CAdvSecSettingsCertMover();
       
    44 
       
    45 public:     // new functions
       
    46     void Move(const CCTCertInfo &aCert, TInt aSourceStoreTokenId,
       
    47         TInt aTargetStoreTokenId, TRequestStatus &aStatus);
       
    48 
       
    49 protected:  // from CActive
       
    50     void DoCancel();
       
    51     void RunL();
       
    52     TInt RunError(TInt aError);
       
    53 
       
    54 private:    // new functions
       
    55     CAdvSecSettingsCertMover(RFs &aFs);
       
    56     void ConstructL();
       
    57     void StartMoveOperationL();
       
    58     TInt CorrespondingKeyStoreTokenId(TInt aCertStoreTokenId);
       
    59     void StartMovingKeysL();
       
    60     void FindSourceAndTargetKeyStoresL();
       
    61     void FindSourceAndTargetCertStoreL();
       
    62     void ExportFirstKeyL();
       
    63     void ExportOneKeyL();
       
    64     void ExportNextKeyL();
       
    65     void SaveExportedKeyL();
       
    66     void DeleteOriginalKeyL();
       
    67     void StartMovingCertificatesL();
       
    68     void RetrieveFirstCertL();
       
    69     void RetrieveOneCertL();
       
    70     void RetrieveNextCertL();
       
    71     void SaveRetrievedCertL();
       
    72     void DeleteOriginalCertL();
       
    73 
       
    74 
       
    75 private:    // data
       
    76     RFs &iFs;
       
    77     const CCTCertInfo *iCertInfo;   // not owned
       
    78     TInt iSourceCertStoreTokenId;
       
    79     TInt iTargetCertStoreTokenId;
       
    80     TRequestStatus *iClientStatus;  // not owned
       
    81     HBufC8 *iDataBuffer;
       
    82 
       
    83     CUnifiedCertStore *iCertStore;
       
    84     MCTWritableCertStore *iSourceCertStore; // not owned
       
    85     MCTWritableCertStore *iTargetCertStore; // not owned
       
    86     CCertAttributeFilter *iCertFilter;
       
    87     RMPointerArray<CCTCertInfo> iCerts;
       
    88     TInt iCertIndex;
       
    89     TPtr8 iDataPtr;
       
    90 
       
    91     CUnifiedKeyStore *iKeyStore;
       
    92     MCTKeyStoreManager *iSourceKeyStore;    // not owned
       
    93     MCTKeyStoreManager *iTargetKeyStore;    // not owned
       
    94     TCTKeyAttributeFilter *iKeyFilter;
       
    95     RMPointerArray<CCTKeyInfo> iKeys;
       
    96     TInt iKeyIndex;
       
    97     TCTTokenObjectHandle iSourceKeyHandle;
       
    98     CCTKeyInfo *iSavedKeyInfo;
       
    99 
       
   100     enum TMoverState {
       
   101         ENotInitialized,
       
   102         EInitializingCertStore,
       
   103         EInitializingKeyStore,
       
   104         EIdle,
       
   105         EMovingKeyListingKeys,
       
   106         EMovingKeyExportingKeys,
       
   107         EMovingKeyImportingKeys,
       
   108         EMovingKeyDeletingOriginal,
       
   109         EMovingCertListingCerts,
       
   110         EMovingCertRetrievingCerts,
       
   111         EMovingCertAddingCerts,
       
   112         EMovingCertDeletingOriginal,
       
   113         EFailed
       
   114     } iState;
       
   115 };
       
   116 
       
   117 #endif // ADVSECSETTINGSCERTMOVER_SYMBIAN_H