equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of the License "Eclipse Public License v1.0" |
5 * under the terms of the License "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
20 #include "t_input.h" |
20 #include "t_input.h" |
21 #include "t_output.h" |
21 #include "t_output.h" |
22 #include "t_certstoredefs.h" |
22 #include "t_certstoredefs.h" |
23 |
23 |
24 #include <ccertattributefilter.h> |
24 #include <ccertattributefilter.h> |
|
25 #include <x509cert.h> |
25 |
26 |
26 CCertAttributeFilter* CFilter::NewL(Output& aOut, |
27 CCertAttributeFilter* CFilter::NewL(Output& aOut, |
27 const TDesC8& aFilter) |
28 const TDesC8& aFilter) |
28 { |
29 { |
29 CFilter* self = new(ELeave) CFilter(aOut); |
30 CFilter* self = new(ELeave) CFilter(aOut); |
79 // Set subjetkeyid filter |
80 // Set subjetkeyid filter |
80 SetSubjectKeyIdFilter(Input::ParseElement(aFilter, KSubjectKeyIdStart)); |
81 SetSubjectKeyIdFilter(Input::ParseElement(aFilter, KSubjectKeyIdStart)); |
81 |
82 |
82 // Set subjetkeyid filter |
83 // Set subjetkeyid filter |
83 SetIssuerKeyIdFilter(Input::ParseElement(aFilter, KIssuerKeyIdStart)); |
84 SetIssuerKeyIdFilter(Input::ParseElement(aFilter, KIssuerKeyIdStart)); |
|
85 |
|
86 // Set subjetkeyid using the certificate details |
|
87 SetSubjectKeyIdFromCertFilterL(Input::ParseElement(aFilter, KUseSubjectKeyIdStart)); |
|
88 |
84 } |
89 } |
85 |
90 |
86 void CFilter::SetLabelFilter(const TDesC8& aLabel) |
91 void CFilter::SetLabelFilter(const TDesC8& aLabel) |
87 { |
92 { |
88 if (aLabel != KNullDesC8) |
93 if (aLabel != KNullDesC8) |
384 |
389 |
385 iFilter->SetIssuerKeyId(id); |
390 iFilter->SetIssuerKeyId(id); |
386 } |
391 } |
387 } |
392 } |
388 |
393 |
|
394 void CFilter::SetSubjectKeyIdFromCertFilterL(const TDesC8& aCertPath) |
|
395 { |
|
396 if(aCertPath != KNullDesC8) |
|
397 { |
|
398 RFs fs; |
|
399 User::LeaveIfError(fs.Connect()); |
|
400 CleanupClosePushL(fs); |
|
401 TFileName filename; |
|
402 filename.Copy(aCertPath); |
|
403 HBufC8* buf = Input::ReadFileL(filename, fs); |
|
404 CleanupStack::PushL(buf); |
|
405 CX509Certificate* cert = CX509Certificate::NewLC(buf->Des()); |
|
406 TKeyIdentifier id = cert->SubjectKeyIdL(); |
|
407 CleanupStack::PopAndDestroy(3, &fs); // buf, cert, fs |
|
408 iFilter->SetSubjectKeyId(id); |
|
409 } |
|
410 } |
|
411 |
389 CCertAttributeFilter* CFilter::iFilter = NULL; |
412 CCertAttributeFilter* CFilter::iFilter = NULL; |