|
1 /* |
|
2 * Copyright (c) 2004-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 * Implements CKeyStoreSession |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 /** |
|
23 @file |
|
24 @internalTechnology |
|
25 */ |
|
26 |
|
27 #ifndef __CKEYSTORESESSION_H__ |
|
28 #define __CKEYSTORESESSION_H__ |
|
29 |
|
30 #include "fsserver.h" |
|
31 |
|
32 class CKeyStoreConduit; |
|
33 class CPassphraseManager; |
|
34 class COpenedKey; |
|
35 |
|
36 /** |
|
37 * Encapsulates an opened key object and its handle. |
|
38 */ |
|
39 struct TObjectIndex |
|
40 { |
|
41 TInt iHandle; |
|
42 COpenedKey* iObject; |
|
43 }; |
|
44 |
|
45 /** |
|
46 * A keystore session. |
|
47 * |
|
48 * Handles client requests by passing them to the keystore conduit. Keeps track |
|
49 * of uids/passphrases for the session. |
|
50 */ |
|
51 |
|
52 class CKeyStoreSession : public CTokenServerSession |
|
53 { |
|
54 public: |
|
55 /** |
|
56 * Create a new session object. |
|
57 * @param aConduit The keystore conduit used to service user requests. |
|
58 * @param aPassMan The passphrase manager object - this method takes ownership. |
|
59 */ |
|
60 static CKeyStoreSession* NewL(CFSKeyStoreServer& aServer, CPassphraseManager* aPassMan); |
|
61 virtual ~CKeyStoreSession(); |
|
62 CPassphraseManager& PassphraseManager(); |
|
63 TInt AddOpenedKeyL(COpenedKey& aObject); |
|
64 void RemoveOpenedKeyL(TInt aHandle); |
|
65 COpenedKey* OpenedKey(TInt aHandle); |
|
66 |
|
67 /** |
|
68 * Determine if this session has a key open. |
|
69 * @param aHandle The key data handle - not the session's open key handle! |
|
70 */ |
|
71 TBool HasOpenKey(TInt aHandle); |
|
72 |
|
73 CKeyStoreSession(CFSKeyStoreServer& aServer, CPassphraseManager* aPassMan); |
|
74 private: |
|
75 virtual void DoServiceL(const RMessage2& aMessage); |
|
76 private: |
|
77 CFSKeyStoreServer& iServer; |
|
78 CPassphraseManager* iPassphraseMan; |
|
79 TInt iLastHandle; |
|
80 RArray<TObjectIndex> iOpenedKeys; |
|
81 }; |
|
82 |
|
83 #endif |