equal
deleted
inserted
replaced
1 /* |
1 /* |
2 Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. |
2 Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. |
3 |
3 |
4 Redistribution and use in source and binary forms, with or without |
4 Redistribution and use in source and binary forms, with or without |
5 modification, are permitted provided that the following conditions are met: |
5 modification, are permitted provided that the following conditions are met: |
6 |
6 |
7 * Redistributions of source code must retain the above copyright notice, this |
7 * Redistributions of source code must retain the above copyright notice, this |
35 |
35 |
36 #ifdef __cplusplus |
36 #ifdef __cplusplus |
37 extern "C" |
37 extern "C" |
38 { |
38 { |
39 #endif |
39 #endif |
40 int X509_add_symbian_certs(X509_STORE * store) |
40 int X509_add_symbian_certsL(X509_STORE * store) |
41 { |
41 { |
42 CActiveScheduler* activeScheduler; |
42 CActiveScheduler* activeScheduler; |
43 CActiveScheduler* CurrentActiveScheduler = CActiveScheduler::Current(); |
43 CActiveScheduler* CurrentActiveScheduler = CActiveScheduler::Current(); |
44 if(CurrentActiveScheduler == NULL) |
44 if(CurrentActiveScheduler == NULL) |
45 { |
45 { |
200 { |
200 { |
201 iState = ENoCerts; |
201 iState = ENoCerts; |
202 } |
202 } |
203 else |
203 else |
204 { |
204 { |
205 AppendCerts(); |
205 AppendCertsL(); |
206 break; |
206 break; |
207 } |
207 } |
208 |
208 |
209 case EDone: |
209 case EDone: |
210 if (iState != ENoCerts) |
210 if (iState != ENoCerts) |
211 { |
211 { |
212 ProcessCerts(); //Process the last certificate |
212 ProcessCertsL(); //Process the last certificate |
213 iCertCount = 0; |
213 iCertCount = 0; |
214 } |
214 } |
215 case ENoCerts: |
215 case ENoCerts: |
216 |
216 |
217 if(iActiveScheduler) |
217 if(iActiveScheduler) |
292 SetActive(); |
292 SetActive(); |
293 iCertStore->List(iCerts, *iCertFilter, iStatus); |
293 iCertStore->List(iCerts, *iCertFilter, iStatus); |
294 iState = EAppendCerts; |
294 iState = EAppendCerts; |
295 } |
295 } |
296 |
296 |
297 void CCertRetriever::AppendCerts() |
297 void CCertRetriever::AppendCertsL() |
298 { |
298 { |
299 if(iCertCount>0) |
299 if(iCertCount>0) |
300 ProcessCerts(); |
300 ProcessCertsL(); |
301 |
301 |
302 CCTCertInfo *cert = iCerts[iCertCount]; |
302 CCTCertInfo *cert = iCerts[iCertCount]; |
303 |
303 |
304 SetActive(); |
304 SetActive(); |
305 iStatus == KRequestPending; |
305 iStatus == KRequestPending; |
312 if(iCertCount == iCerts.Count()) |
312 if(iCertCount == iCerts.Count()) |
313 iState = EDone; |
313 iState = EDone; |
314 } |
314 } |
315 |
315 |
316 |
316 |
317 void CCertRetriever::ProcessCerts() |
317 void CCertRetriever::ProcessCertsL() |
318 { |
318 { |
319 CX509Certificate *X509Cert; |
319 CX509Certificate *X509Cert; |
320 TRAPD(error, X509Cert = CX509Certificate::NewL( iCertPtr )); |
320 TRAPD(error, X509Cert = CX509Certificate::NewL( iCertPtr )); |
321 if(error !=KErrNone) |
321 if(error !=KErrNone) |
322 return; |
322 return; |
323 |
323 |
324 CleanupStack::PushL(X509Cert); |
324 CleanupStack::PushL(X509Cert); |
325 |
325 |
326 X509* x509 = CX509_Initializer::CreateX509(X509Cert); |
326 X509* x509 = CX509_Initializer::CreateX509L(X509Cert); |
327 |
327 |
328 if(x509) |
328 if(x509) |
329 { |
329 { |
330 X509_STORE_add_cert(iStore,x509); |
330 X509_STORE_add_cert(iStore,x509); |
331 X509_free(x509); |
331 X509_free(x509); |