20 #endif |
20 #endif |
21 |
21 |
22 #include <smfcredmgrclientdatastruct.h> |
22 #include <smfcredmgrclientdatastruct.h> |
23 #include <smfcredmgrcommon.h> |
23 #include <smfcredmgrcommon.h> |
24 #include <hash.h> |
24 #include <hash.h> |
|
25 |
25 #include "smfkeystoremanager.h" |
26 #include "smfkeystoremanager.h" |
26 |
27 |
|
28 /** |
|
29 * NewL Method |
|
30 * @return The constructed CSmfKeyStoreManager instance |
|
31 */ |
27 CSmfKeyStoreManager* CSmfKeyStoreManager::NewL() { |
32 CSmfKeyStoreManager* CSmfKeyStoreManager::NewL() { |
28 CSmfKeyStoreManager* self = CSmfKeyStoreManager::NewLC(); |
33 CSmfKeyStoreManager* self = CSmfKeyStoreManager::NewLC(); |
29 CleanupStack::Pop( self ); |
34 CleanupStack::Pop( self ); |
30 return self; |
35 return self; |
31 } |
36 } |
32 |
37 |
|
38 /** |
|
39 * NewLC Method |
|
40 * @return The constructed CSmfKeyStoreManager instance |
|
41 */ |
33 CSmfKeyStoreManager* CSmfKeyStoreManager::NewLC() { |
42 CSmfKeyStoreManager* CSmfKeyStoreManager::NewLC() { |
34 CSmfKeyStoreManager* self = new( ELeave )CSmfKeyStoreManager(); |
43 CSmfKeyStoreManager* self = new( ELeave )CSmfKeyStoreManager(); |
35 CleanupStack::PushL( self ); |
44 CleanupStack::PushL( self ); |
36 self->ConstructL(); |
45 self->ConstructL(); |
37 return self; |
46 return self; |
38 } |
47 } |
39 |
48 |
|
49 /** |
|
50 * Destructor |
|
51 */ |
40 CSmfKeyStoreManager::~CSmfKeyStoreManager() { |
52 CSmfKeyStoreManager::~CSmfKeyStoreManager() { |
41 iFs.Close(); |
53 iFs.Close(); |
42 |
54 |
43 delete iSignParameters; |
55 delete iSignParameters; |
44 iSignParameters = NULL; |
56 iSignParameters = NULL; |
46 delete iRsaKeyParameters; |
58 delete iRsaKeyParameters; |
47 iRsaKeyParameters = NULL; |
59 iRsaKeyParameters = NULL; |
48 |
60 |
49 } |
61 } |
50 |
62 |
|
63 /** |
|
64 * HandleMessageL |
|
65 * @param aMessage |
|
66 */ |
51 void CSmfKeyStoreManager::HandleMessageL( const RMessage2& aMessage ) |
67 void CSmfKeyStoreManager::HandleMessageL( const RMessage2& aMessage ) |
52 { |
68 { |
53 RDebug::Printf("SMF: CSmfKeyStoreManager::HandleMessageL"); |
69 RDebug::Printf("SMF: CSmfKeyStoreManager::HandleMessageL"); |
54 iMessages.AppendL( &aMessage ); |
70 iMessages.AppendL( &aMessage ); |
55 if ( !IsActive() ) |
71 if ( !IsActive() ) |
56 { |
72 { |
57 ContinueMessageHandlingL(); |
73 ContinueMessageHandlingL(); |
58 } |
74 } |
59 } |
75 } |
60 |
76 |
|
77 /** |
|
78 * RunL |
|
79 */ |
61 void CSmfKeyStoreManager::RunL() |
80 void CSmfKeyStoreManager::RunL() |
62 { |
81 { |
63 RDebug::Printf("SMF: CSmfKeyStoreManager::RunL, iStatus=%d", iStatus.Int() ); |
82 RDebug::Printf("SMF: CSmfKeyStoreManager::RunL, iStatus=%d", iStatus.Int() ); |
64 |
83 |
65 switch( iState ) |
84 switch( iState ) |
155 { |
174 { |
156 ContinueMessageHandlingL(); |
175 ContinueMessageHandlingL(); |
157 } |
176 } |
158 } |
177 } |
159 |
178 |
|
179 /** |
|
180 * DoCancel |
|
181 */ |
160 void CSmfKeyStoreManager::DoCancel() { |
182 void CSmfKeyStoreManager::DoCancel() { |
161 } |
183 } |
162 |
184 |
|
185 /** |
|
186 * RunError |
|
187 * @param aError |
|
188 * @return |
|
189 */ |
163 TInt CSmfKeyStoreManager::RunError( TInt aError ) { |
190 TInt CSmfKeyStoreManager::RunError( TInt aError ) { |
164 RDebug::Printf("SMF: CSmfKeyStoreManager::RunError error=%d", aError); |
191 RDebug::Printf("SMF: CSmfKeyStoreManager::RunError error=%d", aError); |
165 |
192 |
166 if ( iMessages.Count() ) |
193 if ( iMessages.Count() ) |
167 { |
194 { |
170 } |
197 } |
171 |
198 |
172 return KErrNone; |
199 return KErrNone; |
173 } |
200 } |
174 |
201 |
|
202 /** |
|
203 * Constructor |
|
204 */ |
175 CSmfKeyStoreManager::CSmfKeyStoreManager() |
205 CSmfKeyStoreManager::CSmfKeyStoreManager() |
176 :CActive(EPriorityStandard), iState(EInitializingKeystore) |
206 :CActive(EPriorityStandard), iState(EInitializingKeystore) |
177 { |
207 { |
178 } |
208 } |
179 |
209 |
|
210 /** |
|
211 * Two-phase constructor |
|
212 */ |
180 void CSmfKeyStoreManager::ConstructL() { |
213 void CSmfKeyStoreManager::ConstructL() { |
181 RDebug::Printf("SMF: CSmfKeyStoreManager::ConstructL"); |
214 RDebug::Printf("SMF: CSmfKeyStoreManager::ConstructL"); |
182 CActiveScheduler::Add( this ); |
215 CActiveScheduler::Add( this ); |
183 #ifdef SYMBIAN_V3 |
216 #ifdef SYMBIAN_V3 |
184 User::LeaveIfError( iFs.Connect() ); |
217 User::LeaveIfError( iFs.Connect() ); |
273 { |
315 { |
274 |
316 |
275 if ( iKeys[i]->ID() == iSignParameters->Key() ) |
317 if ( iKeys[i]->ID() == iSignParameters->Key() ) |
276 { |
318 { |
277 RDebug::Printf("SMF: Correct key found"); |
319 RDebug::Printf("SMF: Correct key found"); |
|
320 //might panic in CodeScanner, this open returns void |
278 iKeyStore->Open( *iKeys[i], iRSASigner, iStatus ); |
321 iKeyStore->Open( *iKeys[i], iRSASigner, iStatus ); |
279 iState = EGettingRSASigner; |
322 iState = EGettingRSASigner; |
280 keyFound = ETrue; |
323 keyFound = ETrue; |
281 SetActive(); |
324 SetActive(); |
282 break; |
325 break; |
379 } |
428 } |
380 } |
429 } |
381 #endif |
430 #endif |
382 } |
431 } |
383 |
432 |
|
433 /** |
|
434 * SetPassphraseTimeout |
|
435 */ |
384 void CSmfKeyStoreManager::SetPassphraseTimeout() |
436 void CSmfKeyStoreManager::SetPassphraseTimeout() |
385 { |
437 { |
386 #ifdef SYMBIAN_V3 |
438 #ifdef SYMBIAN_V3 |
387 iKeyStore->SetPassphraseTimeout( -1, iStatus ); |
439 iKeyStore->SetPassphraseTimeout( -1, iStatus ); |
388 iState = ESettingPassphraseTimeout; |
440 iState = ESettingPassphraseTimeout; |
389 SetActive(); |
441 SetActive(); |
390 #endif |
442 #endif |
391 } |
443 } |
392 |
444 |
|
445 /** |
|
446 * ReadSignParametersL |
|
447 */ |
393 void CSmfKeyStoreManager::ReadSignParametersL() |
448 void CSmfKeyStoreManager::ReadSignParametersL() |
394 { |
449 { |
395 RMessage2* message = iMessages[0]; |
450 RMessage2* message = iMessages[0]; |
396 RBuf8 dataBuf; |
451 RBuf8 dataBuf; |
397 CleanupClosePushL( dataBuf ); |
452 CleanupClosePushL( dataBuf ); |