equal
deleted
inserted
replaced
25 #include <qlabel.h> |
25 #include <qlabel.h> |
26 #include <qerrormessage.h> |
26 #include <qerrormessage.h> |
27 #include <qstring.h> |
27 #include <qstring.h> |
28 |
28 |
29 #include <hbmessagebox.h> |
29 #include <hbmessagebox.h> |
30 |
30 #include <../../inc/cpsecplugins.h> |
31 #include "cpsecmodmodel.h" |
31 #include "cpsecmodmodel.h" |
32 #include "cpsecmodsyncwrapper.h" |
32 #include "cpsecmodsyncwrapper.h" |
33 |
33 |
34 const TInt KWIMStoreUid ( 0x101F79D9 ); |
34 const TInt KWIMStoreUid ( 0x101F79D9 ); |
35 _LIT(KSecModUIPanic, "Security Module UI panic"); |
35 _LIT(KSecModUIPanic, "Security Module UI panic"); |
45 // Two-phased constructor. |
45 // Two-phased constructor. |
46 // ----------------------------------------------------------------------------- |
46 // ----------------------------------------------------------------------------- |
47 // |
47 // |
48 CSecModUIModel* CSecModUIModel::NewL() |
48 CSecModUIModel* CSecModUIModel::NewL() |
49 { |
49 { |
|
50 RDEBUG("0", 0); |
50 CSecModUIModel* self = new( ELeave ) CSecModUIModel(); |
51 CSecModUIModel* self = new( ELeave ) CSecModUIModel(); |
51 CleanupStack::PushL( self ); |
52 CleanupStack::PushL( self ); |
52 self->ConstructL(); |
53 self->ConstructL(); |
53 CleanupStack::Pop(self); |
54 CleanupStack::Pop(self); |
54 return self; |
55 return self; |
91 // CSecModUIModel::ResetAndDestroyAOs(): Cleans up the list of auth objects. |
92 // CSecModUIModel::ResetAndDestroyAOs(): Cleans up the list of auth objects. |
92 // ----------------------------------------------------------------------------- |
93 // ----------------------------------------------------------------------------- |
93 // |
94 // |
94 void CSecModUIModel::ResetAndDestroyAOs() |
95 void CSecModUIModel::ResetAndDestroyAOs() |
95 { |
96 { |
|
97 RDEBUG("0", 0); |
96 if (iAOList) |
98 if (iAOList) |
97 { |
99 { |
98 iAOList->Release(); |
100 iAOList->Release(); |
99 iAOList = NULL; |
101 iAOList = NULL; |
100 } |
102 } |
123 // CSecModUIModel::InitializeKeyStoreL() |
125 // CSecModUIModel::InitializeKeyStoreL() |
124 // ----------------------------------------------------------------------------- |
126 // ----------------------------------------------------------------------------- |
125 // |
127 // |
126 void CSecModUIModel::InitializeKeyStoreL() |
128 void CSecModUIModel::InitializeKeyStoreL() |
127 { |
129 { |
|
130 RDEBUG("0", 0); |
128 ResetAndDestroyCTObjects(); |
131 ResetAndDestroyCTObjects(); |
129 |
132 |
130 // Ensure that file server session is succesfully created |
133 // Ensure that file server session is succesfully created |
131 User::LeaveIfError( iRfs.Connect() ); |
134 User::LeaveIfError( iRfs.Connect() ); |
132 |
135 |
182 // Retrieves the description and location of all tokens. |
185 // Retrieves the description and location of all tokens. |
183 // ----------------------------------------------------------------------------- |
186 // ----------------------------------------------------------------------------- |
184 // |
187 // |
185 QMap<QString,QString> CSecModUIModel::LoadTokenLabelsL() |
188 QMap<QString,QString> CSecModUIModel::LoadTokenLabelsL() |
186 { |
189 { |
187 |
190 RDEBUG("0", 0); |
188 TInt keyStoreCount = iAOKeyStores.Count(); |
191 TInt keyStoreCount = iAOKeyStores.Count(); |
189 QMap<QString, QString> labelList; |
192 QMap<QString, QString> labelList; |
190 |
193 |
191 if (0 == keyStoreCount) |
194 if (0 == keyStoreCount) |
192 { |
195 { |
220 // Identifies the location of the keystore based on the Uid. |
223 // Identifies the location of the keystore based on the Uid. |
221 // ----------------------------------------------------------------------------- |
224 // ----------------------------------------------------------------------------- |
222 // |
225 // |
223 QString CSecModUIModel::Location( TUid aUid ) const |
226 QString CSecModUIModel::Location( TUid aUid ) const |
224 { |
227 { |
|
228 RDEBUG("0", 0); |
225 QString location = 0; |
229 QString location = 0; |
226 |
230 |
227 switch ( aUid.iUid ) |
231 switch ( aUid.iUid ) |
228 { |
232 { |
229 case KTokenTypeFileKeystore: |
233 case KTokenTypeFileKeystore: |
250 // ----------------------------------------------------------------------------- |
254 // ----------------------------------------------------------------------------- |
251 // |
255 // |
252 void CSecModUIModel::ShowErrorNote(TInt aError) const |
256 void CSecModUIModel::ShowErrorNote(TInt aError) const |
253 { |
257 { |
254 QString sError; |
258 QString sError; |
255 |
259 RDEBUG("aError", aError); |
256 switch (aError) |
260 switch (aError) |
257 { |
261 { |
258 case KErrCancel: |
262 case KErrCancel: |
259 case KErrLocked: |
263 case KErrLocked: |
260 case KErrNone: |
264 case KErrNone: |
290 // Retrieves the appropriate token based on the index. |
294 // Retrieves the appropriate token based on the index. |
291 // ----------------------------------------------------------------------------- |
295 // ----------------------------------------------------------------------------- |
292 // |
296 // |
293 void CSecModUIModel::OpenTokenL(TInt aTokenIndex) |
297 void CSecModUIModel::OpenTokenL(TInt aTokenIndex) |
294 { |
298 { |
|
299 RDEBUG("0", 0); |
295 ResetAndDestroyAOs(); |
300 ResetAndDestroyAOs(); |
296 iKeyStore = iAOKeyStores[aTokenIndex]; |
301 iKeyStore = iAOKeyStores[aTokenIndex]; |
297 } |
302 } |
298 |
303 |
299 // ----------------------------------------------------------------------------- |
304 // ----------------------------------------------------------------------------- |
314 // implementation. |
319 // implementation. |
315 // ----------------------------------------------------------------------------- |
320 // ----------------------------------------------------------------------------- |
316 // |
321 // |
317 void CSecModUIModel::InitAuthObjectsL() |
322 void CSecModUIModel::InitAuthObjectsL() |
318 { |
323 { |
|
324 RDEBUG("0", 0); |
319 TInt err = KErrNone; |
325 TInt err = KErrNone; |
320 // Symbian's file key store does not support |
326 // Symbian's file key store does not support |
321 // MCTAuthenticationObjectList interface, so we need to use |
327 // MCTAuthenticationObjectList interface, so we need to use |
322 // other way to get AO. |
328 // other way to get AO. |
323 if (iKeyStore->Token().TokenType().Type().iUid == KTokenTypeFileKeystore) |
329 if (iKeyStore->Token().TokenType().Type().iUid == KTokenTypeFileKeystore) |
367 // list the auth objects. |
373 // list the auth objects. |
368 // ----------------------------------------------------------------------------- |
374 // ----------------------------------------------------------------------------- |
369 // |
375 // |
370 void CSecModUIModel::ListAuthObjectsL() |
376 void CSecModUIModel::ListAuthObjectsL() |
371 { |
377 { |
|
378 RDEBUG("0", 0); |
372 if (0 >= iAOArray.Count()) |
379 if (0 >= iAOArray.Count()) |
373 { |
380 { |
374 __ASSERT_ALWAYS(iAOList, Panic(EPanicNullPointer)); |
381 __ASSERT_ALWAYS(iAOList, Panic(EPanicNullPointer)); |
375 TInt err = iWrapper->ListAuthObjects(*iAOList, iAOArray); |
382 TInt err = iWrapper->ListAuthObjects(*iAOList, iAOArray); |
376 if (err) |
383 if (err) |
418 // by security module implementation. |
425 // by security module implementation. |
419 // ----------------------------------------------------------------------------- |
426 // ----------------------------------------------------------------------------- |
420 // |
427 // |
421 QString CSecModUIModel::PINStatus( TInt aIndex, TBool aShowBlockedNote ) const |
428 QString CSecModUIModel::PINStatus( TInt aIndex, TBool aShowBlockedNote ) const |
422 { |
429 { |
|
430 RDEBUG("0", 0); |
423 __ASSERT_ALWAYS(aIndex < iAOArray.Count(), Panic(EPanicIndexOutOfRange)); |
431 __ASSERT_ALWAYS(aIndex < iAOArray.Count(), Panic(EPanicIndexOutOfRange)); |
424 QString pinStatus; |
432 QString pinStatus; |
425 TUint32 status = iAOArray[aIndex]->Status(); |
433 TUint32 status = iAOArray[aIndex]->Status(); |
426 |
434 |
427 if (status & EAuthObjectBlocked) |
435 if (status & EAuthObjectBlocked) |
484 // Based on the property of auth object the pin can be changed or unblocked. |
492 // Based on the property of auth object the pin can be changed or unblocked. |
485 // ----------------------------------------------------------------------------- |
493 // ----------------------------------------------------------------------------- |
486 // |
494 // |
487 void CSecModUIModel::ChangeOrUnblockPinL(TInt aIndex) |
495 void CSecModUIModel::ChangeOrUnblockPinL(TInt aIndex) |
488 { |
496 { |
|
497 RDEBUG("0", 0); |
489 __ASSERT_ALWAYS(aIndex < iAOArray.Count(), Panic(EPanicIndexOutOfRange)); |
498 __ASSERT_ALWAYS(aIndex < iAOArray.Count(), Panic(EPanicIndexOutOfRange)); |
490 TUint32 status = iAOArray[aIndex]->Status(); |
499 TUint32 status = iAOArray[aIndex]->Status(); |
491 |
500 |
492 if ((status & EAuthObjectBlocked) && (status & EUnblockDisabled)) |
501 if ((status & EAuthObjectBlocked) && (status & EUnblockDisabled)) |
493 { |
502 { |
529 // Changes the value of the PIN. |
538 // Changes the value of the PIN. |
530 // ----------------------------------------------------------------------------- |
539 // ----------------------------------------------------------------------------- |
531 // |
540 // |
532 void CSecModUIModel::ChangePinL(TInt aIndex) |
541 void CSecModUIModel::ChangePinL(TInt aIndex) |
533 { |
542 { |
|
543 RDEBUG("0", 0); |
534 __ASSERT_ALWAYS(aIndex < iAOArray.Count(), Panic(EPanicIndexOutOfRange)); |
544 __ASSERT_ALWAYS(aIndex < iAOArray.Count(), Panic(EPanicIndexOutOfRange)); |
535 TInt err = KErrNone; |
545 TInt err = KErrNone; |
536 |
546 |
537 err = iWrapper->ChangeReferenceData(*(iAOArray[aIndex])); |
547 err = iWrapper->ChangeReferenceData(*(iAOArray[aIndex])); |
538 if (err) |
548 if (err) |
594 // Deletes key from the appropriate keystore. |
604 // Deletes key from the appropriate keystore. |
595 // ----------------------------------------------------------------------------- |
605 // ----------------------------------------------------------------------------- |
596 // |
606 // |
597 void CSecModUIModel::DeleteKeysL(TInt aTokenIndex) |
607 void CSecModUIModel::DeleteKeysL(TInt aTokenIndex) |
598 { |
608 { |
|
609 RDEBUG("0", 0); |
599 __ASSERT_ALWAYS(aTokenIndex < iAOKeyStores.Count(), Panic(EPanicIndexOutOfRange)); |
610 __ASSERT_ALWAYS(aTokenIndex < iAOKeyStores.Count(), Panic(EPanicIndexOutOfRange)); |
600 RMPointerArray<CCTKeyInfo> keyInfos; |
611 RMPointerArray<CCTKeyInfo> keyInfos; |
601 CleanupClosePushL(keyInfos); |
612 CleanupClosePushL(keyInfos); |
602 TCTKeyAttributeFilter filter; |
613 TCTKeyAttributeFilter filter; |
603 filter.iPolicyFilter = TCTKeyAttributeFilter::EAllKeys; |
614 filter.iPolicyFilter = TCTKeyAttributeFilter::EAllKeys; |
645 // Retrieve security module details. |
656 // Retrieve security module details. |
646 // ----------------------------------------------------------------------------- |
657 // ----------------------------------------------------------------------------- |
647 // |
658 // |
648 QVector< QPair<QString,QString> > CSecModUIModel::GetSecModDetailsL() |
659 QVector< QPair<QString,QString> > CSecModUIModel::GetSecModDetailsL() |
649 { |
660 { |
|
661 RDEBUG("0", 0); |
650 MCTToken& token = iKeyStore->Token(); |
662 MCTToken& token = iKeyStore->Token(); |
651 QVector< QPair<QString,QString> > securityModDetails; |
663 QVector< QPair<QString,QString> > securityModDetails; |
652 |
664 |
653 if (token.TokenType().Type().iUid == KTokenTypeFileKeystore) |
665 if (token.TokenType().Type().iUid == KTokenTypeFileKeystore) |
654 { |
666 { |
721 void CSecModUIModel::AppendItem( QVector< QPair<QString,QString> >& aSecModDetails, |
733 void CSecModUIModel::AppendItem( QVector< QPair<QString,QString> >& aSecModDetails, |
722 QString aLabel, |
734 QString aLabel, |
723 const TDesC& aValue, |
735 const TDesC& aValue, |
724 QString aNullDescription) |
736 QString aNullDescription) |
725 { |
737 { |
|
738 RDEBUG("0", 0); |
726 if( aValue.Length() == 0 ) |
739 if( aValue.Length() == 0 ) |
727 { |
740 { |
728 aSecModDetails.append(QPair<QString,QString>(aLabel, aNullDescription)); |
741 aSecModDetails.append(QPair<QString,QString>(aLabel, aNullDescription)); |
729 } |
742 } |
730 else |
743 else |
783 // Change the pin value for the singing module. |
796 // Change the pin value for the singing module. |
784 // ----------------------------------------------------------------------------- |
797 // ----------------------------------------------------------------------------- |
785 // |
798 // |
786 void CSecModUIModel::ChangePinNrL(TInt aIndex) |
799 void CSecModUIModel::ChangePinNrL(TInt aIndex) |
787 { |
800 { |
|
801 RDEBUG("0", 0); |
788 ChangePinL(aIndex+1); |
802 ChangePinL(aIndex+1); |
789 } |
803 } |
790 |
804 |
791 |
805 |
792 // ----------------------------------------------------------------------------- |
806 // ----------------------------------------------------------------------------- |
824 // Returns the status accordingly if the pin is changeable or not. |
838 // Returns the status accordingly if the pin is changeable or not. |
825 // ----------------------------------------------------------------------------- |
839 // ----------------------------------------------------------------------------- |
826 // |
840 // |
827 TBool CSecModUIModel::PinChangeable(TInt aIndex) const |
841 TBool CSecModUIModel::PinChangeable(TInt aIndex) const |
828 { |
842 { |
|
843 RDEBUG("0", 0); |
829 __ASSERT_ALWAYS(aIndex < iAOArray.Count(), Panic(EPanicIndexOutOfRange)); |
844 __ASSERT_ALWAYS(aIndex < iAOArray.Count(), Panic(EPanicIndexOutOfRange)); |
830 TUint32 status = iAOArray[aIndex]->Status(); |
845 TUint32 status = iAOArray[aIndex]->Status(); |
831 TBool ret = ETrue; |
846 TBool ret = ETrue; |
832 if ( (status & EAuthObjectBlocked) || (status & EChangeDisabled) ) |
847 if ( (status & EAuthObjectBlocked) || (status & EChangeDisabled) ) |
833 { |
848 { |
873 // Returns the status accordingly if the pin is changeable or not. |
888 // Returns the status accordingly if the pin is changeable or not. |
874 // ----------------------------------------------------------------------------- |
889 // ----------------------------------------------------------------------------- |
875 // |
890 // |
876 TBool CSecModUIModel::PinRequestChangeable(TInt aIndex) const |
891 TBool CSecModUIModel::PinRequestChangeable(TInt aIndex) const |
877 { |
892 { |
|
893 RDEBUG("0", 0); |
878 __ASSERT_ALWAYS(aIndex < iAOArray.Count(), Panic(EPanicIndexOutOfRange)); |
894 __ASSERT_ALWAYS(aIndex < iAOArray.Count(), Panic(EPanicIndexOutOfRange)); |
879 TUint32 status = iAOArray[aIndex]->Status(); |
895 TUint32 status = iAOArray[aIndex]->Status(); |
880 TBool ret = EFalse; |
896 TBool ret = EFalse; |
881 if ( status & EAuthObjectBlocked ) |
897 if ( status & EAuthObjectBlocked ) |
882 { |
898 { |