# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1284494161 -10800 # Node ID 94da73d93b5843f266ec80720bdeb609d610e864 # Parent 03674e5abf4683b6af4113f92d2fe14d0c216b02 Revision: 201033 Kit: 201035 diff -r 03674e5abf46 -r 94da73d93b58 pkiutilities/CertSaver/data/CertSaver.rss --- a/pkiutilities/CertSaver/data/CertSaver.rss Wed Sep 01 12:19:59 2010 +0100 +++ b/pkiutilities/CertSaver/data/CertSaver.rss Tue Sep 14 22:56:01 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2007 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -474,4 +474,45 @@ RESOURCE TBUF r_certsaver_one_authority_certificate { buf = qtn_cm_one_authority_certificate; } RESOURCE TBUF r_certsaver_trustedsite_warning { buf = qtn_cm_save_trustedsite_certificate_warning_text; } -// End of File + +//---------------------------------------------------- +// +// r_certsaver_protect_with_password +// +//---------------------------------------------------- +// +RESOURCE DIALOG r_certsaver_protect_with_password + { + flags = EGeneralQueryFlags; + buttons = r_certsaver_softkeys_no_yes_no; + items= + { + DLG_LINE + { + type=EAknCtQuery; + id=EGeneralQuery; + control= AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + label = qtn_certsaver_protect_with_password_query; + }; + } + }; + } + +//---------------------------------------------------- +// +// r_certsaver_softkeys_no_yes_no +// +//---------------------------------------------------- +// +RESOURCE CBA r_certsaver_softkeys_no_yes_no + { + buttons = + { + CBA_BUTTON { id=EAknSoftkeyNo; txt=text_softkey_no; }, + CBA_BUTTON { id=EAknSoftkeyYes; txt=text_softkey_yes; }, + CBA_BUTTON { id=EAknSoftkeyNo; txt=text_softkey_no; } + }; + } + diff -r 03674e5abf46 -r 94da73d93b58 pkiutilities/CertSaver/inc/CertSaverModel.h --- a/pkiutilities/CertSaver/inc/CertSaverModel.h Wed Sep 01 12:19:59 2010 +0100 +++ b/pkiutilities/CertSaver/inc/CertSaverModel.h Tue Sep 14 22:56:01 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2007 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -107,6 +107,12 @@ void GetKeyValidityPeriodL( TTime& aStartDate, TTime& aEndDate, + const TKeyIdentifier& aKeyIdentifier, + const CArrayPtr& aCertArray ); + + void GetKeyValidityPeriodL( + TTime& aStartDate, + TTime& aEndDate, const TKeyIdentifier& aKeyIdentifier ); TKeyUsagePKCS15 KeyUsageL( @@ -334,8 +340,11 @@ TInt iSavedCACertsCount; TInt iSavedKeysCount; TInt iSavedUserCertsCount; - TInt iSelectedKeyStore; TBool iKeyAlreadyExists; + + TUid iSelectedKeyStoreToken; + TUid iSelectedCertStoreToken; + TInt iSelectedKeyStoreIndex; }; #endif diff -r 03674e5abf46 -r 94da73d93b58 pkiutilities/CertSaver/loc/certsaver.loc --- a/pkiutilities/CertSaver/loc/certsaver.loc Wed Sep 01 12:19:59 2010 +0100 +++ b/pkiutilities/CertSaver/loc/certsaver.loc Tue Sep 14 22:56:01 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2007 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -243,4 +243,19 @@ // #define qtn_cm_save_trustedsite_certificate_warning_text "Certificate will be added as a Trusted site certificate. Future connections to site %U will be made without certificate warning. Save anyway?" -// End of File +//d:Confirmation query for selecting the certificate store +//d:where new certificate will be saved. Alternatives are +//d:device certificate store and personal certificate store. +//d:Difference is that personal certificate store is password +//d:protected, and password is prompted when certificates are +//d:used. The default is to save in device certificate store +//d:that can be used without passwords (no protection). Left +//d:softkey is text_softkey_no, and right is text_softkey_yes. +//d:User can move the certs between device and personal +//d:certificate stores later by using Certificate Manager +//d:(in Control Panel). +//l:popup_note_window +//r:9.2 +// +#define qtn_certsaver_protect_with_password_query "Protect with password?" + diff -r 03674e5abf46 -r 94da73d93b58 pkiutilities/CertSaver/src/CertSaverModel.cpp --- a/pkiutilities/CertSaver/src/CertSaverModel.cpp Wed Sep 01 12:19:59 2010 +0100 +++ b/pkiutilities/CertSaver/src/CertSaverModel.cpp Tue Sep 14 22:56:01 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2007 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -75,7 +75,12 @@ _LIT( KEnter, "\n" ); const TUid KTrustedServerTokenUid = { 0x101FB66F }; -const TUid KFileTokensUid = { 0x101F501A }; +const TUid KFileCertStoreTokenUid = { 0x101F501A }; +const TUid KDeviceCertStoreTokenUid = { 0x101FB668 }; +const TUid KFileKeyStoreTokenUid = { KTokenTypeFileKeystore }; // 0x101F7333 +const TUid KDeviceKeyStoreTokenUid = { 0x101FB66A }; + +const TInt64 KZeroTime = 0; _LIT_SECURITY_POLICY_V1( KSymbianKeyStoreMgmtPolicy, VID_DEFAULT, ECapabilityWriteUserData ); @@ -94,16 +99,16 @@ } // ---------------------------------------------------------- -// CCertSaverModel::CCertSaverModel( -// const CCertSaverDocument* aDocument, CCertSaverAppUi* aAppUi) +// CCertSaverModel::CCertSaverModel() // ---------------------------------------------------------- // -CCertSaverModel::CCertSaverModel( - CCertSaverAppUi* aAppUi, - const CCertParser& aParser ): +CCertSaverModel::CCertSaverModel( CCertSaverAppUi* aAppUi, const CCertParser& aParser ) : iAppUi( aAppUi ), iFs( iAppUi->CoeEnv()->FsSession() ), iParser( aParser ), iSavedCACertsCount( 0 ), iSavedKeysCount( 0 ), - iSavedUserCertsCount( 0 ), iKeyAlreadyExists( EFalse ) + iSavedUserCertsCount( 0 ), iKeyAlreadyExists( EFalse ), + iSelectedKeyStoreToken( KFileKeyStoreTokenUid ), + iSelectedCertStoreToken( KFileCertStoreTokenUid ), + iSelectedKeyStoreIndex( KErrNotFound ) { } @@ -119,6 +124,8 @@ iCertOwnerType = aOwnerType; iCertFormat = aCertFormat; iNewCert = &aCertificate; + iSelectedKeyStoreToken = KFileKeyStoreTokenUid; + iSelectedCertStoreToken = KFileCertStoreTokenUid; if ( aOwnerType == EPeerCertificate ) { @@ -147,8 +154,8 @@ MPKCS8DecodedKeyPairData* keyPairData = pkcs8Data->KeyPairData(); keyPairData->GetKeyIdentifierL( keyIdentifier ); - TTime startDate; - TTime endDate; + TTime startDate( KZeroTime ); + TTime endDate( KZeroTime ); GetKeyValidityPeriodL( startDate, endDate, keyIdentifier ); TInt err = KErrNone; @@ -156,9 +163,9 @@ TBuf keyLabel( KPrivateKeyLabel ); TKeyUsagePKCS15 keyUsage = KeyUsageL( keyIdentifier, pkcs8Data->Algorithm() ); CleanupStack::PopAndDestroy( pkcs8Data ); - if (KeyAlreadyExistsL( startDate, endDate, keyIdentifier, keyUsage) ) + if ( KeyAlreadyExistsL( startDate, endDate, keyIdentifier, keyUsage) ) { - User::Leave( KErrNone ); + return; } TInt accessType( 0 ); @@ -168,8 +175,7 @@ for ( TInt i = 0; i < KAttempts; i++ ) { CreateKeyLabelL( keyLabel ); - // Should not use hardcoded index - err = iWrapper->AddKey( 0, aKey, keyUsage, keyLabel, + err = iWrapper->AddKey( iSelectedKeyStoreIndex, aKey, keyUsage, keyLabel, accessType, startDate, endDate, keyInfo ); if ( err != KErrAlreadyExists ) { @@ -298,24 +304,21 @@ // // ---------------------------------------------------------- // -void CCertSaverModel::GetKeyValidityPeriodL( - TTime& aStartDate, - TTime& aEndDate, - const TKeyIdentifier& aKeyIdentifier ) +void CCertSaverModel::GetKeyValidityPeriodL( TTime& aStartDate, TTime& aEndDate, + const TKeyIdentifier& aKeyIdentifier, const CArrayPtr& aCertArray ) { + const TTime timeNotSet( KZeroTime ); - for ( TInt i = 0; i < iParser.UserCertificates().Count(); i++ ) + for( TInt index = 0; index < aCertArray.Count(); index++ ) { - const CX509Certificate* cert = iParser.UserCertificates().At( i ); - if ( cert->KeyIdentifierL() == aKeyIdentifier ) + const CX509Certificate* cert = aCertArray.At( index ); + if( cert->KeyIdentifierL() == aKeyIdentifier ) { - // Associated certificate found - // In the first round aStartDate and aEndDate is initialised. - if ( i == 0 || aStartDate > cert->ValidityPeriod().Start() ) + if ( aStartDate == timeNotSet || aStartDate > cert->ValidityPeriod().Start() ) { aStartDate = cert->ValidityPeriod().Start(); } - if ( i == 0 || aEndDate < cert->ValidityPeriod().Finish() ) + if ( aEndDate == timeNotSet || aEndDate < cert->ValidityPeriod().Finish() ) { aEndDate = cert->ValidityPeriod().Finish(); } @@ -324,6 +327,18 @@ } // ---------------------------------------------------------- +// CCertSaverModel::GetKeyValidityPeriodL() +// +// ---------------------------------------------------------- +// +void CCertSaverModel::GetKeyValidityPeriodL( TTime& aStartDate, TTime& aEndDate, + const TKeyIdentifier& aKeyIdentifier ) + { + GetKeyValidityPeriodL( aStartDate, aEndDate, aKeyIdentifier, iParser.UserCertificates() ); + GetKeyValidityPeriodL( aStartDate, aEndDate, aKeyIdentifier, iParser.CACertificates() ); + } + +// ---------------------------------------------------------- // CCertSaverModel::CreateKeyLabelL() // // ---------------------------------------------------------- @@ -370,11 +385,11 @@ { TUid uid = iWrapper->UnifiedKeyStore().KeyStoreManager(i).Token().TokenType().Type(); - if ( uid == TUid::Uid( KTokenTypeFileKeystore ) ) + if ( uid == iSelectedKeyStoreToken ) // if this is not found, we use the first one, // which is already initialised { - iSelectedKeyStore = i; + iSelectedKeyStoreIndex = i; } } } @@ -514,7 +529,6 @@ CleanupStack::PopAndDestroy( message ); CleanupStack::PushL( dlg ); - dlg->PrepareLC( R_MESSAGE_QUERY_DOSAVE ); HBufC* header = StringLoader::LoadLC( R_CERTSAVER_DETAILS_HEADING ); @@ -620,7 +634,7 @@ // If the certificate is already in CACerts.dat, // then don't save it if ( iNewCert->Fingerprint() == certificate->Fingerprint() && - (( *iEntries[i]).Handle().iTokenHandle.iTokenTypeUid == KFileTokensUid ) ) + (( *iEntries[i]).Handle().iTokenHandle.iTokenTypeUid == iSelectedCertStoreToken ) ) { found = ETrue; } @@ -666,8 +680,26 @@ } } + // Select which store to use + TUid certstoreToken; + switch( iCertOwnerType ) + { + case ECACertificate: + certstoreToken = KFileCertStoreTokenUid; + break; + case EUserCertificate: + certstoreToken = iSelectedCertStoreToken; + break; + case EPeerCertificate: + certstoreToken = KTrustedServerTokenUid; + break; + default: + certstoreToken = KFileCertStoreTokenUid; + break; + } + // Get interface to writable store. - TInt certstoreIndex( -1 ); + TInt certstoreIndex = -1; TInt count = iUnifiedCertStore->WritableCertStoreCount(); if ( count > 0 ) { @@ -678,9 +710,7 @@ MCTToken& token = writableCertStore.Token(); TUid tokenuid = token.Handle().iTokenTypeUid; - if ( ( tokenuid == KTrustedServerTokenUid ) && ( iCertOwnerType == EPeerCertificate ) || - ( tokenuid == KFileTokensUid ) && ( iCertOwnerType == ECACertificate ) || - ( tokenuid == KFileTokensUid ) && ( iCertOwnerType == EUserCertificate ) ) + if ( tokenuid == certstoreToken ) { certstoreIndex = i; break; @@ -758,7 +788,8 @@ // takes ownership of trusterUids status = iWrapper->SetApplicability( - iUnifiedCertStore->WritableCertStore( certstoreIndex ), *(iEntries[0]), iTrusterUids ); + iUnifiedCertStore->WritableCertStore( certstoreIndex ), + *( iEntries[ 0 ] ), iTrusterUids ); // If error happened, show error note and give up. Otherwise, continue if ( status ) @@ -769,7 +800,8 @@ // Downloaded certificate is trusted by default status = iWrapper->SetTrust( - iUnifiedCertStore->WritableCertStore(certstoreIndex), *(iEntries[0]), ETrue ); + iUnifiedCertStore->WritableCertStore( certstoreIndex ), + *( iEntries [ 0 ] ), ETrue ); if ( status ) { HandleSaveErrorL( status ); @@ -1108,7 +1140,7 @@ // format the date to user readable format. The format is locale dependent finishValue.FormatL( finishString, *dateFormatString ); AknTextUtils::DisplayTextLanguageSpecificNumberConversion( finishString ); - CleanupStack::PopAndDestroy(); // dateFormatString + CleanupStack::PopAndDestroy( dateFormatString ); aMessage.Append( finishString ); AddNewlinesToMessage( aMessage ); } @@ -1494,12 +1526,12 @@ { HBufC* message = HBufC::NewLC( KMaxLengthTextMeassageBody ); TPtr msgPtr = message->Des(); - ConstructPKCS12QueryMsgL(msgPtr, iParser.Keys().Count(), - iParser.UserCertificates().Count(), - iParser.CACertificates().Count() ); - TBool save = DoMessageQueryL( - R_MESSAGE_QUERY_DOSAVE, R_CERTSAVER_HEADER_PKCS12_FILE_CONTAINS, - *message ); + TInt keysCount = iParser.Keys().Count(); + TInt userCertificateCount = iParser.UserCertificates().Count(); + TInt caCertificateCount = iParser.CACertificates().Count(); + ConstructPKCS12QueryMsgL( msgPtr, keysCount, userCertificateCount, caCertificateCount ); + TBool save = DoMessageQueryL( R_MESSAGE_QUERY_DOSAVE, + R_CERTSAVER_HEADER_PKCS12_FILE_CONTAINS, *message ); CleanupStack::PopAndDestroy( message ); message = NULL; if ( !save ) @@ -1507,14 +1539,31 @@ ShowInformationNoteL( R_CERTSAVER_PKCS12_DISCARDED ); User::Leave( KErrExitApp ); } + + if ( keysCount ) + { + CAknQueryDialog* protectWithPasswordQuery = CAknQueryDialog::NewL(); + TInt buttonId = protectWithPasswordQuery->ExecuteLD( R_CERTSAVER_PROTECT_WITH_PASSWORD ); + if ( buttonId == EAknSoftkeyYes ) + { + iSelectedKeyStoreToken = KFileKeyStoreTokenUid; + iSelectedCertStoreToken = KFileCertStoreTokenUid; + } + else + { + iSelectedKeyStoreToken = KDeviceKeyStoreTokenUid; + iSelectedCertStoreToken = KDeviceCertStoreTokenUid; + } + } + TInt status = KErrNone; // save private keys TRAP( status, SavePrivateKeyL() ); // save user certificates if private key was saved. - if ( ( iSavedKeysCount > 0 || iKeyAlreadyExists ) && iParser.UserCertificates().Count() > 0 ) + if ( ( iSavedKeysCount > 0 || iKeyAlreadyExists ) && userCertificateCount > 0 ) { - for ( TInt i = 0; i < iParser.UserCertificates().Count(); i++ ) + for ( TInt i = 0; i < userCertificateCount; i++ ) { const CX509Certificate* cert = iParser.UserCertificates().At(i); iCertOwnerType = EUserCertificate; @@ -1527,10 +1576,11 @@ } } } + // save CA certificates - if ( iParser.CACertificates().Count() > 0 ) + if ( caCertificateCount > 0 ) { - for ( TInt i = 0; i < iParser.CACertificates().Count(); i++ ) + for ( TInt i = 0; i < caCertificateCount; i++ ) { const CX509Certificate* cert = iParser.CACertificates().At( i ); iCertOwnerType = ECACertificate; @@ -1543,6 +1593,7 @@ } } } + if ( iSavedCACertsCount != 0 || iSavedKeysCount != 0 || iSavedUserCertsCount != 0 ) { @@ -1550,8 +1601,7 @@ TPtr msgPtr2 = message->Des(); ConstructPKCS12QueryMsgL( msgPtr2, iSavedKeysCount, iSavedUserCertsCount, iSavedCACertsCount ); - DoMessageQueryL( - R_MESSAGE_QUERY_SAVED, R_CERTSAVER_HEADER_SAVED, *message ); + DoMessageQueryL( R_MESSAGE_QUERY_SAVED, R_CERTSAVER_HEADER_SAVED, *message ); CleanupStack::PopAndDestroy( message ); } else diff -r 03674e5abf46 -r 94da73d93b58 securitydialogs/Autolock/src/AutolockAppUi.cpp --- a/securitydialogs/Autolock/src/AutolockAppUi.cpp Wed Sep 01 12:19:59 2010 +0100 +++ b/securitydialogs/Autolock/src/AutolockAppUi.cpp Tue Sep 14 22:56:01 2010 +0300 @@ -1374,6 +1374,7 @@ void CAutolockAppUi::HandleWsEventL( const TWsEvent& aEvent,CCoeControl* aDestination ) { const TInt type = aEvent.Type(); + TInt skipEvent = 0; #if defined(_DEBUG) RDebug::Printf( "%s %s (%u) type=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, type ); #endif @@ -1441,6 +1442,7 @@ } if ( callState != EPSCTsyCallStateNone && callState != EPSCTsyCallStateUninitialized ) { + skipEvent=1; if(pointer->iType==TPointerEvent::EButton1Down) { TPoint iPosition = pointer->iPosition; @@ -1509,9 +1511,10 @@ RMobileCall mCall; User::LeaveIfError(mCall.OpenExistingCall(mLine, cinfo.iCallName)); #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) calling mCall.HangUp 0=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDebug::Printf( "%s %s (%u) not calling mCall.HangUp 0=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); #endif - mCall.HangUp(); // this gives an error, but succeeds + // end call only by EStdKeyNo and not by HangUp + // mCall.HangUp(); // this gives an error, but succeeds } CleanupStack::PopAndDestroy(&mLine); CleanupStack::PopAndDestroy(&mPhone); @@ -1577,7 +1580,13 @@ } // All events are sent to base class. - CAknViewAppUi::HandleWsEventL( aEvent, aDestination ); + #if defined(_DEBUG) + RDebug::Printf( "%s %s (%u) skipEvent=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, skipEvent ); + #endif + if(!skipEvent) + { + CAknViewAppUi::HandleWsEventL( aEvent, aDestination ); + } // part of emergency call handling when telephony+devicelock is active // this solution is meant only for 3.1 and 3.2 diff -r 03674e5abf46 -r 94da73d93b58 securitydialogs/lockclient/rom/lockclient.iby --- a/securitydialogs/lockclient/rom/lockclient.iby Wed Sep 01 12:19:59 2010 +0100 +++ b/securitydialogs/lockclient/rom/lockclient.iby Tue Sep 14 22:56:01 2010 +0300 @@ -19,7 +19,6 @@ #include -//file=ABI_DIR\BUILD_DIR\lockclient.dll SHARED_LIB_DIR\lockclient.dll -file=ABI_DIR\UDEB\lockclient.dll SHARED_LIB_DIR\lockclient.dll +file=ABI_DIR\BUILD_DIR\lockclient.dll SHARED_LIB_DIR\lockclient.dll #endif // __LOCKCLIENT_IBY__ diff -r 03674e5abf46 -r 94da73d93b58 wim/WimSoft/winscw/urel/WIMI.LIB Binary file wim/WimSoft/winscw/urel/WIMI.LIB has changed