|
1 /* |
|
2 * Copyright (c) 2000 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 "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: Implementation of terminalsecurity components |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef SCPCONFIGURATION_H |
|
20 #define SCPCONFIGURATION_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <bldvariant.hrh> |
|
24 #include "SCPServerInterface.h" |
|
25 |
|
26 // DATA TYPES |
|
27 |
|
28 // Parameter types |
|
29 enum TSCPParamType |
|
30 { |
|
31 EParTypeInt = 0, |
|
32 EParTypeDesc |
|
33 }; |
|
34 |
|
35 // LOCAL CONSTANTS |
|
36 |
|
37 // Encryption |
|
38 _LIT8( KSCPEncryptionKeyMod, "overview" ); |
|
39 const TInt KSCPDesBlockSize( 8 ); |
|
40 _LIT( KSCPCryptSuffix, "SCP" ); |
|
41 |
|
42 // The settings-file name |
|
43 _LIT( KDriveC, "C:" ); |
|
44 _LIT( KSCPSettingsFilePathAndName, "\\private\\10207836\\config.ini" ); |
|
45 _LIT( KSCPSettingsFileName, "config.ini" ); |
|
46 |
|
47 // Definitions for the structures that control the parameter-parsing |
|
48 |
|
49 const TInt KParamIDMaxTimeout = 1; |
|
50 const TInt KParamIDSecCode = 2; |
|
51 const TInt KParamIDEnhSecCode = 3; |
|
52 const TInt KParamIDConfigFlag = 4; |
|
53 const TInt KParamIDFailedAttempts = 5; |
|
54 const TInt KParamIDBlockedAtTime = 6; |
|
55 |
|
56 const TInt KParamIDBlockedInOOS = 7; |
|
57 |
|
58 //#ifdef __SAP_DEVICE_LOCK_ENHANCEMENTS |
|
59 #define SCP_PARAMETERS_WithFlag { &iConfigFlag, \ |
|
60 &iMaxTimeout, \ |
|
61 &iSecCode, \ |
|
62 &iEnhSecCode, \ |
|
63 &iFailedAttempts, \ |
|
64 &iBlockedAtTime, \ |
|
65 &iBlockedInOOS \ |
|
66 }; |
|
67 |
|
68 #define SCP_PARAMIDS_WithFlag { KParamIDConfigFlag, \ |
|
69 KParamIDMaxTimeout, \ |
|
70 KParamIDSecCode, \ |
|
71 KParamIDEnhSecCode, \ |
|
72 KParamIDFailedAttempts, \ |
|
73 KParamIDBlockedAtTime, \ |
|
74 KParamIDBlockedInOOS \ |
|
75 }; |
|
76 |
|
77 #define SCP_PARAMTYPES_WithFlag { EParTypeInt, \ |
|
78 EParTypeInt, \ |
|
79 EParTypeDesc, \ |
|
80 EParTypeDesc, \ |
|
81 EParTypeInt, \ |
|
82 EParTypeDesc, \ |
|
83 EParTypeInt \ |
|
84 }; |
|
85 |
|
86 //#else // !__SAP_DEVICE_LOCK_ENHANCEMENTS |
|
87 |
|
88 // Definitions for the structures that control the parsing |
|
89 #define SCP_PARAMETERS_WithOutFlag { &iConfigFlag, \ |
|
90 &iMaxTimeout, \ |
|
91 &iSecCode, \ |
|
92 &iBlockedInOOS \ |
|
93 }; |
|
94 |
|
95 #define SCP_PARAMIDS_WithOutFlag { KParamIDConfigFlag, \ |
|
96 KParamIDMaxTimeout, \ |
|
97 KParamIDSecCode, \ |
|
98 KParamIDBlockedInOOS \ |
|
99 }; |
|
100 |
|
101 #define SCP_PARAMTYPES_WithOutFlag { EParTypeInt, \ |
|
102 EParTypeInt, \ |
|
103 EParTypeDesc, \ |
|
104 EParTypeInt \ |
|
105 }; |
|
106 //#endif // __SAP_DEVICE_LOCK_ENHANCEMENTS |
|
107 |
|
108 // CLASS DECLARATION |
|
109 |
|
110 /** |
|
111 * TSCPConfiguration |
|
112 * A class, which handles the configuration data for the SCP server component |
|
113 */ |
|
114 class TSCPConfiguration |
|
115 { |
|
116 public: // Methods |
|
117 |
|
118 // Constructors and destructor |
|
119 |
|
120 /** |
|
121 * C++ default constructor. |
|
122 */ |
|
123 TSCPConfiguration( RFs* aRfs ); |
|
124 |
|
125 // New methods |
|
126 |
|
127 /** |
|
128 * Initializes the configuration object. Must be called before using any other methods. |
|
129 */ |
|
130 void Initialize(); |
|
131 |
|
132 /** |
|
133 * Reads the setup information form flash. |
|
134 * @return TInt: A generic status code indicating the operation status. |
|
135 */ |
|
136 TInt ReadSetupL(); |
|
137 |
|
138 /** |
|
139 * Writes the setup to flash. |
|
140 * @return TInt: A generic status code indicating the operation status. |
|
141 */ |
|
142 TInt WriteSetupL(); |
|
143 |
|
144 private: // Methods |
|
145 |
|
146 /** |
|
147 * Returns the key to use for symmetric encryption. |
|
148 */ |
|
149 void GetKeyL( TDes8& aKey ); |
|
150 |
|
151 /** |
|
152 * Encrypts or decrypts the input string in aInput, saving the output in aOutput. |
|
153 * If the input is not an exact multiple of a DES block, 0-padding is used. The |
|
154 * output buffer must be large enough to store the output blocks. |
|
155 */ |
|
156 void TransformStringL( TBool aEncrypt, TDes& aInput, TDes& aOutput ); |
|
157 |
|
158 |
|
159 public: // Data |
|
160 /** Configuration valid -flag */ |
|
161 TInt iConfigFlag; |
|
162 /** The Autolock max.timeout */ |
|
163 TInt iMaxTimeout; |
|
164 /** The security code stored on the server */ |
|
165 TSCPSecCode iSecCode; |
|
166 /** The name of the main configuration file */ |
|
167 TFileName iConfigFileName; |
|
168 TInt iBlockedInOOS; |
|
169 |
|
170 /** A ptr to a connected RFs, not owned */ |
|
171 RFs* iFsSession; |
|
172 |
|
173 //#ifdef __SAP_DEVICE_LOCK_ENHANCEMENTS |
|
174 /** The enchanced security code stored on the server */ |
|
175 TBuf<KSCPMaxEnhCodeLen> iEnhSecCode; |
|
176 /** The amount of consecutive authentication failures */ |
|
177 TInt iFailedAttempts; |
|
178 /** The time since the code has been blocked */ |
|
179 TBuf<KSCPMaxInt64Length> iBlockedAtTime; |
|
180 //#endif // __SAP_DEVICE_LOCK_ENHANCEMENTS |
|
181 |
|
182 }; |
|
183 |
|
184 #endif // SCPCONFIGURATION_H |
|
185 |
|
186 // End of File |
|
187 |