# HG changeset patch # User hgs # Date 1277796556 -10800 # Node ID 3aa774c655acd0ed7aab5d16463661429c896413 # Parent b3e22c78f79eb20345848248b77a395155f2eed1 201025_05 diff -r b3e22c78f79e -r 3aa774c655ac pkiutilities/CTSecurityDialogs/NotifInc/CTSecurityDialogsAO.h --- a/pkiutilities/CTSecurityDialogs/NotifInc/CTSecurityDialogsAO.h Mon Jun 28 13:01:48 2010 +0300 +++ b/pkiutilities/CTSecurityDialogs/NotifInc/CTSecurityDialogsAO.h Tue Jun 29 10:29:16 2010 +0300 @@ -170,6 +170,8 @@ void ShowCSRDialogL(); + void ShowInformationNoteL( TInt aResourceID ) const; + /** * Saves digital signature receipt */ diff -r b3e22c78f79e -r 3aa774c655ac pkiutilities/CTSecurityDialogs/NotifSrc/CTSecurityDialogsAO.cpp --- a/pkiutilities/CTSecurityDialogs/NotifSrc/CTSecurityDialogsAO.cpp Mon Jun 28 13:01:48 2010 +0300 +++ b/pkiutilities/CTSecurityDialogs/NotifSrc/CTSecurityDialogsAO.cpp Tue Jun 29 10:29:16 2010 +0300 @@ -567,6 +567,7 @@ if ( iRetry ) // Is this new try? { // Previous attempt was failed + // incorrect pin code DoHandleMessageL( EErrorPinCodeIncorrect, KNullDesC, KNullDesC, 0, 0 ); } // Ask the PIN code or PUK code @@ -574,11 +575,13 @@ { HBufC* header = StringLoader::LoadLC( R_QTN_CM_HEADING_PHONE_KEYSTORE, CEikonEnv::Static() ); - iPIN.iMinLength = KMaxKeystorePwLength; - DoHandleMessageL( EEnterKeyStorePw, KNullDesC, *header, - iPIN.iMinLength, iPIN.iMaxLength ); - iMultiLineDlgType = EEnterNewKeyStorePw; - CleanupStack::PopAndDestroy( header ); + iPIN.iMinLength = KMaxKeystorePwLength; + DoHandleMessageL( EEnterKeyStorePw, KNullDesC, *header, + iPIN.iMinLength, iPIN.iMaxLength ); + iMultiLineDlgType = EEnterNewKeyStorePw; + CleanupStack::PopAndDestroy( header ); + RunL(); + } else if ( iPIN.iPINLabel == KKeyStoreImportKeyLabel ) { @@ -595,13 +598,7 @@ else if ( iPIN.iPINLabel == KKeyStoreCreatePwLabel ) { iPIN.iMinLength = KMaxKeystorePwLength; - // DoHandleMessageL( EInfoPwCreating, KNullDesC, KNullDesC, 0, 0 ); -//TODO: add timeout -/* - HBufC* buffer = CEikonEnv::Static()->AllocReadResourceLC( R_QTN_CM_CREATING_KEYSTORE ); // EInfoPwCreating - CHbDeviceMessageBoxSymbian::InformationL(buffer->Des()); - CleanupStack::PopAndDestroy( buffer ); -*/ + ShowInformationNoteL(R_QTN_CM_CREATING_KEYSTORE); DoHandleMultilinePinQueryL( EEnterNewKeyStorePw ); iNextStep = EVerifyPINs; } @@ -635,7 +632,6 @@ TDialogType dlgType = ( TDialogType )aDlgType; if ( EEnterNewKeyStorePw == dlgType ) { - /* dlgText1 = iNotifier->LoadResourceStringLC( dlgType, KNullDesC ); dlgText2 = iNotifier->LoadResourceStringLC( EVerifyKeyStorePw, KNullDesC ); @@ -644,8 +640,6 @@ dlg->RunDlgLD( iStatus, R_WIM_PWPW_QUERY_DIALOG ); CleanupStack::PopAndDestroy( 2, dlgText1 ); // dlgText1, dlgText2 */ - -/* dlgText1 = StringLoader::LoadLC( R_QTN_SN_NEW_PHONE_KEYSTORE ); dlgText2 = StringLoader::LoadLC( R_QTN_WIM_VERIFY_PIN ); HBufC* message = HBufC::NewLC( KMaxLengthTextCertLabelVisible ); @@ -660,20 +654,14 @@ ESecUiSecretSupported | ESecUiEmergencyNotSupported); iRetValue=(queryAccepted==KErrNone); -*/ - - iPINValueVerify.Copy(_L("123456")); - iRetValue=true; if(iRetValue) - iPINValue2.Copy(iPINValueVerify); // dialog already does not allow different pins -/* - delete SecQueryUi; - SecQueryUi=NULL; - CleanupStack::PopAndDestroy( message ); + iPINValue2.Copy(iPINValueVerify); // dialog already does not OK with different pin codes + delete SecQueryUi; + SecQueryUi=NULL; + CleanupStack::PopAndDestroy( message ); CleanupStack::PopAndDestroy( dlgText2 ); - CleanupStack::PopAndDestroy( dlgText1 ); - */ - RunL(); // had to call it this way + CleanupStack::PopAndDestroy( dlgText1 ); + RunL(); // had to call it this way } else if ( EExportKeyPw == dlgType ) { @@ -802,16 +790,35 @@ } } iPinQueryDialogDeleted = EFalse; - CCTPinQueryDialog::RunDlgLD( iStatus, - *dlgText, - *pinValue, - aMinLength, - aMaxLength, - iRetValue, - resource, - iPinQueryDialog, - iPinQueryDialogDeleted ); + if(aDlgType!=EEnterKeyStorePw) { + CCTPinQueryDialog::RunDlgLD( iStatus, + *dlgText, + *pinValue, + aMinLength, + aMaxLength, + iRetValue, + resource, + iPinQueryDialog, + iPinQueryDialogDeleted ); + break; + } + else + { + iPIN.iMinLength = KMaxKeystorePwLength; + CSecQueryUi* SecQueryUi = CSecQueryUi::NewL(); + HBufC* header =StringLoader::LoadLC( R_QTN_SN_ENTER_PHONE_KEYSTORE); + TInt queryAccepted = SecQueryUi->SecQueryDialog(header->Des(), *pinValue, + aMinLength,aMaxLength, + ESecUiAlphaSupported | + ESecUiCancelSupported | + ESecUiSecretSupported | + ESecUiEmergencyNotSupported); + delete SecQueryUi; + SecQueryUi=NULL; + iRetValue=(queryAccepted==KErrNone); + CleanupStack::PopAndDestroy( header ); break; + } } default: { @@ -819,12 +826,12 @@ } } - - if ( dlg ) - { - dlg->ExecuteLD( *dlgText ); - dlg = NULL; - } + if ( dlg && aDlgType!=EEnterKeyStorePw) + { + + dlg->ExecuteLD( *dlgText ); + dlg = NULL; + } CleanupStack::PopAndDestroy( dlgText ); // dlgText } @@ -2529,3 +2536,14 @@ } } +void CCTSecurityDialogsAO::ShowInformationNoteL( TInt aResourceID ) const + { + HBufC* buffer = CEikonEnv::Static()->AllocReadResourceLC( aResourceID ); + CHbDeviceMessageBoxSymbian* iMessageBox = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EInformation); + CleanupStack::PushL(iMessageBox); + iMessageBox->SetTextL(buffer->Des()); + iMessageBox->SetTimeout(6000); + iMessageBox->ExecL(); + CleanupStack::PopAndDestroy(iMessageBox); + CleanupStack::PopAndDestroy( buffer ); + } diff -r b3e22c78f79e -r 3aa774c655ac pkiutilities/CertSaver/inc/CertSaverModel.h --- a/pkiutilities/CertSaver/inc/CertSaverModel.h Mon Jun 28 13:01:48 2010 +0300 +++ b/pkiutilities/CertSaver/inc/CertSaverModel.h Tue Jun 29 10:29:16 2010 +0300 @@ -77,12 +77,6 @@ void SavePKCS12L(); - /** - * Shows a error note with given text. - * @param aResourceID Id of the resource text to be shown. - */ - void ShowErrorNoteL( TInt aResourceID ) const; - private: // New functions /** @@ -198,11 +192,6 @@ */ void AddNewlinesToMessage( TDes& aMessage ) const; - /** - * Shows a confirmation note with given text. - * @param aResourceID Id of the resource text to be shown. - */ - void ShowConfirmationNoteL( TInt aResourceID ) const; /** * Shows a information note with given text. diff -r b3e22c78f79e -r 3aa774c655ac pkiutilities/CertSaver/src/CertSaverModel.cpp --- a/pkiutilities/CertSaver/src/CertSaverModel.cpp Mon Jun 28 13:01:48 2010 +0300 +++ b/pkiutilities/CertSaver/src/CertSaverModel.cpp Tue Jun 29 10:29:16 2010 +0300 @@ -210,7 +210,7 @@ case KErrKeySize: case KErrArgument: { - ShowErrorNoteL( R_CERTSAVER_KEY_TYPE_NOT_SUPPORTED ); + ShowInformationNoteL( R_CERTSAVER_KEY_TYPE_NOT_SUPPORTED ); User::Leave( KErrCancel ); break; } @@ -221,21 +221,21 @@ } case KErrKeyUsage: { - ShowErrorNoteL( R_CERTSAVER_PRIVATE_KEY_CORRUPTED ); + ShowInformationNoteL( R_CERTSAVER_PRIVATE_KEY_CORRUPTED ); User::Leave( KErrCancel ); break; } case KErrCancel: case KErrPermissionDenied: { - ShowErrorNoteL( R_CERTSAVER_PKCS12_DISCARDED ); + ShowInformationNoteL( R_CERTSAVER_PKCS12_DISCARDED ); User::Leave( KErrCancel ); break; } case KErrCorrupt: case KErrEof: { - ShowErrorNoteL( R_CERTSAVER_KEYSTORE_CORRUPTED ); + ShowInformationNoteL( R_CERTSAVER_KEYSTORE_CORRUPTED ); User::Leave( KErrCancel ); break; } @@ -287,7 +287,7 @@ case KErrCorrupt: case KErrEof: { - ShowErrorNoteL( R_CERTSAVER_KEYSTORE_CORRUPTED ); + ShowInformationNoteL( R_CERTSAVER_KEYSTORE_CORRUPTED ); User::Leave( KErrCancel ); } default: @@ -507,9 +507,7 @@ if (SysUtil::FFSSpaceBelowCriticalLevelL( &iFs, aDataToSave.Size() )) { - HBufC* p = StringLoader::LoadLC( R_CERTSAVER_MEMORY ); - CHbDeviceMessageBoxSymbian::WarningL(p->Des()); - CleanupStack::PopAndDestroy( p ); + ShowInformationNoteL(R_CERTSAVER_MEMORY); User::Leave( KErrExitApp ); } } @@ -533,7 +531,7 @@ CHbDeviceMessageBoxSymbian::QuestionL(msgPtr, KNullDesC, KNullDesC); TBool doSave= (selection == CHbDeviceMessageBoxSymbian::EAcceptButton); CleanupStack::PopAndDestroy(message); - +/* if ( doSave && iCertOwnerType == ECACertificate ) { // warn user about security risk @@ -543,7 +541,7 @@ CleanupStack::PopAndDestroy(stringHolder); doSave=(selection == CHbDeviceMessageBoxSymbian::EAcceptButton); } - +*/ if ( doSave ) { //Check that there still is enough space to store the certificate. @@ -552,7 +550,7 @@ } else { - ShowConfirmationNoteL( R_CERTSAVER_CERT_DISCARDED ); + ShowInformationNoteL(R_CERTSAVER_CERT_DISCARDED); User::Leave( KErrCancel ); } } @@ -571,7 +569,7 @@ TRAPD( status, iUnifiedCertStore = CUnifiedCertStore::NewL( iFs, ETrue ) ); if ( status != KErrNone ) { - ShowErrorNoteL( R_CERTSAVER_ERROR_CACERTS_DB_CORRUPTED ); + ShowInformationNoteL( R_CERTSAVER_ERROR_CACERTS_DB_CORRUPTED ); User::Leave( KErrExitApp ); } // initialize unified cert store @@ -707,7 +705,7 @@ if ( certstoreIndex < 0 ) { // Couldn't find certificate storage - ShowErrorNoteL( R_CERTSAVER_ERROR_CACERTS_DB_CORRUPTED ); + ShowInformationNoteL( R_CERTSAVER_ERROR_CACERTS_DB_CORRUPTED ); User::Leave( KErrExitApp ); } @@ -746,7 +744,7 @@ { // If there is none WritableCertStore, // then at least cacerts.dat is corrupted. - ShowErrorNoteL( R_CERTSAVER_ERROR_CACERTS_DB_CORRUPTED ); + ShowInformationNoteL( R_CERTSAVER_ERROR_CACERTS_DB_CORRUPTED ); User::Leave( KErrExitApp ); } @@ -825,7 +823,7 @@ if ( queryAccepted!=KErrNone ) { // cancel - ShowConfirmationNoteL( R_CERTSAVER_CERT_DISCARDED ); + ShowInformationNoteL(R_CERTSAVER_CERT_DISCARDED); return KErrCancel; } // Create filter to confirm that label doesn't already exist. @@ -873,27 +871,27 @@ { case KErrNone: { - ShowConfirmationNoteL( R_CERTSAVER_ERROR_SAVEOK ); + ShowInformationNoteL(R_CERTSAVER_ERROR_SAVEOK); break; } case KErrNotSupported: { - ShowErrorNoteL( R_CERTSAVER_ERROR_UNSUPPORTED_CERT ); + ShowInformationNoteL(R_CERTSAVER_ERROR_UNSUPPORTED_CERT); break; } case KErrBadName: { - ShowErrorNoteL( R_CERTSAVER_ERROR_LABEL_ALREADY_EXISTS ); + ShowInformationNoteL(R_CERTSAVER_ERROR_LABEL_ALREADY_EXISTS); break; } case KErrAlreadyExists: { - ShowErrorNoteL( R_CERTSAVER_ERROR_ALREADY_EXISTS ); + ShowInformationNoteL(R_CERTSAVER_ERROR_ALREADY_EXISTS); break; } case KErrArgument: { - ShowErrorNoteL( R_CERTSAVER_ERROR_CACERTS_DB_CORRUPTED ); + ShowInformationNoteL(R_CERTSAVER_ERROR_CACERTS_DB_CORRUPTED); break; } default: @@ -1191,17 +1189,17 @@ if ( !CertificateSupported() ) { - ShowErrorNoteL( R_CERTSAVER_ERROR_UNSUPPORTED_CERT ); + ShowInformationNoteL(R_CERTSAVER_ERROR_UNSUPPORTED_CERT); return EFalse; } if ( CertNotValidAnymore() ) { - ShowErrorNoteL(R_CERTSAVER_ERROR_CERT_NOT_VALID); + ShowInformationNoteL(R_CERTSAVER_ERROR_CERT_NOT_VALID); return ETrue; } else if ( CertNotValidYet() ) { - ShowErrorNoteL( R_CERTSAVER_ERROR_CERT_NOT_VALID_YET ); + ShowInformationNoteL(R_CERTSAVER_ERROR_CERT_NOT_VALID_YET); } return ETrue; } @@ -1249,34 +1247,13 @@ { HBufC* buffer = iAppUi->CoeEnv()->AllocReadResourceLC( aResourceID ); - CHbDeviceMessageBoxSymbian::InformationL(buffer->Des()); - CleanupStack::PopAndDestroy( buffer ); - } -// ---------------------------------------------------------- -// CCertSaverModel::ShowConfirmationNoteL() const -// Creates and shows a confirmation note. -// ---------------------------------------------------------- -// -void CCertSaverModel::ShowConfirmationNoteL( TInt aResourceID ) const - { - - HBufC* buffer = iAppUi->CoeEnv()->AllocReadResourceLC( aResourceID ); - CHbDeviceMessageBoxSymbian::WarningL(buffer->Des()); - CleanupStack::PopAndDestroy( buffer ); - } - -// ---------------------------------------------------------- -// CCertSaverModel::ShowErrorNoteL() const -// Creates and shows an error note. -// ---------------------------------------------------------- -// -void CCertSaverModel::ShowErrorNoteL( TInt aResourceID ) const - { - - HBufC* buffer = iAppUi->CoeEnv()->AllocReadResourceLC( aResourceID ); - //TODO: can be changed when hb supports ErrorL - CHbDeviceMessageBoxSymbian::WarningL(buffer->Des()); - CleanupStack::PopAndDestroy( buffer ); + CHbDeviceMessageBoxSymbian* iMessageBox = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EInformation); + CleanupStack::PushL(iMessageBox); + iMessageBox->SetTextL(buffer->Des()); + iMessageBox->SetTimeout(6000); + iMessageBox->ExecL(); + CleanupStack::PopAndDestroy(iMessageBox); + CleanupStack::PopAndDestroy( buffer ); } // ---------------------------------------------------------- @@ -1407,7 +1384,7 @@ } else { - ShowConfirmationNoteL( R_CERTSAVER_CERT_DISCARDED ); + ShowInformationNoteL(R_CERTSAVER_CERT_DISCARDED); ret = KErrCancel; } @@ -1448,7 +1425,7 @@ } else { - ShowConfirmationNoteL( R_CERTSAVER_CERT_DISCARDED ); + ShowInformationNoteL(R_CERTSAVER_CERT_DISCARDED); ret = KErrCancel; } CleanupStack::PopAndDestroy( prompt ); @@ -1579,8 +1556,10 @@ } TInt status = KErrNone; // save private keys - TRAP( status, SavePrivateKeyL() ); - + if(CheckeBoxData.Compare(_L("1"))==0) + { + TRAP( status, SavePrivateKeyL() ); + } // save user certificates if private key was saved. if ( ( iSavedKeysCount > 0 || iKeyAlreadyExists ) && iParser.UserCertificates().Count() > 0 ) { @@ -1613,24 +1592,28 @@ } } } +/* if ( iSavedCACertsCount != 0 || iSavedKeysCount != 0 || iSavedUserCertsCount != 0 ) { - HBufC* p = StringLoader::LoadLC( R_CERTSAVER_HEADER_SAVED ); - message = HBufC::NewLC( KMaxLengthTextMeassageBody ); - message->Des().Append(p->Des()); - TPtr msgPtr2 = message->Des(); - ConstructPKCS12QueryMsgL( +// show how many have been saved + HBufC* p = StringLoader::LoadLC( R_CERTSAVER_HEADER_SAVED ); + message = HBufC::NewLC( KMaxLengthTextMeassageBody ); + message->Des().Append(p->Des()); + TPtr msgPtr2 = message->Des(); + ConstructPKCS12QueryMsgL( msgPtr2, iSavedKeysCount, iSavedUserCertsCount, iSavedCACertsCount ); - CHbDeviceMessageBoxSymbian::InformationL(message->Des()); - CleanupStack::PopAndDestroy( message ); - CleanupStack::PopAndDestroy( p ); + CHbDeviceMessageBoxSymbian::InformationL(message->Des()); + CleanupStack::PopAndDestroy( message ); + CleanupStack::PopAndDestroy( p ); } else { + // the contents could not be saved is dropped ShowInformationNoteL( R_QTN_CM_PKCS12_SAVING_FAILED ); CleanupStack::PopAndDestroy( message ); } +*/ } // ---------------------------------------------------------- diff -r b3e22c78f79e -r 3aa774c655ac pkiutilities/CertSaver/src/certparser.cpp --- a/pkiutilities/CertSaver/src/certparser.cpp Mon Jun 28 13:01:48 2010 +0300 +++ b/pkiutilities/CertSaver/src/certparser.cpp Tue Jun 29 10:29:16 2010 +0300 @@ -167,20 +167,12 @@ TBool done = EFalse; TBuf password; - HBufC* buffer = NULL; - - if ( !iEikEnv ) - { - iEikEnv = CEikonEnv::Static(); - } while ( !done ) { if ( !GetPasswordL( password, aFileName ) ) { - buffer = iEikEnv->AllocReadResourceLC( R_CERTSAVER_PKCS12_DISCARDED ); - CHbDeviceMessageBoxSymbian::InformationL(buffer->Des()); - CleanupStack::PopAndDestroy( buffer ); + ShowErrorNoteL(R_CERTSAVER_PKCS12_DISCARDED); User::Leave( KErrExitApp ); } TRAPD( err, iPKCS12->ParseL( aPKCS12, password ) ); @@ -385,8 +377,13 @@ iEikEnv = CEikonEnv::Static(); } HBufC* buffer = iEikEnv->AllocReadResourceLC( aResourceID ); - CHbDeviceMessageBoxSymbian::WarningL(buffer->Des()); - CleanupStack::PopAndDestroy( buffer ); + CHbDeviceMessageBoxSymbian* iMessageBox = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EWarning); + CleanupStack::PushL(iMessageBox); + iMessageBox->SetTextL(buffer->Des()); + iMessageBox->SetTimeout(6000); + iMessageBox->ExecL(); + CleanupStack::PopAndDestroy(iMessageBox); + CleanupStack::PopAndDestroy( buffer ); } // End of File