|
1 /* |
|
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Defines class used for testing pbe param internalization and externalization. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 /** |
|
25 @file |
|
26 */ |
|
27 |
|
28 #ifndef TEXTERNPBEPARAMS_H |
|
29 #define TEXTERNPBEPARAMS_H |
|
30 |
|
31 #include <pbedata.h> |
|
32 #include "t_testaction.h" |
|
33 #include "t_input.h" |
|
34 |
|
35 class CExternPbeParams : public CTestAction |
|
36 /** |
|
37 This class tests thatn encryption parameters can be |
|
38 successfully externalized and restored. It is also used |
|
39 to ensure pre-PKSC#12 parameters can be read when PKCS#12 |
|
40 is enabled. |
|
41 */ |
|
42 { |
|
43 public: |
|
44 static CTestAction* NewL( |
|
45 RFs& aFs, CConsoleBase& aConsole, |
|
46 Output& aOut, const TTestActionSpec& aTestActionSpec); |
|
47 virtual ~CExternPbeParams(); |
|
48 |
|
49 // implement CTestAction |
|
50 virtual void PerformAction(TRequestStatus& aStatus); |
|
51 virtual void DoReportAction(); |
|
52 virtual void DoCheckResult(TInt aError); |
|
53 |
|
54 // override CTestAction |
|
55 virtual void DoPerformPrerequisite(TRequestStatus& aStatus); |
|
56 virtual void DoPerformPostrequisite(TRequestStatus& aStatus); |
|
57 |
|
58 private: |
|
59 CExternPbeParams(CConsoleBase& aConsole, Output& aOut, RFs& aFs); |
|
60 void ConstructL(const TTestActionSpec& aTestActionSpec); |
|
61 |
|
62 void DoPerformPrerequisiteL(); |
|
63 |
|
64 static HBufC8* ReadHexStringL(const TDesC8& aBody, const TDesC8& aTag); |
|
65 static TInt ReadDecStringL(const TDesC8& aBody, const TDesC8& aTag); |
|
66 static HBufC8* ReadStringLC(const TDesC8& aBody, const TDesC8& aTag); |
|
67 |
|
68 CPBEncryptParms* InternalizeEncryptionParamsLC(const TDesC& aFileName); |
|
69 void CompareAgainstTestFileL(const TDesC& aFileName, const CPBEncryptParms& aParams); |
|
70 void TestDecodeMatchesScriptL(const TDesC& aFileName); |
|
71 void TestReExternMatchesL(const TDesC& aFileName); |
|
72 void TestScratchExternL(const TDesC& aFileName); |
|
73 |
|
74 private: |
|
75 /** File server session used to write params to, and read params from, files. */ |
|
76 RFs& iFs; |
|
77 |
|
78 /** Element body text. */ |
|
79 HBufC8* iBody; |
|
80 |
|
81 /** Original externalized filename. */ |
|
82 HBufC8* iOrigFileName; |
|
83 /** Numeric value of expected cipher. */ |
|
84 TInt iExpCipher; |
|
85 /** Expected salt. */ |
|
86 HBufC8* iExpSalt; |
|
87 /** Expected IV. */ |
|
88 HBufC8* iExpIv; |
|
89 /** Expected iteration count. */ |
|
90 TInt iExpIterCount; |
|
91 /** |
|
92 Expected key derivation function. This is not stored |
|
93 as CPBEncryptParms::TKdf, which is not available when |
|
94 SYMBIAN_PKCS12 is not defined. |
|
95 */ |
|
96 TInt iExpKdf; |
|
97 }; |
|
98 |
|
99 #endif // #ifndef TEXTERNPBEPARAMS_H |