22 #include <e32base.h> |
22 #include <e32base.h> |
23 #include <ct/rmpointerarray.h> |
23 #include <ct/rmpointerarray.h> |
24 #include <mctkeystore.h> |
24 #include <mctkeystore.h> |
25 #include <unifiedkeystore.h> |
25 #include <unifiedkeystore.h> |
26 #include <badesca.h> |
26 #include <badesca.h> |
27 //#include <e32cmn.h> |
27 |
28 |
28 #ifdef KEYTOOL |
|
29 #include <authserver/authtypes.h> |
|
30 #include <authserver/identity.h> |
|
31 #include <authserver/authclient.h> |
|
32 #endif // KEYTOOL |
29 |
33 |
30 class CController; |
34 class CController; |
31 class CKeyToolController; |
35 class CKeyToolController; |
32 |
36 #ifdef KEYTOOL |
|
37 class CKeyInfo; |
|
38 class CFileKeyData; |
|
39 class CPermanentFileStore; |
|
40 class CKeyStoreCenrep; |
|
41 class CPassphrase; |
|
42 #endif // KEYTOOL |
33 |
43 |
34 /** |
44 /** |
35 * This class wraps up the command line parameters |
45 * This class wraps up the command line parameters |
36 * which affect the keystore command to be executed. |
46 * which affect the keystore command to be executed. |
37 * E.g. the key label we refer to, the key store to use, etc. |
47 * E.g. the key label we refer to, the key store to use, etc. |
262 CCTKeyInfo* iKey; |
285 CCTKeyInfo* iKey; |
263 TInt idx; |
286 TInt idx; |
264 }; |
287 }; |
265 |
288 |
266 |
289 |
|
290 #ifdef KEYTOOL |
|
291 |
|
292 /** |
|
293 * Implements the migration of old keystore to the new keystore format |
|
294 * which uses the authentication server. |
|
295 */ |
|
296 class CKeytoolMigrateStore : public CActive |
|
297 { |
|
298 |
|
299 private: |
|
300 enum TMigrateStoreState |
|
301 { |
|
302 EAfterAuthentication, |
|
303 |
|
304 }; |
|
305 public: |
|
306 static CKeytoolMigrateStore* NewLC(CKeyToolParameters* aParams); |
|
307 static CKeytoolMigrateStore* NewL(CKeyToolParameters* aParams); |
|
308 ~CKeytoolMigrateStore(); |
|
309 void ConstructL(CKeyToolParameters* aParams); |
|
310 |
|
311 public: // From CKeyToolCommand |
|
312 void DoCommandL(); |
|
313 |
|
314 public: // From CActive |
|
315 void RunL(); |
|
316 void DoCancel(); |
|
317 TInt RunError(TInt aError); |
|
318 |
|
319 private: |
|
320 CKeytoolMigrateStore(); |
|
321 void WriteKeyL( const CKeyInfo& aKeyInfo, |
|
322 RStoreWriteStream& aWriteInfoStream ); |
|
323 |
|
324 void WriteAuthDetailsL( RStoreWriteStream& aWriteInfoStream ); |
|
325 void RevertStore(TAny* aStore); |
|
326 void InitializeDefaultParams(); |
|
327 void WriteKeyInformationL(); |
|
328 template <class T> inline void EncryptAndStoreL(const T& aKey, RStoreWriteStream& aStream ); |
|
329 void StoreKeyL(const TDesC8& aKeyData, RStoreWriteStream& aStream); |
|
330 template <class T> void RetrieveAndStorePublicKeyL( CFileKeyData* aKeyData, T* aPublicKey ); |
|
331 template <class T> void RetrieveAndStorePrivateKeyL( CFileKeyData* aKeyData, T* aPrivateKey ); |
|
332 static void CleanKeyInfo(TAny* aKeyInfo); |
|
333 |
|
334 private: |
|
335 AuthServer::TIdentityId iIdentityId; |
|
336 AuthServer::RAuthClient iAuthClient; |
|
337 CPermanentFileStore* iWriteFileStore; |
|
338 CPermanentFileStore* iReadFileStore; |
|
339 TStreamId iWriteLookupStreamId; |
|
340 CKeyToolParameters* iParams; |
|
341 RFs iFs; |
|
342 CKeyStoreCenrep* iKeyStoreCenrep; |
|
343 CPassphrase* iPassphrase; |
|
344 AuthServer::CIdentity* iUserIdentity; |
|
345 TMigrateStoreState iState; |
|
346 |
|
347 RPointerArray<CFileKeyData> iKeyList; |
|
348 }; |
|
349 |
|
350 #endif // KEYTOOL |
267 #endif |
351 #endif |
|
352 |