cpsecplugins/cpadvancedsecplugin/src/cpcertmanuisyncwrapper.cpp
changeset 37 7bad16cccaca
parent 19 098e361762d2
equal deleted inserted replaced
26:aad866c37519 37:7bad16cccaca
    21 #include <unifiedcertstore.h>
    21 #include <unifiedcertstore.h>
    22 #include <unifiedkeystore.h>
    22 #include <unifiedkeystore.h>
    23 #include <mctwritablecertstore.h>
    23 #include <mctwritablecertstore.h>
    24 #include <x509cert.h>
    24 #include <x509cert.h>
    25 #include <pkixcertchain.h>
    25 #include <pkixcertchain.h>
    26 
    26 #include <../../inc/cpsecplugins.h>
    27 #include "cpcertmanuisyncwrapper.h"
    27 #include "cpcertmanuisyncwrapper.h"
    28 
    28 
    29 // CONSTANTS
    29 // CONSTANTS
    30 _LIT_SECURITY_POLICY_C1( KKeyStoreUsePolicy, ECapabilityReadUserData );
    30 _LIT_SECURITY_POLICY_C1( KKeyStoreUsePolicy, ECapabilityReadUserData );
    31 // Maximum length of a certificate
    31 // Maximum length of a certificate
    40     CUnifiedCertStore*& aStore,
    40     CUnifiedCertStore*& aStore,
    41     RMPointerArray<CCTCertInfo>* aArray,
    41     RMPointerArray<CCTCertInfo>* aArray,
    42     const CCertAttributeFilter& aFilter,
    42     const CCertAttributeFilter& aFilter,
    43     const TUid aTokenUid )
    43     const TUid aTokenUid )
    44     {
    44     {
    45     
    45     RDEBUG("0", 0);
    46     if ( IsActive() )
    46     if ( IsActive() )
    47         {
    47         {
    48         // Wrapper is active. Don't go further
    48         // Wrapper is active. Don't go further
    49         User::Leave(KErrGeneral);
    49         User::Leave(KErrGeneral);
    50         }
    50         }
    76 void CpCertManUISyncWrapper::ListL(
    76 void CpCertManUISyncWrapper::ListL(
    77     CUnifiedKeyStore*& aStore,
    77     CUnifiedKeyStore*& aStore,
    78     RMPointerArray<CCTKeyInfo>* aArray,
    78     RMPointerArray<CCTKeyInfo>* aArray,
    79     const TCTKeyAttributeFilter& aFilter )
    79     const TCTKeyAttributeFilter& aFilter )
    80     {
    80     {
    81     
    81     RDEBUG("0", 0);
    82     if ( IsActive() )
    82     if ( IsActive() )
    83         {
    83         {
    84         // Wrapper is active. Don't go further
    84         // Wrapper is active. Don't go further
    85 		User::Leave(KErrGeneral);
    85 		User::Leave(KErrGeneral);
    86         }
    86         }
   102     const CCTCertInfo& aCertInfo,
   102     const CCTCertInfo& aCertInfo,
   103     CCertificate*& aCert,
   103     CCertificate*& aCert,
   104     TUid aTokenUid )
   104     TUid aTokenUid )
   105     {
   105     {
   106     aCert = NULL;
   106     aCert = NULL;
   107     
   107     RDEBUG("0", 0);
   108     HBufC8* buf = HBufC8::NewLC( KMaxCertificateLength );
   108     HBufC8* buf = HBufC8::NewLC( KMaxCertificateLength );
   109     iCertPtr.Set( buf->Des() );
   109     iCertPtr.Set( buf->Des() );
   110 
   110 
   111     TInt count = aStore->CertStoreCount();
   111     TInt count = aStore->CertStoreCount();
   112     for (TInt i = 0; i < count; i++)
   112     for (TInt i = 0; i < count; i++)
   154 // -----------------------------------------------------------------------------
   154 // -----------------------------------------------------------------------------
   155 //
   155 //
   156 void CpCertManUISyncWrapper::DeleteCertL( CUnifiedCertStore*& aStore,
   156 void CpCertManUISyncWrapper::DeleteCertL( CUnifiedCertStore*& aStore,
   157     const CCTCertInfo& aCertInfo )
   157     const CCTCertInfo& aCertInfo )
   158     {
   158     {
   159     
   159     RDEBUG("0", 0);
   160     aStore->Remove( aCertInfo, iStatus );
   160     aStore->Remove( aCertInfo, iStatus );
   161     iOperation = EOperationDelete;
   161     iOperation = EOperationDelete;
   162     iStore = aStore;
   162     iStore = aStore;
   163     SetActive();
   163     SetActive();
   164     iWait.Start();
   164     iWait.Start();
   172 //
   172 //
   173 void CpCertManUISyncWrapper::DeleteCertL( CUnifiedCertStore*& aStore,
   173 void CpCertManUISyncWrapper::DeleteCertL( CUnifiedCertStore*& aStore,
   174     const CCTCertInfo& aCertInfo,
   174     const CCTCertInfo& aCertInfo,
   175     TUid aTokenUid )
   175     TUid aTokenUid )
   176     {
   176     {
   177         
   177     RDEBUG("0", 0);
   178     TInt count = aStore->WritableCertStoreCount();
   178     TInt count = aStore->WritableCertStoreCount();
   179     for (TInt i = 0; i < count; i++)
   179     for (TInt i = 0; i < count; i++)
   180         {
   180         {
   181         MCTWritableCertStore& writablestore = aStore->WritableCertStore( i );
   181         MCTWritableCertStore& writablestore = aStore->WritableCertStore( i );
   182         MCTToken& token = writablestore.Token();
   182         MCTToken& token = writablestore.Token();
   254 // -----------------------------------------------------------------------------
   254 // -----------------------------------------------------------------------------
   255 //
   255 //
   256 
   256 
   257 void CpCertManUISyncWrapper::RunL()
   257 void CpCertManUISyncWrapper::RunL()
   258     {
   258     {
   259     
   259     RDEBUG("0", 0);
   260     if ( iWait.IsStarted() )
   260     if ( iWait.IsStarted() )
   261         {
   261         {
   262         iWait.AsyncStop();
   262         iWait.AsyncStop();
   263         }
   263         }
   264 
   264 
   269 // Cancels the ongoing operation if possible.
   269 // Cancels the ongoing operation if possible.
   270 // -----------------------------------------------------------------------------
   270 // -----------------------------------------------------------------------------
   271 //
   271 //
   272 void CpCertManUISyncWrapper::DoCancel()
   272 void CpCertManUISyncWrapper::DoCancel()
   273     {
   273     {
       
   274     RDEBUG("iOperation", iOperation);
   274     switch ( iOperation )
   275     switch ( iOperation )
   275         {
   276         {
   276         case EOperationInit:
   277         case EOperationInit:
   277             {
   278             {
   278             iStore->CancelInitialize();
   279             iStore->CancelInitialize();