28 #include <asymmetric.h> |
30 #include <asymmetric.h> |
29 #include <CCMSX509Certificate.h> |
31 #include <CCMSX509Certificate.h> |
30 #include <CCMSSignerInfo.h> |
32 #include <CCMSSignerInfo.h> |
31 #include <CCMSEncapsulatedContentInfo.h> |
33 #include <CCMSEncapsulatedContentInfo.h> |
32 #include <CCMSSignedData.h> |
34 #include <CCMSSignedData.h> |
33 |
|
34 #ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS |
|
35 #include <PKIDlg.h> |
35 #include <PKIDlg.h> |
36 #endif |
|
37 |
|
38 #include "cstsseprompt.h" |
36 #include "cstsseprompt.h" |
39 |
37 |
40 #include <hash.h> |
38 #include <hash.h> |
41 #include "fs_methodcall.h" |
39 #include "fs_methodcall.h" |
42 #include <jutils.h> |
40 #include <jutils.h> |
43 #include "satsajnitools.h" |
41 #include "satsajnitools.h" |
44 #include "logger.h" |
42 #include "logger.h" |
45 #include "jstringutils.h" |
43 #include "jstringutils.h" |
46 |
44 |
47 |
45 // CONSTANTS |
48 const TInt KDefaultGranularity = 1; |
46 const TInt KDefaultGranularity = 1; |
49 |
47 |
50 const TInt KOptionIncludeContent = 1; |
48 const TInt KOptionIncludeContent = 1; |
51 const TInt KOptionIncludeCertificate = 2; |
49 const TInt KOptionIncludeCertificate = 2; |
52 |
50 |
128 // |
124 // |
129 HBufC8* CSTSSignatureService::AuthenticateL(const TDesC8& abytesToAuthenticate, |
125 HBufC8* CSTSSignatureService::AuthenticateL(const TDesC8& abytesToAuthenticate, |
130 TInt aOptions, const CDesCArray& aCaNames, |
126 TInt aOptions, const CDesCArray& aCaNames, |
131 const TDesC& asecurityElementPrompt, TBool aShowData) |
127 const TDesC& asecurityElementPrompt, TBool aShowData) |
132 { |
128 { |
|
129 LOG(ESATSA, EInfo, "+ CSTSSignatureService::AuthenticateL"); |
133 if (iState != EReady) |
130 if (iState != EReady) |
134 { |
131 { |
135 ELOG(ESATSA, "CSTSSignatureService::AuthenticateL: Not Ready"); |
132 ELOG(ESATSA, "CSTSSignatureService::AuthenticateL: Not Ready"); |
136 User::Leave(KErrNotReady); |
133 User::Leave(KErrNotReady); |
137 } |
134 } |
138 |
135 |
|
136 LOG(ESATSA, EInfo, "CSTSSignatureService::AuthenticateL:After convertions"); |
139 // First we need to convert the data to unicode, if we have to display it |
137 // First we need to convert the data to unicode, if we have to display it |
140 HBufC* textToDisplay = NULL; |
138 HBufC* textToDisplay = NULL; |
141 if (aShowData) |
139 if (aShowData) |
142 { |
140 { |
143 textToDisplay = ConvertUTF8ToUnicodeL(abytesToAuthenticate); |
141 textToDisplay = ConvertUTF8ToUnicodeL(abytesToAuthenticate); |
155 iMessage.Set(abytesToAuthenticate); |
153 iMessage.Set(abytesToAuthenticate); |
156 |
154 |
157 iOptions = aOptions; |
155 iOptions = aOptions; |
158 |
156 |
159 iShowNotes = EFalse; |
157 iShowNotes = EFalse; |
|
158 |
|
159 LOG(ESATSA, EInfo, "CSTSSignatureService::AuthenticateL:Going to call CreateSignatureL"); |
160 // get handles to applicable certificates |
160 // get handles to applicable certificates |
161 HBufC8* retVal = CreateSignatureL(aCaNames, EX509UsageDigitalSignature, |
161 HBufC8* retVal = CreateSignatureL(aCaNames, EX509UsageDigitalSignature, |
162 asecurityElementPrompt); |
162 asecurityElementPrompt); |
|
163 LOG(ESATSA, EInfo, "CSTSSignatureService::AuthenticateL:After call to CreateSignatureL"); |
|
164 |
|
165 LOG(ESATSA, EInfo, "-- CSTSSignatureService::AuthenticateL"); |
163 return retVal; |
166 return retVal; |
164 } |
167 } |
165 |
168 |
166 TInt CSTSSignatureService::StaticAuthenticateL(JNIEnv* aJniEnv, |
169 TInt CSTSSignatureService::StaticAuthenticateL(JNIEnv* aJniEnv, |
167 CSTSSignatureService* service, jbyteArray aByteArrayToAuthenticate, |
170 CSTSSignatureService* service, jbyteArray aByteArrayToAuthenticate, |
168 jint aOptions, jobjectArray aCaNames, jstring aSecurityElementPrompt, |
171 jint aOptions, jobjectArray aCaNames, jstring aSecurityElementPrompt, |
169 jboolean aShowData, HBufC8** aRetVal) |
172 jboolean aShowData, HBufC8** aRetVal) |
170 { |
173 { |
|
174 LOG(ESATSA, EInfo, "+ CSTSSignatureService::StaticAuthenticateL"); |
171 const TInt byteArrayLength = aJniEnv->GetArrayLength( |
175 const TInt byteArrayLength = aJniEnv->GetArrayLength( |
172 aByteArrayToAuthenticate); |
176 aByteArrayToAuthenticate); |
173 jbyte* bytesToAuthenticate = aJniEnv->GetByteArrayElements( |
177 jbyte* bytesToAuthenticate = aJniEnv->GetByteArrayElements( |
174 aByteArrayToAuthenticate, NULL); |
178 aByteArrayToAuthenticate, NULL); |
175 |
179 |
183 byteArrayLength); |
187 byteArrayLength); |
184 |
188 |
185 CDesCArrayFlat* nativeCaNames = STSCreateNativeStringArrayL(aJniEnv, |
189 CDesCArrayFlat* nativeCaNames = STSCreateNativeStringArrayL(aJniEnv, |
186 aCaNames); |
190 aCaNames); |
187 |
191 |
|
192 LOG(ESATSA, EInfo, "CSTSSignatureService::StaticAuthenticateL: prepare se prompt"); |
188 const JStringUtils securityElementPrompt(*aJniEnv, aSecurityElementPrompt); |
193 const JStringUtils securityElementPrompt(*aJniEnv, aSecurityElementPrompt); |
189 |
194 |
|
195 LOG(ESATSA, EInfo, "CSTSSignatureService::StaticAuthenticateL: start convertions to TInt"); |
190 TBool ShowData = static_cast<TBool>(aShowData); |
196 TBool ShowData = static_cast<TBool>(aShowData); |
191 const TDesC* sec = static_cast<const TDesC*>(&securityElementPrompt); |
197 const TDesC* sec = static_cast<const TDesC*>(&securityElementPrompt); |
192 |
198 |
|
199 LOG(ESATSA, EInfo, "CSTSSignatureService::StaticAuthenticateL: After convertions,going to call CallMethodL"); |
193 TRAPD(err, CallMethodL(*aRetVal, service, |
200 TRAPD(err, CallMethodL(*aRetVal, service, |
194 &CSTSSignatureService::AuthenticateL, desToAuthenticate, aOptions, |
201 &CSTSSignatureService::AuthenticateL, desToAuthenticate, aOptions, |
195 *nativeCaNames, *sec, ShowData, service)); |
202 *nativeCaNames, *sec, ShowData, service)); |
196 |
203 |
|
204 LOG(ESATSA, EInfo, "+ CSTSSignatureService::StaticAuthenticateL:After CallmethodL"); |
|
205 LOG(ESATSA, EInfo, "-- return CSTSSignatureService::StaticAuthenticateL"); |
197 return err; |
206 return err; |
198 |
207 |
199 } |
208 } |
200 |
209 |
201 // ----------------------------------------------------------------------------- |
210 // ----------------------------------------------------------------------------- |
205 // ----------------------------------------------------------------------------- |
214 // ----------------------------------------------------------------------------- |
206 |
215 |
207 HBufC8* CSTSSignatureService::SignL(const TDesC8& aBytesToSign, TInt aOptions, |
216 HBufC8* CSTSSignatureService::SignL(const TDesC8& aBytesToSign, TInt aOptions, |
208 const CDesCArray& aCaNames, const TDesC& aSecurityElementPrompt) |
217 const CDesCArray& aCaNames, const TDesC& aSecurityElementPrompt) |
209 { |
218 { |
|
219 LOG(ESATSA, EInfo, "+ CSTSSignatureService::SignL"); |
210 if (iState != EReady) |
220 if (iState != EReady) |
211 { |
221 { |
212 ELOG(ESATSA, "CSTSSignatureService::SignL: Not Ready"); |
222 ELOG(ESATSA, "CSTSSignatureService::SignL: Not Ready"); |
213 User::Leave(KErrNotReady); |
223 User::Leave(KErrNotReady); |
214 } |
224 } |
215 |
225 |
|
226 LOG(ESATSA, EInfo, "CSTSSignatureService::SignL: start convertions!"); |
|
227 LOG(ESATSA, EInfo, "CSTSSignatureService::SignL: After convertions"); |
216 // convert text from UTF8 |
228 // convert text from UTF8 |
217 HBufC* textToDisplay = ConvertUTF8ToUnicodeL(aBytesToSign); |
229 HBufC* textToDisplay = ConvertUTF8ToUnicodeL(aBytesToSign); |
218 delete iTextToDisplay; |
230 delete iTextToDisplay; |
219 iTextToDisplay = textToDisplay; |
231 iTextToDisplay = textToDisplay; |
220 |
232 |
240 // |
254 // |
241 TInt CSTSSignatureService::StaticSignL(JNIEnv* aJniEnv, |
255 TInt CSTSSignatureService::StaticSignL(JNIEnv* aJniEnv, |
242 CSTSSignatureService* service, jbyteArray aBytesToSign, jint aOptions, |
256 CSTSSignatureService* service, jbyteArray aBytesToSign, jint aOptions, |
243 jobjectArray aCaNames, jstring aSecurityElementPrompt, HBufC8** aRetVal) |
257 jobjectArray aCaNames, jstring aSecurityElementPrompt, HBufC8** aRetVal) |
244 { |
258 { |
|
259 LOG(ESATSA, EInfo, "+ CSTSSignatureService::StaticSignL"); |
245 const TInt byteArrayLength = aJniEnv->GetArrayLength(aBytesToSign); |
260 const TInt byteArrayLength = aJniEnv->GetArrayLength(aBytesToSign); |
246 jbyte* bytesToSign = aJniEnv->GetByteArrayElements(aBytesToSign, NULL); |
261 jbyte* bytesToSign = aJniEnv->GetByteArrayElements(aBytesToSign, NULL); |
247 |
262 |
248 if (!bytesToSign) |
263 if (!bytesToSign) |
249 { |
264 { |
250 ELOG(ESATSA, "CSTSSignatureService::StaticSignL: No memory"); |
265 LOG(ESATSA, EInfo, "CSTSSignatureService::StaticSignL: No memory"); |
251 return NULL; |
266 return NULL; |
252 } |
267 } |
253 |
268 |
254 TPtrC8 desToSign(reinterpret_cast<TUint8*>(bytesToSign), byteArrayLength); |
269 TPtrC8 desToSign(reinterpret_cast<TUint8*>(bytesToSign), byteArrayLength); |
255 |
270 |
256 CDesCArrayFlat* nativeCaNames = STSCreateNativeStringArrayL(aJniEnv, |
271 CDesCArrayFlat* nativeCaNames = STSCreateNativeStringArrayL(aJniEnv, |
257 aCaNames); |
272 aCaNames); |
258 |
273 |
259 const JStringUtils securityElementPrompt(*aJniEnv, aSecurityElementPrompt); |
274 const JStringUtils securityElementPrompt(*aJniEnv, aSecurityElementPrompt); |
260 |
275 |
261 |
276 LOG(ESATSA, EInfo, "CSTSSignatureService::StaticSignL: Start convertions"); |
|
277 LOG(ESATSA, EInfo, "CSTSSignatureService::StaticSignL: Before callmethodl"); |
|
278 |
262 const TDesC* sec = static_cast<const TDesC*>(&securityElementPrompt); |
279 const TDesC* sec = static_cast<const TDesC*>(&securityElementPrompt); |
263 |
280 |
264 TRAPD(err, CallMethodL(*aRetVal, service, &CSTSSignatureService::SignL, |
281 TRAPD(err, CallMethodL(*aRetVal, service, &CSTSSignatureService::SignL, |
265 desToSign, aOptions, *nativeCaNames, *sec, service)); |
282 desToSign, aOptions, *nativeCaNames, *sec, service)); |
266 |
283 |
|
284 LOG(ESATSA, EInfo, "-- ret CSTSSignatureService::StaticSignL"); |
267 return err; |
285 return err; |
268 } |
286 } |
269 |
287 |
270 // ----------------------------------------------------------------------------- |
288 // ----------------------------------------------------------------------------- |
271 // CSTSSignatureService::RunL |
289 // CSTSSignatureService::RunL |
272 // CActive callback |
290 // CActive callback |
273 // ----------------------------------------------------------------------------- |
291 // ----------------------------------------------------------------------------- |
274 // |
292 // |
275 void CSTSSignatureService::RunL() |
293 void CSTSSignatureService::RunL() |
276 { |
294 { |
|
295 LOG(ESATSA, EInfo, "+ CSTSSignatureService::RunL"); |
277 if (iStatus == KErrCancel) |
296 if (iStatus == KErrCancel) |
278 { |
297 { |
|
298 LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: KErrCancel"); |
279 if (iShowNotes) |
299 if (iShowNotes) |
280 { |
300 { |
|
301 LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: ShowNote"); |
281 iState = EFinalNote; |
302 iState = EFinalNote; |
282 iStatus = KErrNone; |
303 iStatus = KErrNone; |
283 #ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS |
|
284 iPKIDialog->Note(MPKIDialog::ESigningCancelled, iStatus); |
304 iPKIDialog->Note(MPKIDialog::ESigningCancelled, iStatus); |
285 #endif |
|
286 SetActive(); |
305 SetActive(); |
287 } |
306 LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: Done ShowNote"); |
|
307 } |
288 else |
308 else |
289 { |
309 { |
290 Complete(KErrNone); |
310 LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: Complete"); |
|
311 Complete(KErrNone); |
291 } |
312 } |
292 } |
313 } |
293 else if (iStatus != KErrNone) |
314 else if (iStatus != KErrNone) |
294 { |
315 { |
295 ELOG(ESATSA, "CSTSSignatureService::RunL: Error occured"); |
316 LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: Error occured"); |
296 // Error has occured; inform java |
317 // Error has occured; inform java |
297 Complete(iStatus.Int()); |
318 Complete(iStatus.Int()); |
298 } |
319 } |
299 else |
320 else |
300 { |
321 { |
301 switch (iState) |
322 switch (iState) |
302 { |
323 { |
303 case EInitialising: |
324 case EInitialising: |
304 { |
325 { |
|
326 LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: case EInitialising"); |
305 iState = EKeyStoreInit; |
327 iState = EKeyStoreInit; |
306 iKeyStore->Initialize(iStatus); |
328 iKeyStore->Initialize(iStatus); |
307 SetActive(); |
329 SetActive(); |
|
330 LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: over case EInitialising"); |
308 break; |
331 break; |
309 } |
332 } |
310 case EKeyStoreInit: |
333 case EKeyStoreInit: |
311 { |
334 { |
|
335 LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: case EKeyStoreInit"); |
312 Complete(KErrNone); |
336 Complete(KErrNone); |
313 break; |
337 break; |
314 } |
338 } |
315 case EListing: |
339 case EListing: |
316 { |
340 { |
|
341 LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: case EListing"); |
317 HandlesFromCertInfosL(); |
342 HandlesFromCertInfosL(); |
|
343 LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: over case EListing"); |
318 break; |
344 break; |
319 } |
345 } |
320 case EDialog: |
346 case EDialog: |
321 { |
347 { |
|
348 LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: case EDialog"); |
322 iState = EGetCert; |
349 iState = EGetCert; |
323 if (iCertificate) |
350 if (iCertificate) |
324 { |
351 { |
325 iCertificate->Release(); |
352 iCertificate->Release(); |
326 iCertificate = NULL; |
353 iCertificate = NULL; |
331 iCertificateHandle = iCertificateArray[0]; |
358 iCertificateHandle = iCertificateArray[0]; |
332 } |
359 } |
333 |
360 |
334 iCertStore->GetCert(iCertificate, iCertificateHandle, iStatus); |
361 iCertStore->GetCert(iCertificate, iCertificateHandle, iStatus); |
335 SetActive(); |
362 SetActive(); |
|
363 LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: over case EDialog"); |
336 break; |
364 break; |
337 } |
365 } |
338 case EGetCert: |
366 case EGetCert: |
339 { |
367 { |
|
368 LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: case EGetCert"); |
340 if (iX509Certificate) |
369 if (iX509Certificate) |
341 { |
370 { |
342 delete iX509Certificate; |
371 delete iX509Certificate; |
343 iX509Certificate = NULL; |
372 iX509Certificate = NULL; |
344 } |
373 } |
345 iState = ERetrieveCert; |
374 iState = ERetrieveCert; |
346 iCertStore->Retrieve(*iCertificate, iX509Certificate, iStatus); |
375 iCertStore->Retrieve(*iCertificate, iX509Certificate, iStatus); |
347 SetActive(); |
376 SetActive(); |
|
377 LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: over case EGetCert"); |
348 break; |
378 break; |
349 } |
379 } |
350 case ERetrieveCert: |
380 case ERetrieveCert: |
351 { |
381 { |
|
382 LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: case ERetrieveCert"); |
352 FindKeyL(); |
383 FindKeyL(); |
353 break; |
384 break; |
354 } |
385 } |
355 case EFindKey: |
386 case EFindKey: |
356 { |
387 { |
|
388 LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: case EFindKey"); |
357 OpenSignerL(); |
389 OpenSignerL(); |
358 break; |
390 break; |
359 } |
391 } |
360 case EOpenSigner: |
392 case EOpenSigner: |
361 { |
393 { |
|
394 LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: case EOpenSigner"); |
362 SignL(); |
395 SignL(); |
363 break; |
396 break; |
364 } |
397 } |
365 case ESign: |
398 case ESign: |
366 { |
399 { |
|
400 LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: case ESign"); |
367 CreateSignedDataL(); |
401 CreateSignedDataL(); |
|
402 LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: over case ESign"); |
368 break; |
403 break; |
369 } |
404 } |
370 case EFinalNote: |
405 case EFinalNote: |
371 { |
406 { |
|
407 LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: case EFinalNote"); |
372 Complete(KErrNone); |
408 Complete(KErrNone); |
|
409 LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: over case EFinalNote"); |
373 break; |
410 break; |
374 } |
411 } |
375 default: |
412 default: |
376 { |
413 { |
|
414 LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: case default"); |
377 Complete(KErrGeneral); |
415 Complete(KErrGeneral); |
378 } |
416 } |
379 } |
417 } |
380 } |
418 } |
381 } |
419 } |
502 // Completes the operation |
540 // Completes the operation |
503 // ----------------------------------------------------------------------------- |
541 // ----------------------------------------------------------------------------- |
504 // |
542 // |
505 void CSTSSignatureService::Complete(TInt aError) |
543 void CSTSSignatureService::Complete(TInt aError) |
506 { |
544 { |
|
545 LOG(ESATSA, EInfo, "+ CSTSSignatureService::Complete"); |
507 if (KErrNone == aError) |
546 if (KErrNone == aError) |
508 { |
547 { |
509 iState = EReady; |
548 iState = EReady; |
510 } |
549 } |
511 else |
550 else |
512 { |
551 { |
513 iState = EERROR; |
552 iState = EERROR; |
514 iError = aError; |
553 iError = aError; |
515 } |
554 } |
516 iWait->AsyncStop(); |
555 iWait->AsyncStop(); |
517 |
556 LOG(ESATSA, EInfo, "-- ret CSTSSignatureService::Complete"); |
518 } |
557 } |
519 |
558 |
520 // ----------------------------------------------------------------------------- |
559 // ----------------------------------------------------------------------------- |
521 // CSTSSignatureService::WaitForCompletionL() |
560 // CSTSSignatureService::WaitForCompletionL() |
522 // Wait for completion, leave on error |
561 // Wait for completion, leave on error |
523 // ----------------------------------------------------------------------------- |
562 // ----------------------------------------------------------------------------- |
524 // |
563 // |
525 void CSTSSignatureService::WaitForCompletionL() |
564 void CSTSSignatureService::WaitForCompletionL() |
526 { |
565 { |
|
566 LOG(ESATSA, EInfo, "+ CSTSSignatureService::WaitForCompletionL"); |
527 SetActive(); |
567 SetActive(); |
528 iWait->Start(); |
568 iWait->Start(); |
529 if (iState != EReady) |
569 if (iState != EReady) |
530 { |
570 { |
531 // we need to be ready for the next request |
571 // we need to be ready for the next request |
532 iState = EReady; |
572 iState = EReady; |
|
573 |
533 User::Leave(iError); |
574 User::Leave(iError); |
534 } |
575 } |
|
576 LOG(ESATSA, EInfo, "- ret CSTSSignatureService::WaitForCompletionL"); |
535 } |
577 } |
536 |
578 |
537 // ----------------------------------------------------------------------------- |
579 // ----------------------------------------------------------------------------- |
538 // CSTSSignatureService::CreateSignatureL() |
580 // CSTSSignatureService::CreateSignatureL() |
539 // Creates the signature |
581 // Creates the signature |
540 // ----------------------------------------------------------------------------- |
582 // ----------------------------------------------------------------------------- |
541 // |
583 // |
542 HBufC8* CSTSSignatureService::CreateSignatureL(const CDesCArray& aCaNames, |
584 HBufC8* CSTSSignatureService::CreateSignatureL(const CDesCArray& aCaNames, |
543 const TKeyUsageX509 aUsage, const TDesC& aSecurityElementPrompt) |
585 const TKeyUsageX509 aUsage, const TDesC& aSecurityElementPrompt) |
544 { |
586 { |
|
587 LOG(ESATSA, EInfo, "+ CSTSSignatureService::CreateSignatureL"); |
545 HBufC* sePrompt = NULL; |
588 HBufC* sePrompt = NULL; |
546 if (aSecurityElementPrompt != KNullDesC()) |
589 if (aSecurityElementPrompt != KNullDesC()) |
547 { |
590 { |
548 sePrompt = aSecurityElementPrompt.AllocL(); |
591 sePrompt = aSecurityElementPrompt.AllocL(); |
549 } |
592 } |
550 delete iSecurityElementPrompt; |
593 delete iSecurityElementPrompt; |
551 iSecurityElementPrompt = sePrompt; |
594 iSecurityElementPrompt = sePrompt; |
|
595 LOG(ESATSA, EInfo, "CSTSSignatureService::CreateSignatureL: call findcertificates"); |
552 FindCertificatesL(aCaNames, aUsage); |
596 FindCertificatesL(aCaNames, aUsage); |
|
597 LOG(ESATSA, EInfo, "CSTSSignatureService::CreateSignatureL: After call to findcertificates"); |
553 WaitForCompletionL(); |
598 WaitForCompletionL(); |
|
599 LOG(ESATSA, EInfo, "CSTSSignatureService::CreateSignatureL: call WaitForCompletion"); |
554 HBufC8* retVal = iSignature; |
600 HBufC8* retVal = iSignature; |
555 iSignature = NULL; |
601 iSignature = NULL; |
|
602 LOG(ESATSA, EInfo, "-- ret CSTSSignatureService::CreateSignatureL"); |
556 return retVal; |
603 return retVal; |
557 } |
604 } |
558 // ----------------------------------------------------------------------------- |
605 // ----------------------------------------------------------------------------- |
559 // CSTSSignatureService::FindCertificatesL() |
606 // CSTSSignatureService::FindCertificatesL() |
560 // Find applicable certificates |
607 // Find applicable certificates |
604 } |
652 } |
605 |
653 |
606 iState = EListing; |
654 iState = EListing; |
607 iCertStore->List(iCertInfos, *iFilter, iDERNames, iStatus); |
655 iCertStore->List(iCertInfos, *iFilter, iDERNames, iStatus); |
608 } |
656 } |
609 |
657 LOG(ESATSA, EInfo, "-- ret CSTSSignatureService::FindCertificatesL"); |
610 } |
658 } |
611 |
659 |
612 // ----------------------------------------------------------------------------- |
660 // ----------------------------------------------------------------------------- |
613 // CSTSSignatureService::HandlesFromCertInfosL() |
661 // CSTSSignatureService::HandlesFromCertInfosL() |
614 // Fills iCertificateArray from iCertInfos. |
662 // Fills iCertificateArray from iCertInfos. |
615 // ----------------------------------------------------------------------------- |
663 // ----------------------------------------------------------------------------- |
616 // |
664 // |
617 void CSTSSignatureService::HandlesFromCertInfosL() |
665 void CSTSSignatureService::HandlesFromCertInfosL() |
618 { |
666 { |
|
667 LOG(ESATSA, EInfo, "+ CSTSSignatureService::HandlesFromCertInfosL"); |
619 TInt certificateCount = iCertInfos.Count(); |
668 TInt certificateCount = iCertInfos.Count(); |
620 if (certificateCount == 0) |
669 if (certificateCount == 0) |
621 { |
670 { |
622 ELOG(ESATSA, "CSTSSignatureService::HandlesFromCertInfosL, KErrNotFound"); |
671 ELOG(ESATSA, "CSTSSignatureService::HandlesFromCertInfosL, KErrNotFound"); |
623 User::Leave(KErrNotFound); |
672 User::Leave(KErrNotFound); |
624 } |
673 } |
625 |
674 |
626 iCertificateArray.Reset(); |
675 iCertificateArray.Reset(); |
627 for (TInt i = 0; i < certificateCount; i++) |
676 for (TInt i = 0; i < certificateCount; i++) |
628 { |
677 { |
|
678 LOG(ESATSA, EInfo, "+ CSTSSignatureService::HandlesFromCertInfosL: No Certificates"); |
629 User::LeaveIfError(iCertificateArray.Append(iCertInfos[i]->Handle())); |
679 User::LeaveIfError(iCertificateArray.Append(iCertInfos[i]->Handle())); |
630 } |
680 } |
631 |
681 |
632 // next is a dialog shown depending on the authentication type |
682 // next is a dialog shown depending on the authentication type |
633 switch (iAuthType) |
683 switch (iAuthType) |
634 { |
684 { |
635 case EAuthWithoutText: |
685 case EAuthWithoutText: |
636 { |
686 { |
637 #ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS |
687 LOG(ESATSA, EInfo, "CSTSSignatureService::HandlesFromCertInfosL: case EAuthWithoutText"); |
638 iPKIDialog->UserAuthentication(iCertificateArray, iCertificateHandle, |
688 iPKIDialog->UserAuthentication(iCertificateArray, iCertificateHandle, |
639 iStatus); |
689 iStatus); |
640 #endif |
690 LOG(ESATSA, EInfo, "CSTSSignatureService::HandlesFromCertInfosL: over case EAuthWithoutText"); |
641 break; |
691 break; |
642 } |
692 } |
643 case EAuthWithText: |
693 case EAuthWithText: |
644 { |
694 { |
645 #ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS |
695 LOG(ESATSA, EInfo, "CSTSSignatureService::HandlesFromCertInfosL: case EAuthWithText"); |
646 iPKIDialog->UserAuthenticationText(*iTextToDisplay, iCertificateArray, |
696 iPKIDialog->UserAuthenticationText(*iTextToDisplay, iCertificateArray, |
647 iCertificateHandle, iStatus); |
697 iCertificateHandle, iStatus); |
648 #endif |
698 LOG(ESATSA, EInfo, "CSTSSignatureService::HandlesFromCertInfosL: over case EAuthWithText"); |
649 break; |
699 break; |
650 } |
700 } |
651 case ESignWithText: |
701 case ESignWithText: |
652 { |
702 { |
653 iDialog->SignText(*iTextToDisplay, iCertificateArray, |
703 iDialog->SignText(*iTextToDisplay, iCertificateArray, |