|
1 /* |
|
2 * Copyright (c) 2004-2006 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: PnpUtil header file |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef PNP_UTIL_IMPL_H |
|
21 #define PNP_UTIL_IMPL_H |
|
22 |
|
23 |
|
24 #include "PnpToPaosInterface.h" |
|
25 |
|
26 class CRepository; |
|
27 |
|
28 |
|
29 #ifndef _WINS |
|
30 class C3DESEncryptor; |
|
31 class C3DESDecryptor; |
|
32 #endif |
|
33 |
|
34 class CPnpUtilImpl :public CBase, public MPnpToPaosInterface |
|
35 { |
|
36 public: |
|
37 void RESERVED_FUNC(); |
|
38 |
|
39 IMPORT_C static CPnpUtilImpl* NewLC(); |
|
40 |
|
41 IMPORT_C ~CPnpUtilImpl(); |
|
42 |
|
43 /** |
|
44 * Commented in base class CPnPUtil |
|
45 */ |
|
46 IMPORT_C TInt Version(TDes& aVersion); |
|
47 |
|
48 /** |
|
49 * Commented in base class CPnPUtil |
|
50 */ |
|
51 IMPORT_C TInt CreateNewToken(TUint32 aTimeout, TInt& aToken); |
|
52 |
|
53 /** |
|
54 * Commented in base class CPnPUtil |
|
55 */ |
|
56 IMPORT_C TInt GetTokenValidityTime(); |
|
57 |
|
58 /** |
|
59 * Commented in base class CPnPUtil |
|
60 */ |
|
61 IMPORT_C TInt GetTokenValue(TInt& aToken); |
|
62 |
|
63 /** |
|
64 * Commented in base class CPnPUtil |
|
65 */ |
|
66 IMPORT_C void CreateNewNonceL( const TUint aTimeOut, TDes8& aNonce ); |
|
67 |
|
68 /** |
|
69 * Commented in base class CPnPUtil |
|
70 */ |
|
71 IMPORT_C TInt GetNonceValidityTimeL(); |
|
72 |
|
73 /** |
|
74 * Commented in base class CPnPUtil |
|
75 */ |
|
76 IMPORT_C void GetNonceL( TDes8& aNonce ); |
|
77 |
|
78 /** |
|
79 * Commented in base class CPnPUtil |
|
80 */ |
|
81 IMPORT_C void GetKeyInfoL( TDes8& aKeyInfo ); |
|
82 |
|
83 /** |
|
84 * Commented in base class CPnPUtil |
|
85 */ |
|
86 //TBool VerifySignatureL( const TDesC8& aDigestValue, const TDesC8& aSignatureValue ); |
|
87 IMPORT_C TBool VerifySignatureL( |
|
88 const TDesC8& aDigestValue, const TDesC8& aSignatureValue, |
|
89 const TDesC8& aData, const TDesC8& aNonce ); |
|
90 |
|
91 /** |
|
92 * Commented in base class CPnPUtil |
|
93 */ |
|
94 IMPORT_C void ImsiL(RMobilePhone::TMobilePhoneSubscriberId& aImsi) const; |
|
95 |
|
96 /** |
|
97 * Commented in base class CPnPUtil |
|
98 */ |
|
99 IMPORT_C void FetchHomeNetworkInfoL(); |
|
100 |
|
101 /** |
|
102 * Commented in base class CPnPUtil |
|
103 */ |
|
104 IMPORT_C void FetchNetworkInfoL(); |
|
105 |
|
106 /** |
|
107 * Commented in base class CPnPUtil |
|
108 */ |
|
109 IMPORT_C const RMobilePhone::TMobilePhoneNetworkCountryCode HomeMccL() const; |
|
110 |
|
111 /** |
|
112 * Commented in base class CPnPUtil |
|
113 */ |
|
114 IMPORT_C void SetHomeMccL( const RMobilePhone::TMobilePhoneNetworkCountryCode aMcc ); |
|
115 |
|
116 /** |
|
117 * Commented in base class CPnPUtil |
|
118 */ |
|
119 IMPORT_C const RMobilePhone::TMobilePhoneNetworkIdentity HomeMncL() const; |
|
120 |
|
121 /** |
|
122 * Commented in base class CPnPUtil |
|
123 */ |
|
124 IMPORT_C void SetHomeMncL( const RMobilePhone::TMobilePhoneNetworkIdentity aMnc ); |
|
125 |
|
126 /** |
|
127 * Commented in base class CPnPUtil |
|
128 */ |
|
129 IMPORT_C const RMobilePhone::TMobilePhoneNetworkCountryCode NetworkMccL() const; |
|
130 |
|
131 /** |
|
132 * Commented in base class CPnPUtil |
|
133 */ |
|
134 IMPORT_C void SetNetworkMccL( const RMobilePhone::TMobilePhoneNetworkCountryCode aMcc ); |
|
135 |
|
136 /** |
|
137 * Commented in base class CPnPUtil |
|
138 */ |
|
139 IMPORT_C const RMobilePhone::TMobilePhoneNetworkIdentity NetworkMncL() const; |
|
140 |
|
141 /** |
|
142 * Commented in base class CPnPUtil |
|
143 */ |
|
144 IMPORT_C void SetNetworkMncL( const RMobilePhone::TMobilePhoneNetworkIdentity aMnc ); |
|
145 |
|
146 /** |
|
147 * Commented in base class CPnPUtil |
|
148 */ |
|
149 IMPORT_C TBool RegisteredInHomeNetworkL(); |
|
150 |
|
151 /** |
|
152 * Commented in base class CPnPUtil |
|
153 */ |
|
154 IMPORT_C TInt OperatorLongName(RMobilePhone::TMobilePhoneNetworkLongName& aName); |
|
155 |
|
156 /** |
|
157 * Commented in base class CPnPUtil |
|
158 */ |
|
159 IMPORT_C TInt StoreAccessPoint(TUint32 aAP); |
|
160 |
|
161 /** |
|
162 * Commented in base class CPnPUtil |
|
163 */ |
|
164 IMPORT_C TInt FetchAccessPoint(TUint32& aAP); |
|
165 |
|
166 /** |
|
167 * Commented in base class CPnPUtil |
|
168 */ |
|
169 IMPORT_C void FormatMncCodeL( |
|
170 const RMobilePhone::TMobilePhoneNetworkCountryCode aMcc, |
|
171 const RMobilePhone::TMobilePhoneNetworkIdentity aUnformattedMnc, |
|
172 RMobilePhone::TMobilePhoneNetworkIdentity& aFormattedMnc ) const; |
|
173 |
|
174 private: // Data |
|
175 CPnpUtilImpl(); |
|
176 |
|
177 void ConstructL(); |
|
178 |
|
179 /** |
|
180 * Verifies the digest that the sender gave. The digest (hash value) is calculated |
|
181 * as follows: |
|
182 * H( nonce:data ), where H (hash) is the sha1 operation |
|
183 * @param aSendersDigest The digest that the sender gave. In binary format |
|
184 * (decoded from base64 format). |
|
185 * @param aData The data |
|
186 * @param aNonce The original randomly created nonce. |
|
187 */ |
|
188 TBool VerifyDigestL( const TDesC8& aSendersDigest, const TDesC8& aData, const TDesC8& aNonce ); |
|
189 |
|
190 /** |
|
191 * @return a random integer in range [48,57], [65,90] or [97,122] |
|
192 * (ascii code for alphanumeric character) |
|
193 */ |
|
194 TUint RandomCharacter( TInt64& aSeed ); |
|
195 |
|
196 |
|
197 /** |
|
198 * Decodes given base64-encoded data. Leaves with KErrCorrupted if |
|
199 * The data is not base64-encoded. |
|
200 * @param aEncodedDesc The base64 encoded data. |
|
201 */ |
|
202 HBufC8* DecodeBase64LC( const TDesC8& aEncodedDesc ); |
|
203 |
|
204 /** |
|
205 * A helper function for base64 encoding |
|
206 * @param aCharacter |
|
207 */ |
|
208 TChar DecodeCharL( const TChar aCharacter ); |
|
209 |
|
210 /** |
|
211 * Writes the descriptor to log as hexadecimal character representation. |
|
212 */ |
|
213 void LogAsASCIIHexL( const TDesC8& aDesc ); |
|
214 |
|
215 /** |
|
216 * |
|
217 */ |
|
218 HBufC8* PackLC( const TDesC8& aHex ) const; |
|
219 |
|
220 CRepository* iRepository; |
|
221 |
|
222 // IMSI. |
|
223 //RMobilePhone::TMobilePhoneSubscriberId iIMSI; |
|
224 TBuf<15> iIMSI; |
|
225 // Home country code |
|
226 RMobilePhone::TMobilePhoneNetworkCountryCode iHomeMCC; |
|
227 // Home network code |
|
228 RMobilePhone::TMobilePhoneNetworkIdentity iHomeMNC; |
|
229 // Network country code |
|
230 RMobilePhone::TMobilePhoneNetworkCountryCode iNetworkMCC; |
|
231 // Network network code |
|
232 RMobilePhone::TMobilePhoneNetworkIdentity iNetworkMNC; |
|
233 // True if registered in home network |
|
234 TBool iRegisteredInHomeNetwork; |
|
235 RTelServer iServer; |
|
236 RMobilePhone iPhone; |
|
237 #ifndef __WINS__ // encryptor is not used in emulator |
|
238 C3DESEncryptor* iEncryptor; |
|
239 C3DESDecryptor* iDecryptor; |
|
240 #endif |
|
241 }; |
|
242 |
|
243 #endif // PNP_UTIL_IMPL_H |