|
1 /* |
|
2 * Copyright (c) 2008 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: A task que to serialize the key operations among session. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_KEYOPERATIONQUEUE_H |
|
21 #define C_KEYOPERATIONQUEUE_H |
|
22 |
|
23 #include <e32base.h> |
|
24 |
|
25 #include "pkidefs.h" |
|
26 |
|
27 class CPKISession; |
|
28 class CKeyPairOperationProvider; |
|
29 class CPKIMapper; |
|
30 |
|
31 |
|
32 /** |
|
33 * A queueing class for keypair operations. |
|
34 * |
|
35 * This class queues the keypairoperations issued by client sessions. |
|
36 * The keyoperations are queued, because only one session handle to |
|
37 * CUnifiedKeystore can be open in this process and the CUnifiedKeystore |
|
38 * can't handle concurrent asynchronous operations simultaniously. Only one |
|
39 * session handle can be open to CUnifiedKeystore, because of the required |
|
40 * Login/Logoff functionality. |
|
41 * |
|
42 * Server side session add the operations to que by calling AddOperationL. |
|
43 * The operations are handled one at the time. When the operation is completed, the |
|
44 * key operation queue signals the associated RMessage. |
|
45 * |
|
46 * Rest of the operations are call backs, which are used to signal, that the current |
|
47 * operation is completed. |
|
48 * |
|
49 */ |
|
50 class CKeyOperationQueue : public CBase |
|
51 { |
|
52 public: |
|
53 static CKeyOperationQueue* NewL(CPKIMapper& aMapper); |
|
54 ~CKeyOperationQueue(); |
|
55 |
|
56 void AddOperationL(CPKISession& aOwner, |
|
57 const RMessage2& aMessage, |
|
58 TInt aUsedKeyStore, |
|
59 TPkiServiceStoreType aUsedCertStore); |
|
60 |
|
61 |
|
62 void KeyStoreInitComplete(TInt aStatus); |
|
63 |
|
64 /** |
|
65 * Transfers the ownership of aKeyList. |
|
66 */ |
|
67 void KeyPairListComplete(TInt aStatus, CArrayFixFlat<TKeyListEntry>* aKeyList); |
|
68 |
|
69 /** |
|
70 * Transfers the ownership of aDecryptedData. |
|
71 */ |
|
72 void DecryptComplete(TInt aStatus, HBufC8* aDecryptedData); |
|
73 |
|
74 /** |
|
75 * Transfers the ownership of aSignedData. |
|
76 */ |
|
77 void SignComplete(TInt aStatus, HBufC8* aSignedData); |
|
78 |
|
79 /** |
|
80 * Transfers the ownership of aPublicKeyData. |
|
81 */ |
|
82 void GetPublicKeyCompleted(TInt aStatus, HBufC8* aPublicKeyData); |
|
83 |
|
84 void LogonCompleted(TInt aStatus); |
|
85 void LogoffCompleted(TInt aStatus); |
|
86 void PasswordChangeCompleted(TInt aStatus); |
|
87 void KeyPairRemoveCompleted(TInt aStatus); |
|
88 void KeyGenerationCompleted(TInt aStatus, TPKIKeyIdentifier& aKeyId); |
|
89 void StoreKeyPairCompleted(TInt aStatus, TPKIKeyIdentifier& aKeyId); |
|
90 |
|
91 |
|
92 private: |
|
93 |
|
94 class TKeyOperation |
|
95 { |
|
96 public: |
|
97 TKeyOperation(CPKISession& aOwner, |
|
98 const RMessage2& aMessage, |
|
99 TInt aUsedKeyStore, |
|
100 TPkiServiceStoreType aUsedCertStore); |
|
101 |
|
102 CPKISession& iOwner; |
|
103 const RMessage2 iMessage; |
|
104 TInt iUsedKeyStore; |
|
105 TPkiServiceStoreType iUsedCertStore; |
|
106 }; |
|
107 |
|
108 |
|
109 CKeyOperationQueue(CPKIMapper& aMapper); |
|
110 void ConstructL(); |
|
111 |
|
112 void StartNextOperation(); |
|
113 void ServiceL(TKeyOperation& aOperation); |
|
114 |
|
115 void CompleteCurrentOperation(TInt aStatus); |
|
116 |
|
117 CPKIMapper& iMapper; |
|
118 RPointerArray<TKeyOperation> iOperationQue; |
|
119 TKeyOperation* iCurrentOperation; |
|
120 |
|
121 CKeyPairOperationProvider* iKeyOperationProvider; |
|
122 }; |
|
123 |
|
124 #endif //C_KEYOPERATIONQUEUE_H |