vpnengine/pkiservice/src/pkiwrapper.cpp
changeset 4 29b591713d44
parent 1 c9c2ad51f972
child 38 9f4e37332ce5
equal deleted inserted replaced
3:2df28d7a2299 4:29b591713d44
   308     if(iCurrentStatus == KErrNone)
   308     if(iCurrentStatus == KErrNone)
   309         {
   309         {
   310         const CMapDescriptor& mapping = iMapper.GetMapDescriptorAtIndex(index);        
   310         const CMapDescriptor& mapping = iMapper.GetMapDescriptorAtIndex(index);        
   311         iCurrentState = EComplete;
   311         iCurrentState = EComplete;
   312         iPKISupport->RetrieveCertificateL(mapping.Label(),
   312         iPKISupport->RetrieveCertificateL(mapping.Label(),
   313                                           mapping.CertificateKeyId(),
       
   314                                           iPtrCertBuffer, mapping.OwnerType(), iStatus);
   313                                           iPtrCertBuffer, mapping.OwnerType(), iStatus);
   315         SetActive();
   314         SetActive();
   316         }
   315         }
   317     LOG_1("CPKIWrapper::ExecuteReadCertificateL() exit:%d", iCurrentStatus);
   316     LOG_1("CPKIWrapper::ExecuteReadCertificateL() exit:%d", iCurrentStatus);
   318     }
   317     }
   411                                                       *certificate,
   410                                                       *certificate,
   412                                                       iCurrentDescriptor().iOwnerType,
   411                                                       iCurrentDescriptor().iOwnerType,
   413                                                       storeType);  
   412                                                       storeType);  
   414     CleanupStack::PushL(newMapping);            
   413     CleanupStack::PushL(newMapping);            
   415     newMapping->SetMapDeletable(iCurrentDescriptor().iIsDeletable);
   414     newMapping->SetMapDeletable(iCurrentDescriptor().iIsDeletable);
   416 
   415                 
   417             
       
   418     
       
   419     iCurrentStatus = KErrNone;
   416     iCurrentStatus = KErrNone;
   420     iCurrentState = EComplete;
   417     iCurrentState = EComplete;
   421     LOG(Log::Printf(_L("Attaching certificate")));
   418     LOG(Log::Printf(_L("Attaching certificate")));
   422     LOG(Log::Printf(*iObjectName));
   419     LOG(Log::Printf(*iObjectName));
   423     iPKISupport->AttachCertificateL(*iObjectName, iPtrCertBuffer, iStatus);
   420     iPKISupport->AttachCertificateL(*iObjectName, iPtrCertBuffer, iStatus);
   444     iCurrentStatus = iMapper.ResolveCertMappingL(iCurrentDescriptor(), 
   441     iCurrentStatus = iMapper.ResolveCertMappingL(iCurrentDescriptor(), 
   445                                         *iObjectName, index, iInfoOnly,
   442                                         *iObjectName, index, iInfoOnly,
   446                                         iPKISupport->CertStoreType());
   443                                         iPKISupport->CertStoreType());
   447     if(iCurrentStatus == KErrNone)
   444     if(iCurrentStatus == KErrNone)
   448         {
   445         {
   449         const CMapDescriptor& mapping = iMapper.GetMapDescriptorAtIndex(index);
       
   450         TPKIKeyIdentifier keyId = mapping.CertificateKeyId();
       
   451         iMapper.DeleteMapping(index);
   446         iMapper.DeleteMapping(index);
   452         iCurrentState = EComplete;
   447         iCurrentState = EComplete;
   453         iPKISupport->RemoveCertificateL(*iObjectName, keyId, iStatus);
   448         iPKISupport->RemoveCertificateL(*iObjectName, iStatus);
   454         SetActive();
   449         SetActive();
   455         }
   450         }
   456     }
   451     }
   457 
   452 
   458 /**---------------------------------------------------------
   453 /**---------------------------------------------------------
   471         {
   466         {
   472         const CMapDescriptor& mapping = iMapper.GetMapDescriptorAtIndex(index);
   467         const CMapDescriptor& mapping = iMapper.GetMapDescriptorAtIndex(index);
   473         if (mapping.OwnerType() == EPKICACertificate)
   468         if (mapping.OwnerType() == EPKICACertificate)
   474             {            
   469             {            
   475             iCurrentState = EComplete;
   470             iCurrentState = EComplete;
   476             iPKISupport->SetTrustL(*iObjectName, mapping.CertificateKeyId(), 
   471             iPKISupport->SetTrustL(*iObjectName, 
   477                                    iTrusted, iStatus);
   472                                    iTrusted, iStatus);
   478             SetActive();
   473             SetActive();
   479             }
   474             }
   480         else
   475         else
   481             {
   476             {
   496     iCurrentStatus = iMapper.ResolveCertMappingL(iCurrentDescriptor(), *iObjectName, 
   491     iCurrentStatus = iMapper.ResolveCertMappingL(iCurrentDescriptor(), *iObjectName, 
   497                                                             index, iInfoOnly,
   492                                                             index, iInfoOnly,
   498                                                             iPKISupport->CertStoreType());
   493                                                             iPKISupport->CertStoreType());
   499     if(iCurrentStatus == KErrNone)
   494     if(iCurrentStatus == KErrNone)
   500         {
   495         {
   501         const CMapDescriptor& mapping = iMapper.GetMapDescriptorAtIndex(index);
       
   502         iCurrentState = EComplete;
   496         iCurrentState = EComplete;
   503         iPKISupport->TrustedL(*iObjectName, mapping.CertificateKeyId(), iStatus);
   497         iPKISupport->TrustedL(*iObjectName, iStatus);
   504         SetActive();
   498         SetActive();
   505         }
   499         }
   506     }
   500     }
   507 
   501 
   508 /**---------------------------------------------------------
   502 /**---------------------------------------------------------
   519 	// Save index
   513 	// Save index
   520 	iIndex = index;
   514 	iIndex = index;
   521     if(iCurrentStatus == KErrNone)
   515     if(iCurrentStatus == KErrNone)
   522         {
   516         {
   523         LOG_1("ExecuteSetApplicabilityL:%d", iIndex);
   517         LOG_1("ExecuteSetApplicabilityL:%d", iIndex);
   524         const CMapDescriptor& mapping = iMapper.GetMapDescriptorAtIndex(index);
       
   525         iCurrentState = EComplete;
   518         iCurrentState = EComplete;
   526         iPKISupport->SetApplicabilityL(*iObjectName, mapping.CertificateKeyId(), iUidArray, iStatus);
   519         iPKISupport->SetApplicabilityL(*iObjectName, iUidArray, iStatus);
   527         SetActive();
   520         SetActive();
   528         }
   521         }
   529     }
   522     }
   530 
   523 
   531 /**---------------------------------------------------------
   524 /**---------------------------------------------------------
   541                                                            index, iInfoOnly,
   534                                                            index, iInfoOnly,
   542                                                            iPKISupport->CertStoreType());
   535                                                            iPKISupport->CertStoreType());
   543     iUidArray.Close();
   536     iUidArray.Close();
   544     if(iCurrentStatus == KErrNone)
   537     if(iCurrentStatus == KErrNone)
   545         {
   538         {
   546         const CMapDescriptor& mapping = iMapper.GetMapDescriptorAtIndex(index);
       
   547         iCurrentState = EComplete;
   539         iCurrentState = EComplete;
   548         iPKISupport->ApplicationsL(*iObjectName, mapping.CertificateKeyId(), iStatus);
   540         iPKISupport->ApplicationsL(*iObjectName, iStatus);
   549         SetActive();
   541         SetActive();
   550         }
   542         }
   551 }
   543 }
   552 
   544 
   553     
   545