28 #include "t_testhandler.h" |
28 #include "t_testhandler.h" |
29 #include <e32cons.h> |
29 #include <e32cons.h> |
30 #include <badesca.h> |
30 #include <badesca.h> |
31 #include "t_testaction.h" |
31 #include "t_testaction.h" |
32 #include "t_output.h" |
32 #include "t_output.h" |
33 #include <clientsession.h> |
33 #include "clientsession.h" |
34 #include <hash.h> |
34 #include <hash.h> |
35 #include <mctkeystore.h> |
35 #include <mctkeystore.h> |
36 #include <unifiedkeystore.h> |
36 #include <unifiedkeystore.h> |
37 #include <secdlgimpldefs.h> |
37 #include <secdlgimpldefs.h> |
38 #include <bigint.h> |
38 #include <bigint.h> |
82 void WriteExpectedDialogDataL(); |
82 void WriteExpectedDialogDataL(); |
83 void WriteDialogRecordL(RFileWriteStream& aStream, TSecurityDialogOperation aOp, const TDesC& aLabelSpec, |
83 void WriteDialogRecordL(RFileWriteStream& aStream, TSecurityDialogOperation aOp, const TDesC& aLabelSpec, |
84 const TDesC& aResponse1, const TDesC& aResponse2); |
84 const TDesC& aResponse1, const TDesC& aResponse2); |
85 TInt ReadDialogCountL(); |
85 TInt ReadDialogCountL(); |
86 void PrintKeyInfoL(const CCTKeyInfo& aKey); |
86 void PrintKeyInfoL(const CCTKeyInfo& aKey); |
87 |
87 void SetKeyType(const TDesC8& aKeyType); |
|
88 void SetKeyStoreIndex(CUnifiedKeyStore* aUnifiedKeyStore); |
|
89 |
|
90 public: |
|
91 enum TKeyTypes |
|
92 { |
|
93 ERSASign, |
|
94 EDSASign, |
|
95 EDH, |
|
96 EDecrypt, |
|
97 #if (defined(SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT) && defined(SYMBIAN_ENABLE_SDP_ECC)) |
|
98 EECC, |
|
99 #endif // SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT && SYMBIAN_ENABLE_SDP_ECC |
|
100 }; |
88 protected: |
101 protected: |
89 TUint iServerAlloc; |
102 TUint iServerAlloc; |
90 RFs& iFs; |
103 RFs& iFs; |
91 TKeyUsagePKCS15 iUsage; |
104 TKeyUsagePKCS15 iUsage; |
92 HBufC* iLabel; |
105 HBufC* iLabel; |
97 |
110 |
98 // The following are here because they are used by most derived test actions |
111 // The following are here because they are used by most derived test actions |
99 TCTKeyAttributeFilter iFilter; |
112 TCTKeyAttributeFilter iFilter; |
100 RMPointerArray<CCTKeyInfo> iKeys; |
113 RMPointerArray<CCTKeyInfo> iKeys; |
101 TInt iDisableCheckDialog; |
114 TInt iDisableCheckDialog; |
102 |
115 TKeyTypes iType; |
|
116 TInt iKeyStoreImplIndex; |
|
117 TPtrC8 iKeyStoreImplLabel; |
|
118 |
103 #ifdef SYMBIAN_AUTH_SERVER |
119 #ifdef SYMBIAN_AUTH_SERVER |
104 // this variable would be used to retrieve the rom build variant |
120 // this variable would be used to retrieve the rom build variant |
105 // for key store. |
121 // for key store. |
106 TBool iUseNewApi; |
122 TBool iUseNewApi; |
107 HBufC* iAuthExpression; |
123 HBufC* iAuthExpression; |
108 TInt iFreshness; |
124 TInt iFreshness; |
109 TInt iDeauthenticate; |
125 TInt iDeauthenticate; |
110 #endif // SYMBIAN_AUTH_SERVER |
126 #endif // SYMBIAN_AUTH_SERVER |
|
127 #if (defined(SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT) && defined(SYMBIAN_ENABLE_SDP_ECC)) |
|
128 TInt iHardwareType; |
|
129 #endif // SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT && SYMBIAN_ENABLE_SDP_ECC |
111 }; |
130 }; |
112 |
131 |
113 class CInitialiseKeyStore : public CKeyStoreTestAction |
132 class CInitialiseKeyStore : public CKeyStoreTestAction |
114 { |
133 { |
115 public: |
134 public: |
256 void DoCheckResult(TInt aError); |
275 void DoCheckResult(TInt aError); |
257 CListKeys(RFs& aFs, CConsoleBase& aConsole, Output& aOut); |
276 CListKeys(RFs& aFs, CConsoleBase& aConsole, Output& aOut); |
258 void ConstructL(const TTestActionSpec& aTestActionSpec); |
277 void ConstructL(const TTestActionSpec& aTestActionSpec); |
259 void SetKeySize(const TDesC8& aKeySize); |
278 void SetKeySize(const TDesC8& aKeySize); |
260 void SetListCount(const TDesC8& aListCount); |
279 void SetListCount(const TDesC8& aListCount); |
|
280 void SetListStatus(const TDesC8& aListStatus); |
261 void AddFoundKeyL(const TDesC8& aFoundKey); |
281 void AddFoundKeyL(const TDesC8& aFoundKey); |
262 private: |
282 private: |
263 enum TState |
283 enum TState |
264 { |
284 { |
265 EListKeys, |
285 EListKeys, |
550 private: |
576 private: |
551 void DoReportAction(); |
577 void DoReportAction(); |
552 void DoCheckResult(TInt aError); |
578 void DoCheckResult(TInt aError); |
553 COpenKey(RFs& aFs, CConsoleBase& aConsole, Output& aOut); |
579 COpenKey(RFs& aFs, CConsoleBase& aConsole, Output& aOut); |
554 void ConstructL(const TTestActionSpec& aTestActionSpec); |
580 void ConstructL(const TTestActionSpec& aTestActionSpec); |
555 void SetKeyType(const TDesC8& aKeyType); |
581 |
556 private: |
|
557 private: |
582 private: |
558 enum TState |
583 enum TState |
559 { |
584 { |
560 EListKeysPreOpen, |
585 EListKeysPreOpen, |
561 EOpenKey, |
586 EOpenKey, |
562 EFinished |
587 EFinished |
563 }; |
588 }; |
564 |
589 |
565 enum TKeyTypes |
590 #if (defined(SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT) && defined(SYMBIAN_ENABLE_SDP_ECC)) |
566 { |
591 enum TOperationType |
567 ERSASign, |
592 { |
568 EDSASign, |
593 ESigning, |
569 EDH, |
594 EDecryption, |
570 EDecrypt |
595 }; |
571 }; |
596 #endif // SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT && SYMBIAN_ENABLE_SDP_ECC |
572 private: |
597 private: |
573 TState iState; |
598 TState iState; |
574 |
|
575 TKeyTypes iType; |
|
576 |
|
577 TCTTokenObjectHandle iDeleteHandle; |
599 TCTTokenObjectHandle iDeleteHandle; |
578 // Filter components |
600 // Filter components |
579 MRSASigner* iRSASigner; |
601 MRSASigner* iRSASigner; |
580 MDSASigner* iDSASigner; |
602 MDSASigner* iDSASigner; |
581 MCTDecryptor* iDecryptor; |
603 MCTDecryptor* iDecryptor; |
582 MCTDH* iDH; |
604 MCTDH* iDH; |
|
605 #if (defined(SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT) && defined(SYMBIAN_ENABLE_SDP_ECC)) |
|
606 TOperationType iOperationType; |
|
607 CryptoSpi::CSigner* iSigner; |
|
608 CryptoSpi::CAsymmetricCipher* iDecrypt; |
|
609 #endif // SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT && SYMBIAN_ENABLE_SDP_ECC |
583 }; |
610 }; |
584 |
611 |
585 // Allows script to sign, filter on keys algorithm (or all) and deletes listed keys |
612 // Allows script to sign, filter on keys algorithm (or all) and deletes listed keys |
586 // and calls list again to ensure they've gone |
613 // and calls list again to ensure they've gone |
587 class CSign : public CKeyStoreTestAction |
614 class CSign : public CKeyStoreTestAction |
598 void DoCheckResult(TInt aError); |
625 void DoCheckResult(TInt aError); |
599 CSign(RFs& aFs, CConsoleBase& aConsole, Output& aOut); |
626 CSign(RFs& aFs, CConsoleBase& aConsole, Output& aOut); |
600 void ConstructL(const TTestActionSpec& aTestActionSpec); |
627 void ConstructL(const TTestActionSpec& aTestActionSpec); |
601 private: |
628 private: |
602 void SetSignText(const TDesC8&); |
629 void SetSignText(const TDesC8&); |
603 void SetKeyType(const TDesC8& aKeyType); |
|
604 void SetDigestSignL(const TDesC8&); |
630 void SetDigestSignL(const TDesC8&); |
|
631 |
605 private: |
632 private: |
606 enum TState |
633 enum TState |
607 { |
634 { |
608 EListKeysPreOpen, |
635 EListKeysPreOpen, |
609 EOpenKey, |
636 EOpenKey, |
610 ESign, |
637 ESign, |
611 EExportPublic, |
638 EExportPublic, |
612 EVerify, |
639 EVerify, |
613 EFinished |
640 #if (defined(SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT) && defined(SYMBIAN_ENABLE_SDP_ECC)) |
614 }; |
641 ESignInHardware, |
615 |
642 EVerifyHwSignature, |
616 enum TKeyTypes |
643 #endif // SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT && SYMBIAN_ENABLE_SDP_ECC |
617 { |
644 EFinished, |
618 ERSASign, |
645 }; |
619 EDSASign, |
646 |
620 EDH, |
|
621 EDecrypt |
|
622 }; |
|
623 private: |
647 private: |
624 TState iState; |
648 TState iState; |
625 TBool iVerifyResult; |
649 TBool iVerifyResult; |
626 TKeyTypes iType; |
|
627 TCTTokenObjectHandle iExportHandle; |
650 TCTTokenObjectHandle iExportHandle; |
628 // Filter components |
651 // Filter components |
629 HBufC8* iReadText; // Text to sign, read in from script |
652 HBufC8* iReadText; // Text to sign, read in from script |
630 HBufC8* iExportedPublicKey; |
653 HBufC8* iExportedPublicKey; |
631 MRSASigner* iRSASigner; |
654 MRSASigner* iRSASigner; |
633 MCTDecryptor* iDecryptor; |
656 MCTDecryptor* iDecryptor; |
634 MCTDH* iDH; |
657 MCTDH* iDH; |
635 CDSASignature* iDSASignature; |
658 CDSASignature* iDSASignature; |
636 CRSASignature* iRSASignature; |
659 CRSASignature* iRSASignature; |
637 CMessageDigest* iHash; |
660 CMessageDigest* iHash; |
638 TBool iFailHashDigest; // Should hash the digest beforehand, but doesn't |
661 TBool iFailHashDigest; // Should hash the digest beforehand, but doesn't to test failure mode |
639 }; // to test failure mode |
662 #if (defined(SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT) && defined(SYMBIAN_ENABLE_SDP_ECC)) |
|
663 CryptoSpi::CSigner* iSigner; |
|
664 CryptoSpi::CCryptoParams* iSpiSignature; |
|
665 TCTTokenObjectHandle iTokenHandle; |
|
666 #endif // SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT && SYMBIAN_ENABLE_SDP_ECC |
|
667 }; |
640 |
668 |
641 class CDecrypt : public CKeyStoreTestAction |
669 class CDecrypt : public CKeyStoreTestAction |
642 { |
670 { |
643 public: |
671 public: |
644 static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole, Output& aOut, const TTestActionSpec& aTestActionSpec); |
672 static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole, Output& aOut, const TTestActionSpec& aTestActionSpec); |