cpsecplugins/cpadvancedsecplugin/src/cpsecmodsyncwrapper.cpp
branchGCC_SURGE
changeset 40 604cd42065d1
parent 37 7bad16cccaca
equal deleted inserted replaced
29:b63e8c2d8cff 40:604cd42065d1
    24 #include <ct/ccttokentype.h>
    24 #include <ct/ccttokentype.h>
    25 #include <ct/tcttokenobjecthandle.h>
    25 #include <ct/tcttokenobjecthandle.h>
    26 #include <mctauthobject.h>
    26 #include <mctauthobject.h>
    27 #include <unifiedkeystore.h>
    27 #include <unifiedkeystore.h>
    28 #include <mctkeystore.h>
    28 #include <mctkeystore.h>
    29 
    29 #include <../../inc/cpsecplugins.h>
    30 
    30 
    31 
    31 
    32 // ============================ MEMBER FUNCTIONS ===============================
    32 // ============================ MEMBER FUNCTIONS ===============================
    33 
    33 
    34 // -----------------------------------------------------------------------------
    34 // -----------------------------------------------------------------------------
    60 // Two-phased constructor.
    60 // Two-phased constructor.
    61 // -----------------------------------------------------------------------------
    61 // -----------------------------------------------------------------------------
    62 //
    62 //
    63 CSecModUISyncWrapper* CSecModUISyncWrapper::NewL()
    63 CSecModUISyncWrapper* CSecModUISyncWrapper::NewL()
    64     {
    64     {
       
    65     RDEBUG("0", 0);
    65     CSecModUISyncWrapper* wrap = CSecModUISyncWrapper::NewLC();
    66     CSecModUISyncWrapper* wrap = CSecModUISyncWrapper::NewLC();
    66     CleanupStack::Pop(wrap);
    67     CleanupStack::Pop(wrap);
    67     return wrap;
    68     return wrap;
    68     }
    69     }
    69 
    70 
   100 // -----------------------------------------------------------------------------
   101 // -----------------------------------------------------------------------------
   101 //
   102 //
   102 TInt CSecModUISyncWrapper::GetAuthObjectInterface(
   103 TInt CSecModUISyncWrapper::GetAuthObjectInterface(
   103     MCTToken& aToken, MCTTokenInterface*& aTokenInterface)
   104     MCTToken& aToken, MCTTokenInterface*& aTokenInterface)
   104     {
   105     {
       
   106     RDEBUG("0", 0);
   105     if( !IsActive() && !iWait.IsStarted() )
   107     if( !IsActive() && !iWait.IsStarted() )
   106         {
   108         {
   107         iOperation = EOperationGetAOInterface;
   109         iOperation = EOperationGetAOInterface;
   108         iObject = STATIC_CAST(TAny*, &aToken);
   110         iObject = STATIC_CAST(TAny*, &aToken);
   109         const TUid KUidInterfaceAO = { KCTInterfaceAuthenticationObject };
   111         const TUid KUidInterfaceAO = { KCTInterfaceAuthenticationObject };
   146 TInt CSecModUISyncWrapper::ListKeys(
   148 TInt CSecModUISyncWrapper::ListKeys(
   147     MCTKeyStore& aKeyStore,
   149     MCTKeyStore& aKeyStore,
   148     RMPointerArray<CCTKeyInfo>& aKeysInfos,
   150     RMPointerArray<CCTKeyInfo>& aKeysInfos,
   149     const TCTKeyAttributeFilter& aFilter)
   151     const TCTKeyAttributeFilter& aFilter)
   150     {
   152     {
       
   153     RDEBUG("0", 0);
   151     if( !IsActive() && !iWait.IsStarted() )
   154     if( !IsActive() && !iWait.IsStarted() )
   152         {
   155         {
   153         iOperation = EOperationListKeys;
   156         iOperation = EOperationListKeys;
   154         iObject = STATIC_CAST(TAny*, &aKeyStore);
   157         iObject = STATIC_CAST(TAny*, &aKeyStore);
   155         aKeyStore.List(aKeysInfos, aFilter, iStatus);
   158         aKeyStore.List(aKeysInfos, aFilter, iStatus);
   167 //
   170 //
   168 TInt CSecModUISyncWrapper::DeleteKey(
   171 TInt CSecModUISyncWrapper::DeleteKey(
   169     CUnifiedKeyStore& aKeyStore,
   172     CUnifiedKeyStore& aKeyStore,
   170     TCTTokenObjectHandle aHandle)
   173     TCTTokenObjectHandle aHandle)
   171     {
   174     {
       
   175     RDEBUG("0", 0);
   172     if( !IsActive() && !iWait.IsStarted() )
   176     if( !IsActive() && !iWait.IsStarted() )
   173         {
   177         {
   174         iOperation = EOperationDelKey;
   178         iOperation = EOperationDelKey;
   175         iObject = STATIC_CAST(TAny*, &aKeyStore);
   179         iObject = STATIC_CAST(TAny*, &aKeyStore);
   176         aKeyStore.DeleteKey(aHandle, iStatus);
   180         aKeyStore.DeleteKey(aHandle, iStatus);
   187 // -----------------------------------------------------------------------------
   191 // -----------------------------------------------------------------------------
   188 //
   192 //
   189 TInt CSecModUISyncWrapper::ChangeReferenceData(
   193 TInt CSecModUISyncWrapper::ChangeReferenceData(
   190     MCTAuthenticationObject& aAuthObject)
   194     MCTAuthenticationObject& aAuthObject)
   191     {
   195     {
       
   196     RDEBUG("0", 0);
   192     if( !IsActive() && !iWait.IsStarted() )
   197     if( !IsActive() && !iWait.IsStarted() )
   193         {
   198         {
   194         iOperation = EOperationChangeReferenceData;
   199         iOperation = EOperationChangeReferenceData;
   195         iObject = STATIC_CAST(TAny*, &aAuthObject);
   200         iObject = STATIC_CAST(TAny*, &aAuthObject);
   196         aAuthObject.ChangeReferenceData(iStatus);
   201         aAuthObject.ChangeReferenceData(iStatus);
   207 // -----------------------------------------------------------------------------
   212 // -----------------------------------------------------------------------------
   208 //
   213 //
   209 TInt CSecModUISyncWrapper::UnblockAuthObject(
   214 TInt CSecModUISyncWrapper::UnblockAuthObject(
   210     MCTAuthenticationObject& aAuthObject)
   215     MCTAuthenticationObject& aAuthObject)
   211     {
   216     {
       
   217     RDEBUG("0", 0);
   212     if( !IsActive() && !iWait.IsStarted() )
   218     if( !IsActive() && !iWait.IsStarted() )
   213         {
   219         {
   214         iOperation = EOperationUnblockAO;
   220         iOperation = EOperationUnblockAO;
   215         iObject = STATIC_CAST(TAny*, &aAuthObject);
   221         iObject = STATIC_CAST(TAny*, &aAuthObject);
   216         aAuthObject.Unblock(iStatus);
   222         aAuthObject.Unblock(iStatus);
   227 // -----------------------------------------------------------------------------
   233 // -----------------------------------------------------------------------------
   228 //
   234 //
   229 TInt CSecModUISyncWrapper::EnableAuthObject(
   235 TInt CSecModUISyncWrapper::EnableAuthObject(
   230     MCTAuthenticationObject& aAuthObject)
   236     MCTAuthenticationObject& aAuthObject)
   231     {
   237     {
       
   238     RDEBUG("0", 0);
   232     if( !IsActive() && !iWait.IsStarted() )
   239     if( !IsActive() && !iWait.IsStarted() )
   233         {
   240         {
   234         iOperation = EOperationEnableAO;
   241         iOperation = EOperationEnableAO;
   235         iObject = STATIC_CAST(TAny*, &aAuthObject);
   242         iObject = STATIC_CAST(TAny*, &aAuthObject);
   236         aAuthObject.Enable(iStatus);
   243         aAuthObject.Enable(iStatus);
   289 //
   296 //
   290 TInt CSecModUISyncWrapper::TimeRemaining(
   297 TInt CSecModUISyncWrapper::TimeRemaining(
   291     MCTAuthenticationObject& aAuthObject,
   298     MCTAuthenticationObject& aAuthObject,
   292     TInt& aStime )
   299     TInt& aStime )
   293     {
   300     {
       
   301     RDEBUG("0", 0);
   294     if( !IsActive() && !iWait.IsStarted() )
   302     if( !IsActive() && !iWait.IsStarted() )
   295         {
   303         {
   296         iOperation = EOperationTimeRemAO;
   304         iOperation = EOperationTimeRemAO;
   297         iObject = STATIC_CAST(TAny*, &aAuthObject);
   305         iObject = STATIC_CAST(TAny*, &aAuthObject);
   298         aAuthObject.TimeRemaining(aStime, iStatus);
   306         aAuthObject.TimeRemaining(aStime, iStatus);
   309 // Cancels the ongoing operation if possible.
   317 // Cancels the ongoing operation if possible.
   310 // -----------------------------------------------------------------------------
   318 // -----------------------------------------------------------------------------
   311 //
   319 //
   312 void CSecModUISyncWrapper::DoCancel()
   320 void CSecModUISyncWrapper::DoCancel()
   313     {
   321     {
       
   322     RDEBUG("iOperation", iOperation);
   314     switch ( iOperation )
   323     switch ( iOperation )
   315         {
   324         {
   316         case EOperationInit:
   325         case EOperationInit:
   317             {
   326             {
   318             STATIC_CAST(CUnifiedKeyStore*, iObject)->CancelInitialize();
   327             STATIC_CAST(CUnifiedKeyStore*, iObject)->CancelInitialize();