17 |
17 |
18 |
18 |
19 // INCLUDE FILES |
19 // INCLUDE FILES |
20 #include "CTSecurityDialogsAO.h" |
20 #include "CTSecurityDialogsAO.h" |
21 #include "CTSecurityDialogNotifier.h" |
21 #include "CTSecurityDialogNotifier.h" |
22 //#include "CTPinQueryDialog.h" |
22 #include "CTPinQueryDialog.h" |
23 //#include "CTSignTextDialog.h" |
23 #include "CTSignTextDialog.h" |
24 //#include "CTSelectCertificateDialog.h" |
24 #include "CTSelectCertificateDialog.h" |
25 //#include "CTQueryDialog.h" |
25 #include "CTQueryDialog.h" |
26 //#include "CTPinPinQueryDialog.h" |
26 #include "CTPinPinQueryDialog.h" |
27 #include "CTUntrustedCertQuery.h" |
27 #include "CTNoTrustQuery.h" |
28 //#include "CTInvalidCertNote.h" |
28 #include "CTInvalidCertNote.h" |
29 #include <PKIDlg.h> |
29 #include <PKIDlg.h> |
30 #include <badesca.h> |
30 #include <badesca.h> |
31 #include <StringLoader.h> |
31 #include <StringLoader.h> |
32 //#include <aknnotewrappers.h> |
32 #include <aknnotewrappers.h> |
33 #include <unifiedcertstore.h> |
33 #include <unifiedcertstore.h> |
34 #include <unifiedkeystore.h> |
34 #include <unifiedkeystore.h> |
35 #include <mctkeystore.h> |
35 #include <mctkeystore.h> |
36 #include <cctcertinfo.h> |
36 #include <cctcertinfo.h> |
37 #include <DocumentHandler.h> |
37 #include <DocumentHandler.h> |
38 #include <apmstd.h> |
38 #include <apmstd.h> |
39 #include <DigSigningNote.h> |
39 #include <DigSigningNote.h> |
40 //#include <certmanui.rsg> |
40 #include <certmanui.rsg> |
41 #include <X509CertNameParser.h> |
41 #include <X509CertNameParser.h> |
42 #include <x509cert.h> |
42 #include <x509cert.h> |
43 #include <x500dn.h> |
43 #include <x500dn.h> |
44 #include <hash.h> |
44 #include <hash.h> |
45 #include <x509certext.h> |
45 #include <x509certext.h> |
46 #include <TrustedSitesStore.h> |
46 #include <TrustedSitesStore.h> |
47 #include <mctwritablecertstore.h> |
47 #include <mctwritablecertstore.h> |
48 #include <eikenv.h> // CEikonEnv |
48 #include <coreapplicationuisdomainpskeys.h> // KCoreAppUIsAutolockStatus |
49 #include <AknUtils.h> // AknTextUtils |
|
50 |
|
51 #include "SecQueryUi.h" // needed for password dialog |
|
52 |
|
53 #include <hbdevicemessageboxsymbian.h> // needed for Note dialogs |
|
54 #include <hbdevicenotificationdialogsymbian.h> |
|
55 |
49 |
56 // LOCAL CONSTANTS AND MACROS |
50 // LOCAL CONSTANTS AND MACROS |
57 const TInt KCertArrayGranularity = 3; |
51 const TInt KCertArrayGranularity = 3; |
58 const TInt KMaxLengthTextDetailsBody = 5000; |
52 const TInt KMaxLengthTextDetailsBody = 5000; |
59 // CertLabel, Issuer, Owner max visible length |
53 // CertLabel, Issuer, Owner max visible length |
60 const TInt KMaxLengthTextCertLabelVisible = 200; |
54 const TInt KMaxLengthTextCertLabelVisible = 200; |
61 // "dd/mm/yyyy0" |
55 // "dd/mm/yyyy0" |
62 const TInt KMaxLengthTextDateString = 20; |
56 const TInt KMaxLengthTextDateString = 20; |
|
57 // HH0 |
|
58 const TInt KMaxLengthTextSerialNumberFormatting = 3; |
63 // Maximum length of a certificate |
59 // Maximum length of a certificate |
64 const TInt KMaxCertificateLength = 5000; |
60 const TInt KMaxCertificateLength = 5000; |
65 |
61 |
66 // Maximum length of key store password |
62 // Maximum length of key store password |
67 const TInt KMaxKeystorePwLength = 6; |
63 const TInt KMaxKeystorePwLength = 6; |
68 |
64 |
69 const TInt KMinImportKeyPwLen = 1; |
65 const TInt KMinImportKeyPwLen = 1; |
70 |
66 |
71 const TInt KMaxCommonNameLength = 64; |
67 const TInt KMaxCNLength = 64; |
72 |
68 |
|
69 _LIT(KCertManUIDetailsViewHexFormat, "%02X"); |
|
70 |
|
71 const TInt KFileCertStoreUid( 0x101F501A ); |
|
72 const TInt KWIMCertStoreUid ( 0x101F79D9 ); |
73 const TUid KTrustedServerTokenUid = { 0x101FB66F }; |
73 const TUid KTrustedServerTokenUid = { 0x101FB66F }; |
74 const TUid KDeviceCertStoreTokenUid = { 0x101FB668 }; |
74 const TUid KDeviceCertStoreTokenUid = { 0x101FB668 }; |
75 |
75 |
76 _LIT( KBlockSeparator, " " ); |
76 _LIT( KBlockSeparator, " " ); |
77 _LIT( KEnter, "\n" ); |
77 _LIT( KEnter, "\n" ); |
81 _LIT( KKeyStoreImportKeyLabel, "Passphrase of the imported key file" ); |
81 _LIT( KKeyStoreImportKeyLabel, "Passphrase of the imported key file" ); |
82 _LIT( KKeyStoreExportKeyLabel, "Passphrase of the exported key file" ); |
82 _LIT( KKeyStoreExportKeyLabel, "Passphrase of the exported key file" ); |
83 _LIT( KPKCS12TokenLabel, "PKCS12"); |
83 _LIT( KPKCS12TokenLabel, "PKCS12"); |
84 |
84 |
85 |
85 |
86 // TODO: replace with OST tracing |
86 // ============================ LOCAL FUNCTIONS =============================== |
87 #ifdef _DEBUG |
87 |
88 #include <e32debug.h> |
88 TInt AlgorithmNameResourceId( TAlgorithmId aAlgorithmId ) |
89 #define TRACE(x) RDebug::Printf(x) |
89 { |
90 #define TRACE1(x,y) RDebug::Printf(x,y) |
90 TInt resourceId = 0; |
91 #else |
91 switch( aAlgorithmId ) |
92 #define TRACE(x) |
92 { |
93 #define TRACE1(x,y) |
93 case ERSA: |
94 #endif |
94 resourceId = R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM_RSA; |
|
95 break; |
|
96 case EDSA: |
|
97 resourceId = R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM_DSA; |
|
98 break; |
|
99 case EDH: |
|
100 resourceId = R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM_DH; |
|
101 break; |
|
102 case EMD2: |
|
103 resourceId = R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM_MD2; |
|
104 break; |
|
105 case EMD5: |
|
106 resourceId = R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM_MD5; |
|
107 break; |
|
108 case ESHA1: |
|
109 resourceId = R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM_SHA1; |
|
110 break; |
|
111 case ESHA224: |
|
112 case ESHA256: |
|
113 case ESHA384: |
|
114 case ESHA512: |
|
115 resourceId = R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM_SHA2; |
|
116 break; |
|
117 default: |
|
118 resourceId = R_TEXT_RESOURCE_DETAILS_VIEW_UNKNOWN; |
|
119 break; |
|
120 } |
|
121 return resourceId; |
|
122 } |
95 |
123 |
96 |
124 |
97 // ============================ MEMBER FUNCTIONS =============================== |
125 // ============================ MEMBER FUNCTIONS =============================== |
98 |
126 |
99 // ----------------------------------------------------------------------------- |
127 // ----------------------------------------------------------------------------- |
364 iAuthFailReason = srvAuthFail->FailureReason(); |
389 iAuthFailReason = srvAuthFail->FailureReason(); |
365 CleanupStack::PopAndDestroy( srvAuthFail ); |
390 CleanupStack::PopAndDestroy( srvAuthFail ); |
366 |
391 |
367 iServerName = HBufC::NewL( serverName.Length() ); |
392 iServerName = HBufC::NewL( serverName.Length() ); |
368 iServerName->Des().Copy( serverName ); |
393 iServerName->Des().Copy( serverName ); |
|
394 |
|
395 HBufC* cn = NULL; |
369 iCertLabel = NULL; |
396 iCertLabel = NULL; |
370 |
|
371 // Site will be checked later. For now it is not trusted |
397 // Site will be checked later. For now it is not trusted |
372 iTrustedSite = EFalse; |
398 iTrustedSite = EFalse; |
373 |
399 |
|
400 |
374 CX509Certificate* serverCert = CX509Certificate::NewLC( cert ); |
401 CX509Certificate* serverCert = CX509Certificate::NewLC( cert ); |
|
402 // Retrieve subject name |
375 const CX500DistinguishedName& dName = serverCert->SubjectName(); |
403 const CX500DistinguishedName& dName = serverCert->SubjectName(); |
376 |
404 // Retrieve CN |
377 HBufC* commonName = dName.ExtractFieldL( KX520CommonName ); |
405 cn = dName.ExtractFieldL( KX520CommonName ); |
378 CleanupStack::PushL( commonName ); |
406 if ( cn != NULL ) |
379 if( commonName != NULL ) |
407 { |
380 { |
408 // commonName exist in the certificate. |
381 // Check the length of CN. RFC 3280 states |
409 // Check the length of CN. RFC 3280 states |
382 // that max length of CN is 64. |
410 // that max length of CN is 64. |
383 if( commonName->Length() <= KMaxCommonNameLength ) |
411 if ( cn->Length() <= KMaxCNLength ) |
384 { |
412 { |
385 iCertLabel = HBufC::NewL( commonName->Length() ); |
413 iCertLabel = HBufC::NewL( cn->Length() ); |
386 iCertLabel->Des().Append( commonName->Des() ); |
414 iCertLabel->Des().Append( cn->Des() ); |
387 } |
415 } |
388 } |
416 } |
389 CleanupStack::PopAndDestroy( commonName ); |
417 |
390 |
418 if ( iCertLabel == NULL ) |
391 if( iCertLabel == NULL ) |
419 { |
392 { |
420 // No or invalid commonName. Use domain name as label |
393 // No or invalid commonName. Use domain name as label. |
|
394 iCertLabel = HBufC::NewL( iServerName->Length() ); |
421 iCertLabel = HBufC::NewL( iServerName->Length() ); |
395 iCertLabel->Des().Append( iServerName->Des() ); |
422 iCertLabel->Des().Append( iServerName->Des() ); |
396 } |
423 } |
397 |
424 |
398 CleanupStack::PopAndDestroy( serverCert ); |
425 CleanupStack::PopAndDestroy( serverCert ); |
574 void CCTSecurityDialogsAO::DoHandlePinOperationL() |
596 void CCTSecurityDialogsAO::DoHandlePinOperationL() |
575 { |
597 { |
576 if ( iRetry ) // Is this new try? |
598 if ( iRetry ) // Is this new try? |
577 { |
599 { |
578 // Previous attempt was failed |
600 // Previous attempt was failed |
579 // incorrect pin code |
|
580 DoHandleMessageL( EErrorPinCodeIncorrect, KNullDesC, KNullDesC, 0, 0 ); |
601 DoHandleMessageL( EErrorPinCodeIncorrect, KNullDesC, KNullDesC, 0, 0 ); |
581 } |
602 } |
582 // Ask the PIN code or PUK code |
603 // Ask the PIN code or PUK code |
583 if ( iPIN.iPINLabel == KKeyStoreEnterPwLabel ) |
604 if ( iPIN.iPINLabel == KKeyStoreEnterPwLabel ) |
584 { |
605 { |
585 HBufC* header = StringLoader::LoadLC( |
606 HBufC* header = StringLoader::LoadLC( |
586 R_QTN_CM_HEADING_PHONE_KEYSTORE, CEikonEnv::Static() ); |
607 R_QTN_CM_HEADING_PHONE_KEYSTORE, CEikonEnv::Static() ); |
587 iPIN.iMinLength = KMaxKeystorePwLength; |
608 iPIN.iMinLength = KMaxKeystorePwLength; |
588 DoHandleMessageL( EEnterKeyStorePw, KNullDesC, *header, |
609 DoHandleMessageL( EEnterKeyStorePw, KNullDesC, *header, |
589 iPIN.iMinLength, iPIN.iMaxLength ); |
610 iPIN.iMinLength, iPIN.iMaxLength ); |
590 iMultiLineDlgType = EEnterNewKeyStorePw; |
611 iMultiLineDlgType = EEnterNewKeyStorePw; |
591 CleanupStack::PopAndDestroy( header ); |
612 CleanupStack::PopAndDestroy( header ); |
592 RunL(); |
|
593 |
|
594 } |
613 } |
595 else if ( iPIN.iPINLabel == KKeyStoreImportKeyLabel ) |
614 else if ( iPIN.iPINLabel == KKeyStoreImportKeyLabel ) |
596 { |
615 { |
597 iPIN.iMinLength = KMaxKeystorePwLength; |
616 iPIN.iMinLength = KMaxKeystorePwLength; |
598 DoHandleMessageL( EImportKeyPw, KNullDesC, KNullDesC, |
617 DoHandleMessageL( EImportKeyPw, KNullDesC, KNullDesC, |
630 |
649 |
631 // ----------------------------------------------------------------------------- |
650 // ----------------------------------------------------------------------------- |
632 // CCTSecurityDialogsAO::DoHandleMultilinePinQueryL() |
651 // CCTSecurityDialogsAO::DoHandleMultilinePinQueryL() |
633 // ----------------------------------------------------------------------------- |
652 // ----------------------------------------------------------------------------- |
634 // |
653 // |
635 void CCTSecurityDialogsAO::DoHandleMultilinePinQueryL( const TInt& /*aDlgType*/ ) |
654 void CCTSecurityDialogsAO::DoHandleMultilinePinQueryL( const TInt& aDlgType ) |
636 { |
655 { |
637 // TODO |
|
638 #if 0 |
|
639 iMultiLineDlgType = aDlgType; |
656 iMultiLineDlgType = aDlgType; |
640 HBufC* dlgText1 = NULL; |
657 HBufC* dlgText1 = NULL; |
641 HBufC* dlgText2 = NULL; |
658 HBufC* dlgText2 = NULL; |
642 CCTPinPinQueryDialog* dlg = NULL; |
659 CCTPinPinQueryDialog* dlg = NULL; |
643 TDialogType dlgType = ( TDialogType )aDlgType; |
660 TDialogType dlgType = ( TDialogType )aDlgType; |
644 if ( EEnterNewKeyStorePw == dlgType ) |
661 if ( EEnterNewKeyStorePw == dlgType ) |
645 { |
662 { |
646 /* |
|
647 dlgText1 = iNotifier->LoadResourceStringLC( dlgType, KNullDesC ); |
|
648 dlgText2 = iNotifier->LoadResourceStringLC( EVerifyKeyStorePw, KNullDesC ); |
|
649 dlg = CCTPinPinQueryDialog::NewL( *dlgText1, *dlgText2, iPINValue2, |
|
650 iPINValueVerify, iPIN.iMinLength, iPIN.iMaxLength, iRetValue );16:19:13.812 xti1:MCU_ASCII_PRINTF; channel:0xE0; msg:*PlatSec* ERROR - Capability check failed - Process #tlstest[e8dc94b1]0001 was checked by Thread c32exe.exe[101f7989]0001::ESock_IP and was found to be missing the capabilities: NetworkControl . |
|
651 |
|
652 dlg->RunDlgLD( iStatus, R_WIM_PWPW_QUERY_DIALOG ); |
|
653 CleanupStack::PopAndDestroy( 2, dlgText1 ); // dlgText1, dlgText2 |
|
654 */ |
|
655 dlgText1 = StringLoader::LoadLC( R_QTN_SN_NEW_PHONE_KEYSTORE ); |
|
656 dlgText2 = StringLoader::LoadLC( R_QTN_WIM_VERIFY_PIN ); |
|
657 HBufC* message = HBufC::NewLC( KMaxLengthTextCertLabelVisible ); |
|
658 message->Des().Append(dlgText1->Des()); |
|
659 message->Des().Append(_L("|")); |
|
660 message->Des().Append(dlgText2->Des()); |
|
661 CSecQueryUi* SecQueryUi = CSecQueryUi::NewL(); |
|
662 TInt queryAccepted = SecQueryUi->SecQueryDialog(message->Des(), iPINValueVerify, |
|
663 iPIN.iMinLength,iPIN.iMaxLength, |
|
664 ESecUiAlphaSupported | |
|
665 ESecUiCancelSupported | |
|
666 ESecUiSecretSupported | |
|
667 ESecUiEmergencyNotSupported); |
|
668 iRetValue=(queryAccepted==KErrNone); |
|
669 if(iRetValue) |
|
670 iPINValue2.Copy(iPINValueVerify); // dialog already does not OK with different pin codes |
|
671 delete SecQueryUi; |
|
672 SecQueryUi=NULL; |
|
673 CleanupStack::PopAndDestroy( message ); |
|
674 CleanupStack::PopAndDestroy( dlgText2 ); |
|
675 CleanupStack::PopAndDestroy( dlgText1 ); |
|
676 RunL(); // had to call it this way |
|
677 } |
|
678 else if ( EExportKeyPw == dlgType ) |
|
679 { |
|
680 dlgText1 = iNotifier->LoadResourceStringLC( dlgType, KNullDesC ); |
663 dlgText1 = iNotifier->LoadResourceStringLC( dlgType, KNullDesC ); |
681 dlgText2 = iNotifier->LoadResourceStringLC( EVerifyKeyStorePw, KNullDesC ); |
664 dlgText2 = iNotifier->LoadResourceStringLC( EVerifyKeyStorePw, KNullDesC ); |
682 dlg = CCTPinPinQueryDialog::NewL( *dlgText1, *dlgText2, iPINValue2, |
665 dlg = CCTPinPinQueryDialog::NewL( *dlgText1, *dlgText2, iPINValue2, |
683 iPINValueVerify, iPIN.iMinLength, iPIN.iMaxLength, iRetValue ); |
666 iPINValueVerify, iPIN.iMinLength, iPIN.iMaxLength, iRetValue ); |
684 dlg->RunDlgLD( iStatus, R_WIM_PWPW_QUERY_DIALOG ); |
667 dlg->RunDlgLD( iStatus, R_WIM_PWPW_QUERY_DIALOG ); |
685 CleanupStack::PopAndDestroy( 2, dlgText1 ); // dlgText1, dlgText2 |
668 CleanupStack::PopAndDestroy( 2, dlgText1 ); // dlgText1, dlgText2 |
686 } |
669 } |
|
670 else if ( EExportKeyPw == dlgType ) |
|
671 { |
|
672 dlgText1 = iNotifier->LoadResourceStringLC( dlgType, KNullDesC ); |
|
673 dlgText2 = iNotifier->LoadResourceStringLC( EVerifyKeyStorePw, KNullDesC ); |
|
674 dlg = CCTPinPinQueryDialog::NewL( *dlgText1, *dlgText2, iPINValue2, |
|
675 iPINValueVerify, iPIN.iMinLength, iPIN.iMaxLength, iRetValue ); |
|
676 dlg->RunDlgLD( iStatus, R_WIM_PWPW_QUERY_DIALOG ); |
|
677 CleanupStack::PopAndDestroy( 2, dlgText1 ); // dlgText1, dlgText2 |
|
678 } |
687 else // Enter new PIN |
679 else // Enter new PIN |
688 { |
680 { |
689 dlgText1 = iNotifier->LoadResourceStringLC( dlgType, iPIN.iPINLabel ); |
681 dlgText1 = iNotifier->LoadResourceStringLC( dlgType, iPIN.iPINLabel ); |
690 dlgText2 = iNotifier->LoadResourceStringLC( EVerifyPinNR, iPIN.iPINLabel ); |
682 dlgText2 = iNotifier->LoadResourceStringLC( EVerifyPinNR, iPIN.iPINLabel ); |
691 dlg = CCTPinPinQueryDialog::NewL( *dlgText1, *dlgText2, iPINValue2, |
683 dlg = CCTPinPinQueryDialog::NewL( *dlgText1, *dlgText2, iPINValue2, |
692 iPINValueVerify, iPIN.iMinLength, iPIN.iMaxLength, iRetValue ); |
684 iPINValueVerify, iPIN.iMinLength, iPIN.iMaxLength, iRetValue ); |
693 dlg->RunDlgLD( iStatus, R_WIM_PINPIN_QUERY_DIALOG ); |
685 dlg->RunDlgLD( iStatus, R_WIM_PINPIN_QUERY_DIALOG ); |
694 CleanupStack::PopAndDestroy( 2, dlgText1 ); // dlgText1, dlgText2 |
686 CleanupStack::PopAndDestroy( 2, dlgText1 ); // dlgText1, dlgText2 |
695 } |
687 } |
696 #endif |
|
697 User::Leave( KErrGeneral ); |
|
698 } |
688 } |
699 |
689 |
700 // ----------------------------------------------------------------------------- |
690 // ----------------------------------------------------------------------------- |
701 // CCTSecurityDialogsAO::DoHandleMessageL() |
691 // CCTSecurityDialogsAO::DoHandleMessageL() |
702 // ----------------------------------------------------------------------------- |
692 // ----------------------------------------------------------------------------- |
712 |
702 |
713 HBufC* dlgText = iNotifier->LoadResourceStringLC( dlgType, aDynamicText, aPinQueryHeading ); |
703 HBufC* dlgText = iNotifier->LoadResourceStringLC( dlgType, aDynamicText, aPinQueryHeading ); |
714 |
704 |
715 TDialogTypeItem item = iNotifier->GetDialogTypeItem( dlgType ); |
705 TDialogTypeItem item = iNotifier->GetDialogTypeItem( dlgType ); |
716 |
706 |
717 //CAknResourceNoteDialog* dlg = NULL; |
707 CAknResourceNoteDialog* dlg = NULL; |
718 |
708 |
719 TInt resource = 0; |
709 TInt resource = 0; |
720 |
710 |
721 switch ( item.iNoteType ) |
711 switch ( item.iNoteType ) |
722 { |
712 { |
723 case EInfoNote: |
713 case EInfoNote: |
724 { |
714 { |
725 // TODO |
715 dlg = new ( ELeave ) CAknInformationNote( ETrue ); |
726 //dlg = new ( ELeave ) CAknInformationNote( ETrue ); |
|
727 User::Leave( KErrGeneral ); |
|
728 break; |
716 break; |
729 } |
717 } |
730 |
718 |
731 case EErrorNote: |
719 case EErrorNote: |
732 { |
720 { |
733 // TODO |
721 dlg = new ( ELeave ) CAknErrorNote( ETrue ); |
734 //dlg = new ( ELeave ) CAknErrorNote( ETrue ); |
|
735 User::Leave( KErrGeneral ); |
|
736 break; |
722 break; |
737 } |
723 } |
738 case EConfirmationNote: |
724 case EConfirmationNote: |
739 { |
725 { |
740 // TODO |
726 dlg = new ( ELeave ) CAknConfirmationNote( ETrue ); |
741 //dlg = new ( ELeave ) CAknConfirmationNote( ETrue ); |
|
742 User::Leave( KErrGeneral ); |
|
743 break; |
727 break; |
744 } |
728 } |
745 case EInfoDialog: |
729 case EInfoDialog: |
746 { |
730 { |
747 // TODO |
|
748 /* |
|
749 CCTQueryDialog::RunDlgLD( iStatus, |
731 CCTQueryDialog::RunDlgLD( iStatus, |
750 iRetValue, |
732 iRetValue, |
751 *dlgText, item.iSoftKeyResource, |
733 *dlgText, item.iSoftKeyResource, |
752 ECTInfoDialog ); |
734 ECTInfoDialog ); |
753 iStatus = KRequestPending; |
735 iStatus = KRequestPending; |
754 SetActive(); |
736 SetActive(); |
755 */ |
|
756 User::Leave( KErrGeneral ); |
|
757 break; |
737 break; |
758 } |
738 } |
759 case EEnterPwPwDialog: |
739 case EEnterPwPwDialog: |
760 { |
740 { |
761 // TODO |
|
762 /* |
|
763 CCTPinPinQueryDialog* dialog = |
741 CCTPinPinQueryDialog* dialog = |
764 CCTPinPinQueryDialog::NewL( *dlgText, *dlgText, |
742 CCTPinPinQueryDialog::NewL( *dlgText, *dlgText, |
765 iPINValue2, iPINValueVerify, aMinLength, aMaxLength, iRetValue ); |
743 iPINValue2, iPINValueVerify, aMinLength, aMaxLength, iRetValue ); |
766 dialog->RunDlgLD( iStatus, R_WIM_PWPW_QUERY_DIALOG ); |
744 dialog->RunDlgLD( iStatus, R_WIM_PWPW_QUERY_DIALOG ); |
767 */ |
|
768 User::Leave( KErrGeneral ); |
|
769 break; |
745 break; |
770 } |
746 } |
771 case EEnterPinPinCodeDialog: |
747 case EEnterPinPinCodeDialog: |
772 { |
748 { |
773 // TODO |
|
774 /* |
|
775 CCTPinPinQueryDialog* dialog = |
749 CCTPinPinQueryDialog* dialog = |
776 CCTPinPinQueryDialog::NewL( *dlgText, *dlgText, |
750 CCTPinPinQueryDialog::NewL( *dlgText, *dlgText, |
777 iPINValue2, iPINValueVerify, aMinLength, aMaxLength, iRetValue ); |
751 iPINValue2, iPINValueVerify, aMinLength, aMaxLength, iRetValue ); |
778 dialog->RunDlgLD( iStatus, R_WIM_PINPIN_QUERY_DIALOG ); |
752 dialog->RunDlgLD( iStatus, R_WIM_PINPIN_QUERY_DIALOG ); |
779 */ |
|
780 User::Leave( KErrGeneral ); |
|
781 break; |
753 break; |
782 } |
754 } |
783 case EEnterPwDialog: |
755 case EEnterPwDialog: |
784 case EEnterPinNRCodeDialog: |
756 case EEnterPinNRCodeDialog: |
785 case EVerifyPinNRCodeDialog: |
757 case EVerifyPinNRCodeDialog: |
819 default: |
791 default: |
820 { |
792 { |
821 User::Panic(_L("CSecDlgNotifier"), 0); |
793 User::Panic(_L("CSecDlgNotifier"), 0); |
822 } |
794 } |
823 } |
795 } |
824 //iPinQueryDialogDeleted = EFalse; |
796 iPinQueryDialogDeleted = EFalse; |
825 if(aDlgType!=EEnterKeyStorePw) { |
797 CCTPinQueryDialog::RunDlgLD( iStatus, |
826 // TODO |
798 *dlgText, |
827 /* |
799 *pinValue, |
828 CCTPinQueryDialog::RunDlgLD( iStatus, |
800 aMinLength, |
829 *dlgText, |
801 aMaxLength, |
830 *pinValue, |
802 iRetValue, |
831 aMinLength, |
803 resource, |
832 aMaxLength, |
804 iPinQueryDialog, |
833 iRetValue, |
805 iPinQueryDialogDeleted ); |
834 resource, |
|
835 iPinQueryDialog, |
|
836 iPinQueryDialogDeleted ); |
|
837 */ |
|
838 User::Leave( KErrGeneral ); |
|
839 resource = resource; // avoids compiler warning |
|
840 break; |
|
841 } |
|
842 else |
|
843 { |
|
844 iPIN.iMinLength = KMaxKeystorePwLength; |
|
845 CSecQueryUi* SecQueryUi = CSecQueryUi::NewL(); |
|
846 HBufC* header =StringLoader::LoadLC( R_QTN_SN_ENTER_PHONE_KEYSTORE); |
|
847 TInt queryAccepted = SecQueryUi->SecQueryDialog(header->Des(), *pinValue, |
|
848 aMinLength,aMaxLength, |
|
849 ESecUiAlphaSupported | |
|
850 ESecUiCancelSupported | |
|
851 ESecUiSecretSupported | |
|
852 ESecUiEmergencyNotSupported); |
|
853 delete SecQueryUi; |
|
854 SecQueryUi=NULL; |
|
855 iRetValue=(queryAccepted==KErrNone); |
|
856 CleanupStack::PopAndDestroy( header ); |
|
857 break; |
806 break; |
858 } |
|
859 } |
807 } |
860 default: |
808 default: |
861 { |
809 { |
862 break; |
810 break; |
863 } |
811 } |
864 |
812 |
865 } |
813 } |
866 // TODO |
814 |
867 /* |
815 if ( dlg ) |
868 if ( dlg && aDlgType!=EEnterKeyStorePw) |
|
869 { |
816 { |
870 |
|
871 dlg->ExecuteLD( *dlgText ); |
817 dlg->ExecuteLD( *dlgText ); |
872 dlg = NULL; |
818 dlg = NULL; |
873 } |
819 } |
874 */ |
|
875 User::Leave( KErrGeneral ); |
|
876 |
820 |
877 CleanupStack::PopAndDestroy( dlgText ); // dlgText |
821 CleanupStack::PopAndDestroy( dlgText ); // dlgText |
878 } |
822 } |
879 |
823 |
880 // ----------------------------------------------------------------------------- |
824 // ----------------------------------------------------------------------------- |
1032 // |
974 // |
1033 void CCTSecurityDialogsAO::RunL() |
975 void CCTSecurityDialogsAO::RunL() |
1034 { |
976 { |
1035 WIMSECURITYDIALOGS_WRITE_FORMAT( "CCTSecurityDialogsAO::RunL, iStatus %d", iStatus.Int() ); |
977 WIMSECURITYDIALOGS_WRITE_FORMAT( "CCTSecurityDialogsAO::RunL, iStatus %d", iStatus.Int() ); |
1036 WIMSECURITYDIALOGS_WRITE_FORMAT( " iNextStep %d", iNextStep ); |
978 WIMSECURITYDIALOGS_WRITE_FORMAT( " iNextStep %d", iNextStep ); |
1037 TRACE1( "CCTSecurityDialogsAO::RunL, iStatus.Int()=%d", iStatus.Int() ); |
979 |
1038 |
980 if ( iStatus != KErrNone ) |
1039 if( iStatus != KErrNone ) |
|
1040 { |
981 { |
1041 User::Leave( iStatus.Int() ); |
982 User::Leave( iStatus.Int() ); |
1042 } |
983 } // if |
1043 |
984 |
1044 TRACE1( "CCTSecurityDialogsAO::RunL, iNextStep=%d", iNextStep ); |
985 switch ( iNextStep ) |
1045 switch( iNextStep ) |
|
1046 { |
986 { |
1047 case EOperationCompleted: |
987 case EOperationCompleted: |
1048 { |
988 { |
1049 WIMSECURITYDIALOGS_WRITE( "EOperationCompleted" ); |
989 WIMSECURITYDIALOGS_WRITE( "EOperationCompleted" ); |
1050 HandleResponseAndCompleteL(); |
990 HandleResponseAndCompleteL(); |
1051 break; |
991 break; |
1052 } |
992 } |
1053 |
|
1054 case ECheckServerCerts: |
993 case ECheckServerCerts: |
1055 { |
994 { |
1056 WIMSECURITYDIALOGS_WRITE( "ECheckServerCerts" ); |
995 WIMSECURITYDIALOGS_WRITE( "ECheckServerCerts" ); |
1057 |
996 |
1058 TBool foundCert( EFalse ); |
997 TBool foundCert( EFalse ); |
1059 |
998 |
1060 if( iServerCerts.Count() ) |
999 if ( iServerCerts.Count() ) |
1061 { |
1000 { |
1062 // Found certificates in the trusted site certificate storage. |
1001 // Found certificates in the trusted site certificate storage. |
1063 // Compare them with the one received from TlsProvider |
1002 // Compare them with the one received from TlsProvider |
1064 iCertPtr.Set( iCertBuf->Des() ); |
1003 iCertPtr.Set( iCertBuf->Des() ); |
1065 CX509Certificate* serverCert = CX509Certificate::NewLC( iCertPtr ); |
1004 CX509Certificate* serverCert = CX509Certificate::NewLC( iCertPtr ); |
1066 |
1005 |
1067 for( TInt i = 0; i < iServerCerts.Count(); i++ ) |
1006 for (TInt i=0; i<iServerCerts.Count(); i++ ) |
1068 { |
1007 { |
1069 TPtr8 certPtr( iServerCerts[i]->Des() ); |
1008 TPtr8 certPtr( iServerCerts[i]->Des() ); |
|
1009 |
1070 CX509Certificate* cert = CX509Certificate::NewLC( certPtr ); |
1010 CX509Certificate* cert = CX509Certificate::NewLC( certPtr ); |
1071 if( cert->Fingerprint() == serverCert->Fingerprint() ) |
1011 |
|
1012 // Compare fingerprints |
|
1013 if ( cert->Fingerprint() == serverCert->Fingerprint() ) |
1072 { |
1014 { |
|
1015 // Fingerprints match |
1073 foundCert = ETrue; |
1016 foundCert = ETrue; |
1074 } |
1017 } |
1075 CleanupStack::PopAndDestroy( cert ); |
1018 CleanupStack::PopAndDestroy( cert ); |
1076 } |
1019 } |
1077 |
|
1078 CleanupStack::PopAndDestroy( serverCert ); |
1020 CleanupStack::PopAndDestroy( serverCert ); |
1079 |
1021 if ( foundCert ) |
1080 if( foundCert ) |
|
1081 { |
1022 { |
1082 // Found matching certificate. Complete the operation |
1023 // Found matching certificate. Complete the operation |
1083 iRetValue = EServerCertAcceptedPermanently; |
1024 iRetValue = EServerCertAcceptedPermanently; |
1084 iNextStep = EOperationCompleted; |
1025 iNextStep = EOperationCompleted; |
1085 HandleResponseAndCompleteL(); |
1026 HandleResponseAndCompleteL(); |
1086 } |
1027 } |
1087 } |
1028 } |
1088 |
1029 |
1089 if ( !foundCert ) |
1030 if ( !foundCert ) |
1090 { |
1031 { |
1091 // Couldn't find matching certificate. Prompt user |
1032 // Couldn't find matching certificate. Prompt user |
1092 ShowNoTrustDialogL(); |
1033 ShowNoTrustDialogL(); |
1093 } |
1034 } |
|
1035 |
1094 break; |
1036 break; |
1095 } |
1037 } |
1096 |
|
1097 case EProcessTrustedSite: |
1038 case EProcessTrustedSite: |
1098 { |
1039 { |
1099 WIMSECURITYDIALOGS_WRITE( "EProcessTrustedSite" ); |
1040 WIMSECURITYDIALOGS_WRITE( "EProcessTrustedSite" ); |
1100 TRACE( "CCTSecurityDialogsAO::RunL, EProcessTrustedSite" ); |
|
1101 |
|
1102 TInt count = iCertStore->WritableCertStoreCount(); |
1041 TInt count = iCertStore->WritableCertStoreCount(); |
1103 for( TInt i = 0; i < count; i++ ) |
1042 for ( TInt i = 0; i < count; i++ ) |
1104 { |
1043 { |
1105 MCTWritableCertStore *certstore = &iCertStore->WritableCertStore( i ); |
1044 MCTWritableCertStore *certstore = &iCertStore->WritableCertStore( i ); |
1106 MCTToken& token = certstore->Token(); |
1045 MCTToken& token = certstore->Token(); |
1107 TUid tokenuid = token.Handle().iTokenTypeUid; |
1046 TUid tokenuid = token.Handle().iTokenTypeUid; |
1108 if( tokenuid == KTrustedServerTokenUid ) |
1047 if ( tokenuid == KTrustedServerTokenUid ) |
1109 { |
1048 { |
1110 iTrustedSiteCertStore = certstore; |
1049 iTrustedSiteCertStore = certstore; |
1111 } |
1050 } |
1112 } |
1051 } |
1113 |
1052 |
1235 HandleResponseAndCompleteL(); |
1172 HandleResponseAndCompleteL(); |
1236 } |
1173 } |
1237 else |
1174 else |
1238 { |
1175 { |
1239 //Adding server certificate failed |
1176 //Adding server certificate failed |
1240 // TODO: unreached code? |
|
1241 iNextStep = EOperationCompleted; |
1177 iNextStep = EOperationCompleted; |
1242 iRetValue = EServerCertNotAccepted; |
1178 iRetValue = EServerCertNotAccepted; |
1243 HandleResponseAndCompleteL(); |
1179 HandleResponseAndCompleteL(); |
1244 } |
1180 } |
1245 break; |
1181 break; |
1246 } |
1182 } |
1247 |
1183 |
1248 case ESaveServerCert: |
1184 case ESaveServerCert: |
1249 { |
1185 { |
1250 WIMSECURITYDIALOGS_WRITE( "ESaveServerCert" ); |
1186 WIMSECURITYDIALOGS_WRITE( "ESaveServerCert" ); |
1251 TRACE( "CCTSecurityDialogsAO::RunL, ESaveServerCert" ); |
|
1252 DoHandleSaveServerCertL(); |
1187 DoHandleSaveServerCertL(); |
1253 break; |
1188 break; |
1254 } |
1189 } |
1255 |
|
1256 case EServerCertCheckUserResp: |
1190 case EServerCertCheckUserResp: |
1257 { |
1191 { |
1258 WIMSECURITYDIALOGS_WRITE( "EServerCertCheckUserResp" ); |
1192 WIMSECURITYDIALOGS_WRITE( "EServerCertCheckUserResp" ); |
1259 TRACE( "CCTSecurityDialogsAO::RunL, EServerCertCheckUserResp" ); |
1193 if ( iRetValue == EServerCertAcceptedPermanently ) |
1260 if( iRetValue == EServerCertAcceptedPermanently ) |
|
1261 { |
1194 { |
1262 // User accepted to select certificate permanently. |
1195 // User accepted to select certificate permanently. |
1263 // First add server certificate |
1196 // First add server certificate |
1264 iNextStep = ESaveServerCert; |
1197 iNextStep = ESaveServerCert; |
1265 iStatus = KRequestPending; |
1198 iStatus = KRequestPending; |
1537 |
1456 |
1538 if ( !foundDevCert ) |
1457 if ( !foundDevCert ) |
1539 { |
1458 { |
1540 // No certificate from Device Certificate Store. Prompt user |
1459 // No certificate from Device Certificate Store. Prompt user |
1541 // for certificate selection |
1460 // for certificate selection |
1542 /* |
|
1543 CCTSelectCertificateDialog::RunDlgLD( |
1461 CCTSelectCertificateDialog::RunDlgLD( |
1544 iCertArray, iCertHandleList, iTokenHandle, |
1462 iCertArray, iCertHandleList, iTokenHandle, |
1545 iStatus, iRetValue ); // Takes ownerhip of array |
1463 iStatus, iRetValue ); // Takes ownerhip of array |
1546 |
1464 |
1547 iNextStep = EOperationCompleted; |
1465 iNextStep = EOperationCompleted; |
1548 iStatus = KRequestPending; |
1466 iStatus = KRequestPending; |
1549 SetActive(); |
1467 SetActive(); |
1550 */ |
|
1551 User::Leave( KErrGeneral ); // TODO: to be implemented |
|
1552 } |
1468 } |
1553 } |
1469 } |
1554 |
1470 |
1555 // ----------------------------------------------------------------------------- |
1471 // ----------------------------------------------------------------------------- |
1556 // CCTSecurityDialogsAO::ShowNoTrustDialogL() |
1472 // CCTSecurityDialogsAO::ShowNoTrustDialogL() |
1557 // ----------------------------------------------------------------------------- |
1473 // ----------------------------------------------------------------------------- |
1558 // |
1474 // |
1559 void CCTSecurityDialogsAO::ShowNoTrustDialogL() |
1475 void CCTSecurityDialogsAO::ShowNoTrustDialogL() |
1560 { |
1476 { |
1561 TRACE( "CCTSecurityDialogsAO::ShowNoTrustDialogL, begin" ); |
1477 // Cannot display untrusted certificate dialog if device is locked. Untrusted |
1562 |
1478 // certificate dialog would be displayed on top of possible lock code query. |
1563 // If trusted site certstore open has failed, then it is not possible to save |
1479 TInt value = 0; |
1564 // the host name for permanent use. Hence, choice for permanent accept is not |
1480 TInt err = RProperty::Get( KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, value ); |
1565 // displayed if trusted site certstore open has failed. Other restrictions for |
1481 if( !err && value != EAutolockOff ) |
1566 // permanent accept are defined in device dialog (UntrustedCertificateWidget). |
1482 { |
1567 TBool isTrustedSiteCertStoreOpened = ( iTrustedSiteCertStore != NULL ); |
1483 iRetValue = EServerCertNotAccepted; |
1568 CCTUntrustedCertQuery *untrustedCertDlg = CCTUntrustedCertQuery::NewLC( |
1484 iStatus = KRequestPending; |
1569 iAuthFailReason, *iCertBuf, *iServerName, isTrustedSiteCertStoreOpened ); |
1485 TRequestStatus* status( &iStatus ); |
1570 |
1486 User::RequestComplete( status, KErrNone ); |
1571 CCTUntrustedCertQuery::TResponse response = CCTUntrustedCertQuery::EQueryRejected; |
1487 } |
1572 untrustedCertDlg->ShowQueryAndWaitForResponseL( response ); |
1488 else |
1573 switch( response ) |
1489 { |
1574 { |
1490 CX509Certificate* cert = CX509Certificate::NewLC( iCertBuf->Des() ); |
1575 case CCTUntrustedCertQuery::EQueryAccepted: |
1491 TInt dialogResourceId = R_WIM_NO_TRUST_QUERY_UNTRUSTED; |
1576 iRetValue = EServerCertAcceptedTemporarily; |
1492 TInt promptResourceId = R_QTN_ICS_SSL_CONF_Q_ACCEPT_UNTRUSTED; |
1577 break; |
1493 TBool showPermAccept = ETrue; |
1578 case CCTUntrustedCertQuery::EQueryAcceptedPermanently: |
1494 |
1579 // TODO: show confirmation note, qtn_httpsec_query_perm_accept_text |
1495 if( iAuthFailReason == ESignatureInvalid || iAuthFailReason == ECertificateRevoked ) |
1580 // "Connection to site %U will be made in future without any warnings. Continue?"" |
1496 { |
1581 iRetValue = EServerCertAcceptedPermanently; |
1497 // Invalid or revoked certificate |
1582 break; |
1498 CCTInvalidCertificateNote* note = |
1583 case CCTUntrustedCertQuery::EQueryRejected: |
1499 new( ELeave ) CCTInvalidCertificateNote( *this, iStatus ); |
1584 default: |
1500 note->ExecuteLD( R_WIM_INVALID_CERTIFICATE_INFORMATION_NOTE ); |
1585 iRetValue = EServerCertNotAccepted; |
1501 iRetValue = EServerCertNotAccepted; |
1586 break; |
1502 |
1587 } |
1503 // CCTNoTrustQuery below self-completes this active object. It is necessary to |
1588 CleanupStack::PopAndDestroy( untrustedCertDlg ); |
1504 // complete it here too, in order to run the next step EServerCertCheckUserResp. |
1589 TRACE1( "CCTSecurityDialogsAO::ShowNoTrustDialogL, iRetValue=%d", iRetValue ); |
1505 iStatus = KRequestPending; |
|
1506 TRequestStatus* status( &iStatus ); |
|
1507 User::RequestComplete( status, KErrNone ); |
|
1508 } |
|
1509 else |
|
1510 { |
|
1511 if( iAuthFailReason == EValidatedOK || iAuthFailReason == EDateOutOfRange ) |
|
1512 { |
|
1513 // Trusted certificate, but problems with CN or date |
|
1514 |
|
1515 // Retrieve subject name |
|
1516 const CX500DistinguishedName& dName = cert->SubjectName(); |
|
1517 |
|
1518 // Retrieve common name |
|
1519 HBufC* cn = dName.ExtractFieldL( KX520CommonName ); |
|
1520 |
|
1521 // Check common name first and then date |
|
1522 if( !cn ) |
|
1523 { |
|
1524 // Couldn't retrieve CN from certificate |
|
1525 dialogResourceId = R_WIM_NO_TRUST_QUERY_UNTRUSTED; |
|
1526 promptResourceId = R_QTN_ICS_SSL_CONF_Q_ACCEPT_UNTRUSTED; |
|
1527 } |
|
1528 else if( iServerName->Des() != cn->Des() ) |
|
1529 { |
|
1530 // Domain name doesn't match with CN |
|
1531 dialogResourceId = R_WIM_NO_TRUST_QUERY_SITE; |
|
1532 promptResourceId = R_QTN_ICS_SSL_CONF_Q_ACCEPT_SITE; |
|
1533 } |
|
1534 else if( iAuthFailReason == EDateOutOfRange ) |
|
1535 { |
|
1536 // Certificate is out of date |
|
1537 dialogResourceId = R_WIM_NO_TRUST_QUERY_OOD; |
|
1538 promptResourceId = R_QTN_ICS_SSL_CONF_Q_ACCEPT_OOD; |
|
1539 showPermAccept = EFalse; |
|
1540 } |
|
1541 else |
|
1542 { |
|
1543 // Otherwise show general untrusted note |
|
1544 dialogResourceId = R_WIM_NO_TRUST_QUERY_UNTRUSTED; |
|
1545 promptResourceId = R_QTN_ICS_SSL_CONF_Q_ACCEPT_UNTRUSTED; |
|
1546 } |
|
1547 } |
|
1548 else |
|
1549 { |
|
1550 // Untrusted certificate |
|
1551 dialogResourceId = R_WIM_NO_TRUST_QUERY_UNTRUSTED; |
|
1552 promptResourceId = R_QTN_ICS_SSL_CONF_Q_ACCEPT_UNTRUSTED; |
|
1553 } |
|
1554 |
|
1555 // No "Accept Permanently" option if certificate is out of date, or |
|
1556 // if domain name is not defined, or if trusted site store failed to |
|
1557 // open (and it's not possible to save the server certificate). |
|
1558 const CValidityPeriod& validityPeriod = cert->ValidityPeriod(); |
|
1559 const TTime& startValue = validityPeriod.Start(); |
|
1560 const TTime& finishValue = validityPeriod.Finish(); |
|
1561 TTime current; |
|
1562 current.UniversalTime(); |
|
1563 |
|
1564 if( (( startValue > current ) || ( finishValue < current )) || |
|
1565 ( iServerName->Des().Length() == 0 ) || |
|
1566 ( !iTrustedSiteCertStore ) ) |
|
1567 { |
|
1568 showPermAccept = EFalse; |
|
1569 } |
|
1570 |
|
1571 // CCTNoTrustQuery completes iStatus asynchronously when ready. Note that |
|
1572 // it happens after ExecuteLD() and also this function have returned. |
|
1573 iStatus = KRequestPending; |
|
1574 |
|
1575 iQueryDialog = new( ELeave ) CCTNoTrustQuery( *this, iRetValue, iStatus, |
|
1576 iServerName, showPermAccept, iQueryDialogDeleted ); |
|
1577 HBufC* prompt = StringLoader::LoadLC( promptResourceId, *iServerName ); |
|
1578 |
|
1579 iQueryDialog->ExecuteLD( dialogResourceId, *prompt ); |
|
1580 |
|
1581 CleanupStack::PopAndDestroy( prompt ); |
|
1582 } |
|
1583 |
|
1584 CleanupStack::PopAndDestroy( cert ); |
|
1585 } |
1590 |
1586 |
1591 iNextStep = EServerCertCheckUserResp; |
1587 iNextStep = EServerCertCheckUserResp; |
1592 iStatus = KRequestPending; |
|
1593 TRequestStatus* status = &iStatus; |
|
1594 User::RequestComplete( status, KErrNone ); |
|
1595 SetActive(); |
1588 SetActive(); |
1596 } |
1589 } |
1597 |
1590 |
1598 // ----------------------------------------------------------------------------- |
1591 // ----------------------------------------------------------------------------- |
1599 // CCTSecurityDialogsAO::ShowCSRDialogL() |
1592 // CCTSecurityDialogsAO::ShowCSRDialogL() |
1606 |
1599 |
1607 DetailsResourceL( messagePtr, R_QTN_SN_CERT_SIGN_EXPLANATION ); |
1600 DetailsResourceL( messagePtr, R_QTN_SN_CERT_SIGN_EXPLANATION ); |
1608 |
1601 |
1609 messagePtr.Append( KEnter ); |
1602 messagePtr.Append( KEnter ); |
1610 |
1603 |
1611 //DetailsFieldDynamicL( messagePtr, *iText, |
1604 DetailsFieldDynamicL( messagePtr, *iText, |
1612 // R_TEXT_RESOURCE_DETAILS_VIEW_SUBJECT, |
1605 R_TEXT_RESOURCE_DETAILS_VIEW_SUBJECT, |
1613 // R_TEXT_RESOURCE_VIEW_NO_SUBJECT_DETAILS ); |
1606 R_TEXT_RESOURCE_VIEW_NO_SUBJECT_DETAILS ); |
1614 |
1607 |
1615 AddKeyUsageL( messagePtr, iKeyInfo ); |
1608 AddKeyUsageL( messagePtr, iKeyInfo ); |
1616 AddKeyAlgorithmL( messagePtr, iKeyInfo ); |
1609 AddKeyAlgorithmL( messagePtr, iKeyInfo ); |
1617 AddKeySizeL( messagePtr, iKeyInfo ); |
1610 AddKeySizeL( messagePtr, iKeyInfo ); |
1618 AddKeyLocationL( messagePtr, iKeyInfo ); |
1611 AddKeyLocationL( messagePtr, iKeyInfo ); |
1619 |
1612 |
1620 // TODO |
1613 CCTSignTextDialog::RunDlgLD( R_WIM_CSR_DIALOG, *message, iStatus, iRetValue ); |
1621 //CCTSignTextDialog::RunDlgLD( R_WIM_CSR_DIALOG, *message, iStatus, iRetValue ); |
|
1622 User::Leave( KErrGeneral ); |
|
1623 CleanupStack::PopAndDestroy( message ); |
1614 CleanupStack::PopAndDestroy( message ); |
1624 |
1615 |
1625 iStatus = KRequestPending; |
1616 iStatus = KRequestPending; |
1626 SetActive(); |
1617 SetActive(); |
1627 } |
1618 } |
1765 default: |
1752 default: |
1766 { |
1753 { |
1767 User::Leave( KErrNotSupported ); |
1754 User::Leave( KErrNotSupported ); |
1768 } |
1755 } |
1769 } |
1756 } |
1770 */ |
1757 |
1771 CleanupStack::Pop( message ); |
1758 CleanupStack::Pop( message ); |
1772 return message; |
1759 return message; |
1773 } |
1760 } |
1774 |
1761 |
1775 // ----------------------------------------------------------------------------- |
1762 // ----------------------------------------------------------------------------- |
1776 // CCTSecurityDialogsAO::AddIssuerAndSubjectL(...) |
1763 // CCTSecurityDialogsAO::AddIssuerAndSubjectL(...) |
1777 // ----------------------------------------------------------------------------- |
1764 // ----------------------------------------------------------------------------- |
1778 // |
1765 // |
1779 void CCTSecurityDialogsAO::AddSiteL( TDes& /*aMessage*/ ) |
1766 void CCTSecurityDialogsAO::AddSiteL( TDes& aMessage ) |
1780 { |
1767 { |
1781 /* |
|
1782 if ( iServerName ) |
1768 if ( iServerName ) |
1783 { |
1769 { |
1784 DetailsFieldDynamicL( aMessage, iServerName->Des(), |
1770 DetailsFieldDynamicL( aMessage, iServerName->Des(), |
1785 R_QTN_CM_SITE, |
1771 R_QTN_CM_SITE, |
1786 R_TEXT_RESOURCE_DETAILS_VIEW_NOT_DEFINED ); |
1772 R_TEXT_RESOURCE_DETAILS_VIEW_NOT_DEFINED ); |
1787 } |
1773 } |
1788 */ |
|
1789 } |
1774 } |
1790 |
1775 |
1791 // ----------------------------------------------------------------------------- |
1776 // ----------------------------------------------------------------------------- |
1792 // CCTSecurityDialogsAO::AddIssuerAndSubjectL(...) |
1777 // CCTSecurityDialogsAO::AddIssuerAndSubjectL(...) |
1793 // ----------------------------------------------------------------------------- |
1778 // ----------------------------------------------------------------------------- |
1794 // |
1779 // |
1795 void CCTSecurityDialogsAO::AddIssuerAndSubjectL( TDes& /*aMessage*/, const CX509Certificate& /*aCert*/ ) |
1780 void CCTSecurityDialogsAO::AddIssuerAndSubjectL( TDes& aMessage, const CX509Certificate& aCert ) |
1796 { |
1781 { |
1797 /* |
|
1798 HBufC* issuer = NULL; |
1782 HBufC* issuer = NULL; |
1799 HBufC* owner = NULL; |
1783 HBufC* owner = NULL; |
1800 X509CertNameParser::SubjectFullNameL( aCert, owner ); |
1784 X509CertNameParser::SubjectFullNameL( aCert, owner ); |
1801 CleanupStack::PushL( owner ); |
1785 CleanupStack::PushL( owner ); |
1802 X509CertNameParser::IssuerFullNameL( aCert, issuer ); |
1786 X509CertNameParser::IssuerFullNameL( aCert, issuer ); |
2111 |
2084 |
2112 // ----------------------------------------------------------------------------- |
2085 // ----------------------------------------------------------------------------- |
2113 // CCTSecurityDialogsAO::AddCertFormatL(...) |
2086 // CCTSecurityDialogsAO::AddCertFormatL(...) |
2114 // ----------------------------------------------------------------------------- |
2087 // ----------------------------------------------------------------------------- |
2115 // |
2088 // |
2116 void CCTSecurityDialogsAO::AddCertFormatL( TDes& /*aMessage*/, TCertificateFormat aCertFormat) |
2089 void CCTSecurityDialogsAO::AddCertFormatL( TDes& aMessage, TCertificateFormat aCertFormat) |
2117 { |
2090 { |
2118 //TInt fieldType = 0; |
2091 TInt fieldType = 0; |
2119 switch ( aCertFormat ) |
2092 switch ( aCertFormat ) |
2120 { |
2093 { |
2121 case EX509CertificateUrl: |
2094 case EX509CertificateUrl: |
2122 case EX509Certificate: |
2095 case EX509Certificate: |
2123 { |
2096 { |
2124 //fieldType = R_TEXT_RESOURCE_DETAILS_VIEW_CERT_FORMAT_X509; |
2097 fieldType = R_TEXT_RESOURCE_DETAILS_VIEW_CERT_FORMAT_X509; |
2125 break; |
2098 break; |
2126 } |
2099 } |
2127 default: |
2100 default: |
2128 { |
2101 { |
2129 //fieldType = R_TEXT_RESOURCE_DETAILS_VIEW_NOT_DEFINED; |
2102 fieldType = R_TEXT_RESOURCE_DETAILS_VIEW_NOT_DEFINED; |
2130 break; |
2103 break; |
2131 } |
2104 } |
2132 } |
2105 } |
2133 //DetailsFieldResourceL( aMessage, |
2106 DetailsFieldResourceL( aMessage, |
2134 // R_TEXT_RESOURCE_DETAILS_VIEW_CERT_FORMAT, fieldType ); |
2107 R_TEXT_RESOURCE_DETAILS_VIEW_CERT_FORMAT, fieldType ); |
2135 } |
2108 } |
2136 |
2109 |
2137 // ----------------------------------------------------------------------------- |
2110 // ----------------------------------------------------------------------------- |
2138 // CCTSecurityDialogsAO::AddCertAlgorithmsL(...) |
2111 // CCTSecurityDialogsAO::AddCertAlgorithmsL(...) |
2139 // ----------------------------------------------------------------------------- |
2112 // ----------------------------------------------------------------------------- |
2140 // |
2113 // |
2141 void CCTSecurityDialogsAO::AddCertAlgorithmsL( TDes& /*aMessage*/, const CX509Certificate& /*aCert*/ ) |
2114 void CCTSecurityDialogsAO::AddCertAlgorithmsL( TDes& aMessage, const CX509Certificate& aCert ) |
2142 { |
2115 { |
2143 /* |
|
2144 TInt fieldType = 0; |
2116 TInt fieldType = 0; |
2145 TInt fieldType2 = 0; |
2117 TInt fieldType2 = 0; |
|
2118 |
2146 // digest algorithm |
2119 // digest algorithm |
2147 TAlgorithmId algorithmId = |
2120 TAlgorithmId algorithmId = aCert.SigningAlgorithm().DigestAlgorithm().Algorithm(); |
2148 aCert.SigningAlgorithm().DigestAlgorithm().Algorithm(); |
2121 fieldType = AlgorithmNameResourceId( algorithmId ); |
2149 switch ( algorithmId ) |
|
2150 { |
|
2151 case EMD2: |
|
2152 { |
|
2153 fieldType = R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM_MD2; |
|
2154 break; |
|
2155 } |
|
2156 case EMD5: |
|
2157 { |
|
2158 fieldType = R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM_MD5; |
|
2159 break; |
|
2160 } |
|
2161 case ESHA1: |
|
2162 { |
|
2163 fieldType = R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM_SHA1; |
|
2164 break; |
|
2165 } |
|
2166 default: |
|
2167 { |
|
2168 fieldType = R_TEXT_RESOURCE_DETAILS_VIEW_UNKNOWN; |
|
2169 break; |
|
2170 } |
|
2171 } |
|
2172 |
2122 |
2173 // public-key algorithm |
2123 // public-key algorithm |
2174 algorithmId = |
2124 algorithmId = aCert.SigningAlgorithm().AsymmetricAlgorithm().Algorithm(); |
2175 aCert.SigningAlgorithm().AsymmetricAlgorithm().Algorithm(); |
2125 fieldType2 = AlgorithmNameResourceId( algorithmId ); |
2176 switch ( algorithmId ) |
|
2177 { |
|
2178 case ERSA: |
|
2179 { |
|
2180 fieldType2 = R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM_RSA; |
|
2181 break; |
|
2182 } |
|
2183 case EDSA: |
|
2184 { |
|
2185 fieldType2 = R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM_DSA; |
|
2186 break; |
|
2187 } |
|
2188 case EDH: |
|
2189 { |
|
2190 fieldType2 = R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM_DH; |
|
2191 break; |
|
2192 } |
|
2193 default: |
|
2194 { |
|
2195 fieldType2 = R_TEXT_RESOURCE_DETAILS_VIEW_UNKNOWN; |
|
2196 } |
|
2197 } |
|
2198 |
2126 |
2199 // If other algorithm is unknown |
2127 // If other algorithm is unknown |
2200 if ( fieldType == R_TEXT_RESOURCE_DETAILS_VIEW_UNKNOWN || |
2128 if( fieldType == R_TEXT_RESOURCE_DETAILS_VIEW_UNKNOWN || |
2201 fieldType2 == R_TEXT_RESOURCE_DETAILS_VIEW_UNKNOWN ) |
2129 fieldType2 == R_TEXT_RESOURCE_DETAILS_VIEW_UNKNOWN ) |
2202 { |
2130 { |
2203 DetailsFieldResourceL( aMessage, |
2131 DetailsFieldResourceL( aMessage, |
2204 R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM, R_TEXT_RESOURCE_DETAILS_VIEW_UNKNOWN ); |
2132 R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM, R_TEXT_RESOURCE_DETAILS_VIEW_UNKNOWN ); |
2205 } |
2133 } |
2395 pinValueBufPtr = iPINValue1; |
2318 pinValueBufPtr = iPINValue1; |
2396 } |
2319 } |
2397 iMessagePtr.WriteL( iReplySlot, pinValueBufPtr ); |
2320 iMessagePtr.WriteL( iReplySlot, pinValueBufPtr ); |
2398 break; |
2321 break; |
2399 } |
2322 } |
2400 |
|
2401 case EChangePIN: |
2323 case EChangePIN: |
2402 case EUnblockPIN: |
2324 case EUnblockPIN: |
2403 { |
2325 { |
2404 TTwoPINOutput twoPINOutput; |
2326 TTwoPINOutput twoPINOutput; |
2405 twoPINOutput.iPINValueToCheck = iPINValue1; |
2327 twoPINOutput.iPINValueToCheck = iPINValue1; |
2406 twoPINOutput.iNewPINValue = iPINValue2; |
2328 twoPINOutput.iNewPINValue = iPINValue2; |
2407 TTwoPINOutputBuf twoPINOutputBuf( twoPINOutput ); |
2329 TTwoPINOutputBuf twoPINOutputBuf( twoPINOutput ); |
2408 iMessagePtr.WriteL( iReplySlot, twoPINOutputBuf ); |
2330 iMessagePtr.WriteL( iReplySlot, twoPINOutputBuf ); |
2409 break; |
2331 break; |
2410 } |
2332 } |
2411 |
|
2412 case ESignText: // flow thru |
2333 case ESignText: // flow thru |
2413 case EUserAuthenticationText: // flow thru |
2334 case EUserAuthenticationText: // flow thru |
2414 case EUserAuthentication: |
2335 case EUserAuthentication: |
2415 { |
2336 { |
2416 TCTTokenObjectHandleBuf tokenObjectHandleBuf( iTokenHandle ); |
2337 TCTTokenObjectHandleBuf tokenObjectHandleBuf( iTokenHandle ); |
2417 iMessagePtr.WriteL( iReplySlot, tokenObjectHandleBuf ); |
2338 iMessagePtr.WriteL( iReplySlot, tokenObjectHandleBuf ); |
2418 break; |
2339 break; |
2419 } |
2340 } |
2420 |
|
2421 case EServerAuthenticationFailure: |
2341 case EServerAuthenticationFailure: |
2422 { |
2342 { |
2423 TServerAuthenticationFailureDialogResult result = EStop; |
2343 TServerAuthenticationFailureDialogResult result = EStop; |
2424 |
2344 |
2425 if( iRetValue != EServerCertAcceptedPermanently ) |
2345 if ( iRetValue != EServerCertAcceptedPermanently ) |
2426 { |
2346 { |
2427 if( iRetValue == EServerCertAcceptedTemporarily ) |
2347 if ( iRetValue == EServerCertAcceptedTemporarily ) |
2428 { |
2348 { |
2429 result = EContinue; |
2349 result = EContinue; |
2430 } |
2350 } |
2431 else |
2351 else |
2432 { |
2352 { |