pkiutilities/CTSecurityDialogs/NotifSrc/CTSecurityDialogsAO.cpp
branchRCL_3
changeset 7 6e226572c5f0
parent 5 3b17fc5c9564
child 8 ece4bbb094df
equal deleted inserted replaced
5:3b17fc5c9564 7:6e226572c5f0
  1433 // -----------------------------------------------------------------------------
  1433 // -----------------------------------------------------------------------------
  1434 //
  1434 //
  1435 void CCTSecurityDialogsAO::ShowNoTrustDialogL()
  1435 void CCTSecurityDialogsAO::ShowNoTrustDialogL()
  1436     {
  1436     {
  1437     CX509Certificate* cert = CX509Certificate::NewLC( iCertBuf->Des() );
  1437     CX509Certificate* cert = CX509Certificate::NewLC( iCertBuf->Des() );
  1438     TInt resourceid = R_WIM_NO_TRUST_QUERY_UNTRUSTED;
  1438     TInt dialogResourceId = R_WIM_NO_TRUST_QUERY_UNTRUSTED;
       
  1439     TInt promptResourceId = R_QTN_ICS_SSL_CONF_Q_ACCEPT_UNTRUSTED;
  1439     TBool showPermAccept = ETrue;
  1440     TBool showPermAccept = ETrue;
  1440 
  1441 
  1441     if( iAuthFailReason == ESignatureInvalid || iAuthFailReason == ECertificateRevoked )
  1442     if( iAuthFailReason == ESignatureInvalid || iAuthFailReason == ECertificateRevoked )
  1442         {
  1443         {
  1443         // Invalid or revoked certificate
  1444         // Invalid or revoked certificate
  1460 
  1461 
  1461             // Check common name first and then date
  1462             // Check common name first and then date
  1462             if( !cn )
  1463             if( !cn )
  1463                 {
  1464                 {
  1464                 // Couldn't retrieve CN from certificate
  1465                 // Couldn't retrieve CN from certificate
  1465                 resourceid = R_WIM_NO_TRUST_QUERY_UNTRUSTED;
  1466                 dialogResourceId = R_WIM_NO_TRUST_QUERY_UNTRUSTED;
       
  1467                 promptResourceId = R_QTN_ICS_SSL_CONF_Q_ACCEPT_UNTRUSTED;
  1466                 }
  1468                 }
  1467             else if( iServerName->Des() != cn->Des() )
  1469             else if( iServerName->Des() != cn->Des() )
  1468                 {
  1470                 {
  1469                 // Domain name doesn't match with CN
  1471                 // Domain name doesn't match with CN
  1470                 resourceid = R_WIM_NO_TRUST_QUERY_SITE;
  1472                 dialogResourceId = R_WIM_NO_TRUST_QUERY_SITE;
       
  1473                 promptResourceId = R_QTN_ICS_SSL_CONF_Q_ACCEPT_SITE;
  1471                 }
  1474                 }
  1472             else if( iAuthFailReason == EDateOutOfRange )
  1475             else if( iAuthFailReason == EDateOutOfRange )
  1473                 {
  1476                 {
  1474                 // Certificate is out of date
  1477                 // Certificate is out of date
  1475                 resourceid = R_WIM_NO_TRUST_QUERY_OOD;
  1478                 dialogResourceId = R_WIM_NO_TRUST_QUERY_OOD;
       
  1479                 promptResourceId = R_QTN_ICS_SSL_CONF_Q_ACCEPT_OOD;
  1476                 showPermAccept = EFalse;
  1480                 showPermAccept = EFalse;
  1477                 }
  1481                 }
  1478             else
  1482             else
  1479                 {
  1483                 {
  1480                 // Otherwise show general untrusted note
  1484                 // Otherwise show general untrusted note
  1481                 resourceid = R_WIM_NO_TRUST_QUERY_UNTRUSTED;
  1485                 dialogResourceId = R_WIM_NO_TRUST_QUERY_UNTRUSTED;
       
  1486                 promptResourceId = R_QTN_ICS_SSL_CONF_Q_ACCEPT_UNTRUSTED;
  1482                 }
  1487                 }
  1483             }
  1488             }
  1484         else
  1489         else
  1485             {
  1490             {
  1486             // Untrusted certificate
  1491             // Untrusted certificate
  1487             resourceid = R_WIM_NO_TRUST_QUERY_UNTRUSTED;
  1492             dialogResourceId = R_WIM_NO_TRUST_QUERY_UNTRUSTED;
       
  1493             promptResourceId = R_QTN_ICS_SSL_CONF_Q_ACCEPT_UNTRUSTED;
  1488             }
  1494             }
  1489 
  1495 
  1490         // No "Accept Permanently" option if certificate is out of date, or
  1496         // No "Accept Permanently" option if certificate is out of date, or
  1491         // if domain name is not defined.
  1497         // if domain name is not defined, or if trusted site store failed to
       
  1498         // open (and it's not possible to save the server certificate).
  1492         const CValidityPeriod& validityPeriod = cert->ValidityPeriod();
  1499         const CValidityPeriod& validityPeriod = cert->ValidityPeriod();
  1493         const TTime& startValue = validityPeriod.Start();
  1500         const TTime& startValue = validityPeriod.Start();
  1494         const TTime& finishValue = validityPeriod.Finish();
  1501         const TTime& finishValue = validityPeriod.Finish();
  1495         TTime current;
  1502         TTime current;
  1496         current.UniversalTime();
  1503         current.UniversalTime();
  1497 
  1504 
  1498         if( (( startValue > current ) || ( finishValue < current )) ||
  1505         if( (( startValue > current ) || ( finishValue < current )) ||
  1499                 ( iServerName->Des().Length() == 0 ) )
  1506                 ( iServerName->Des().Length() == 0 ) ||
       
  1507                 ( !iTrustedSiteCertStore ) )
  1500             {
  1508             {
  1501             showPermAccept = EFalse;
  1509             showPermAccept = EFalse;
  1502             }
  1510             }
  1503 
  1511 
  1504         iQueryDialog = new( ELeave ) CCTNoTrustQuery( *this, iRetValue, iStatus, iServerName,
  1512         iQueryDialog = new( ELeave ) CCTNoTrustQuery( *this, iRetValue, iStatus, iServerName,
  1505                     showPermAccept, iQueryDialogDeleted );
  1513                     showPermAccept, iQueryDialogDeleted );
  1506         iQueryDialog->ExecuteLD( resourceid );
  1514         HBufC* prompt = StringLoader::LoadLC( promptResourceId, *iServerName );
       
  1515         iQueryDialog->ExecuteLD( dialogResourceId, *prompt );
       
  1516         CleanupStack::PopAndDestroy( prompt );
  1507         }
  1517         }
  1508 
  1518 
  1509     CleanupStack::PopAndDestroy( cert );
  1519     CleanupStack::PopAndDestroy( cert );
  1510 
  1520 
  1511     iNextStep = EServerCertCheckUserResp;
  1521     iNextStep = EServerCertCheckUserResp;
  2454         // Next step is to update trust site db
  2464         // Next step is to update trust site db
  2455         iNextStep = EAddTrustedSite;
  2465         iNextStep = EAddTrustedSite;
  2456         iStatus = KRequestPending;
  2466         iStatus = KRequestPending;
  2457         SetActive();
  2467         SetActive();
  2458         }
  2468         }
       
  2469     else
       
  2470         {
       
  2471         User::Leave( KErrGeneral );
       
  2472         }
  2459     }
  2473     }
  2460 
  2474 
  2461 // -----------------------------------------------------------------------------
  2475 // -----------------------------------------------------------------------------
  2462 // CCTSecurityDialogsAO::MapTlsProviderOperation()
  2476 // CCTSecurityDialogsAO::MapTlsProviderOperation()
  2463 // -----------------------------------------------------------------------------
  2477 // -----------------------------------------------------------------------------