pkiutilities/securitydialognotifiersrv/src/securitydialogoperserverauthfail.cpp
changeset 53 25dd1e8b2663
parent 48 6ed68423b759
child 63 989397f9511c
equal deleted inserted replaced
48:6ed68423b759 53:25dd1e8b2663
    81 // ---------------------------------------------------------------------------
    81 // ---------------------------------------------------------------------------
    82 //
    82 //
    83 void CServerAuthFailOperation::StartL( const TDesC8& aBuffer )
    83 void CServerAuthFailOperation::StartL( const TDesC8& aBuffer )
    84     {
    84     {
    85     TRACE( "CServerAuthFailOperation::StartL, begin" );
    85     TRACE( "CServerAuthFailOperation::StartL, begin" );
    86     __ASSERT_DEBUG( iInput == NULL, User::Invariant() );
    86     ASSERT( iInput == NULL );
    87     iInput = CServerAuthenticationFailureInput::NewL( aBuffer );
    87     iInput = CServerAuthenticationFailureInput::NewL( aBuffer );
    88 
    88 
    89     iInput->GetEncodedCert( iEncodedServerCert );
    89     iInput->GetEncodedCert( iEncodedServerCert );
    90 
    90 
    91     TPtrC8 serverName;
    91     TPtrC8 serverName;
    92     iInput->GetServerName( serverName );
    92     iInput->GetServerName( serverName );
    93     __ASSERT_DEBUG( iServerName == NULL, User::Invariant() );
    93     ASSERT( iServerName == NULL );
    94     iServerName = HBufC::NewL( serverName.Length() );
    94     iServerName = HBufC::NewL( serverName.Length() );
    95     iServerName->Des().Copy( serverName );
    95     iServerName->Des().Copy( serverName );
    96     TRACE( "CServerAuthFailOperation::StartL, iServerName=%S", iServerName );
    96     TRACE( "CServerAuthFailOperation::StartL, iServerName=%S", iServerName );
    97 
    97 
    98     iAuthFailReason = iInput->FailureReason();
    98     iAuthFailReason = iInput->FailureReason();
   309 // ---------------------------------------------------------------------------
   309 // ---------------------------------------------------------------------------
   310 //
   310 //
   311 void CServerAuthFailOperation::StartFetchingTrustedSiteCertsL()
   311 void CServerAuthFailOperation::StartFetchingTrustedSiteCertsL()
   312     {
   312     {
   313     TRACE( "CServerAuthFailOperation::StartFetchingTrustedSiteCertsL" );
   313     TRACE( "CServerAuthFailOperation::StartFetchingTrustedSiteCertsL" );
   314     __ASSERT_DEBUG( iCertAttributeFilter == NULL, User::Invariant() );
   314     ASSERT( iCertAttributeFilter == NULL );
   315     iCertAttributeFilter = CCertAttributeFilter::NewL();
   315     iCertAttributeFilter = CCertAttributeFilter::NewL();
   316     iCertAttributeFilter->SetOwnerType( EPeerCertificate );
   316     iCertAttributeFilter->SetOwnerType( EPeerCertificate );
   317     __ASSERT_DEBUG( iTrustedSiteCertStore != NULL, User::Invariant() );
   317     ASSERT( iTrustedSiteCertStore != NULL );
   318     iTrustedSiteCertStore->List( iCertInfos, *iCertAttributeFilter, iStatus );
   318     iTrustedSiteCertStore->List( iCertInfos, *iCertAttributeFilter, iStatus );
   319     iMode = EListTrustedSiteCerts;
   319     iMode = EListTrustedSiteCerts;
   320     SetActive();
   320     SetActive();
   321     }
   321     }
   322 
   322 
   331     // If trusted site certstore open has failed, then it is not possible to save
   331     // If trusted site certstore open has failed, then it is not possible to save
   332     // the host name for permanent use. Hence, choice for permanent accept is not
   332     // the host name for permanent use. Hence, choice for permanent accept is not
   333     // displayed if trusted site certstore open has failed. Other restrictions for
   333     // displayed if trusted site certstore open has failed. Other restrictions for
   334     // permanent accept are defined in device dialog (UntrustedCertificateWidget).
   334     // permanent accept are defined in device dialog (UntrustedCertificateWidget).
   335     TBool isTrustedSiteCertStoreOpened = ( iTrustedSiteCertStore != NULL );
   335     TBool isTrustedSiteCertStoreOpened = ( iTrustedSiteCertStore != NULL );
   336     __ASSERT_DEBUG( iUntrustedCertQuery == NULL, User::Invariant() );
   336     ASSERT( iUntrustedCertQuery == NULL );
   337     iUntrustedCertQuery = CUntrustedCertQuery::NewL( iAuthFailReason, iEncodedServerCert,
   337     iUntrustedCertQuery = CUntrustedCertQuery::NewL( iAuthFailReason, iEncodedServerCert,
   338             *iServerName, isTrustedSiteCertStoreOpened );
   338             *iServerName, isTrustedSiteCertStoreOpened );
   339 
   339 
   340     CUntrustedCertQuery::TResponse response = CUntrustedCertQuery::EQueryRejected;
   340     CUntrustedCertQuery::TResponse response = CUntrustedCertQuery::EQueryRejected;
   341     iUntrustedCertQuery->ShowQueryAndWaitForResponseL( response );
   341     iUntrustedCertQuery->ShowQueryAndWaitForResponseL( response );
   362 //
   362 //
   363 void CServerAuthFailOperation::SaveServerCertToTrustedSiteCertStoreL()
   363 void CServerAuthFailOperation::SaveServerCertToTrustedSiteCertStoreL()
   364     {
   364     {
   365     TRACE( "CServerAuthFailOperation::SaveServerCertToTrustedSiteCertStoreL" );
   365     TRACE( "CServerAuthFailOperation::SaveServerCertToTrustedSiteCertStoreL" );
   366 
   366 
   367     __ASSERT_DEBUG( iCertLabel == NULL, User::Invariant() );
   367     ASSERT( iCertLabel == NULL );
   368     CX509Certificate* serverCert = CX509Certificate::NewLC( iEncodedServerCert );
   368     CX509Certificate* serverCert = CX509Certificate::NewLC( iEncodedServerCert );
   369     const CX500DistinguishedName& dName = serverCert->SubjectName();
   369     const CX500DistinguishedName& dName = serverCert->SubjectName();
   370     HBufC* commonName = dName.ExtractFieldL( KX520CommonName );
   370     HBufC* commonName = dName.ExtractFieldL( KX520CommonName );
   371     if( commonName )
   371     if( commonName )
   372         {
   372         {
   432 // ---------------------------------------------------------------------------
   432 // ---------------------------------------------------------------------------
   433 //
   433 //
   434 void CServerAuthFailOperation::RetrieveFirstTrustedSiteCertL()
   434 void CServerAuthFailOperation::RetrieveFirstTrustedSiteCertL()
   435     {
   435     {
   436     TRACE( "CServerAuthFailOperation::RetrieveFirstTrustedSiteCertL" );
   436     TRACE( "CServerAuthFailOperation::RetrieveFirstTrustedSiteCertL" );
   437     __ASSERT_DEBUG( iRetrievedCertBuffer == NULL, User::Invariant() );
   437     ASSERT( iRetrievedCertBuffer == NULL );
   438     iRetrieveCertIndex = 0;
   438     iRetrieveCertIndex = 0;
   439 
   439 
   440     RetrieveNextTrustedSiteCertL();
   440     RetrieveNextTrustedSiteCertL();
   441     }
   441     }
   442 
   442