|
1 /* |
|
2 * Copyright (c) 2005-2009 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 the License "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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 /** |
|
20 @file |
|
21 @internalComponent |
|
22 */ |
|
23 |
|
24 #ifndef __SWICERTSTORE_H__ |
|
25 #define __SWICERTSTORE_H__ |
|
26 #pragma warning(disable: 4786) |
|
27 |
|
28 #include "options.h" |
|
29 #include "siscertificatechain.h" |
|
30 #include "dumpchainvaliditytool.h" |
|
31 #include "osinterface.h" |
|
32 #include <sstream> |
|
33 |
|
34 typedef std::vector <std::string> StringVector ; |
|
35 |
|
36 class SWICertStore |
|
37 { |
|
38 public: |
|
39 //contains the swicertstore's mandatory certificate signature and label information. |
|
40 struct MandatoryCertInfo |
|
41 { |
|
42 MandatoryCertInfo* iNext; |
|
43 unsigned char* iSignature; |
|
44 int iSignatureLength; |
|
45 std::string iMandatoryCertName; |
|
46 }; |
|
47 |
|
48 //contains the swicertstore root certs signature and capabilities information. |
|
49 struct CertstoreInfo |
|
50 { |
|
51 CertstoreInfo* iNextNode; |
|
52 unsigned char* iRootCertSignature; |
|
53 int iSignatureLen; |
|
54 int iRootCapabilities; |
|
55 }; |
|
56 |
|
57 public: |
|
58 |
|
59 SWICertStore(); |
|
60 |
|
61 ~SWICertStore(); |
|
62 |
|
63 /**Reads the swicertstore.cci file (containing the root certificates and their corressponding capabilities) |
|
64 and stores the certificates(PEM format) in a vector. |
|
65 */ |
|
66 void Run(const Options& aOptions); |
|
67 |
|
68 /** |
|
69 Unifies the capabilities that are granted by the root certificates which |
|
70 have validated all the certificate chains.The labels of the root certificates obtained from SISCertificateChain |
|
71 class are used to extract their corressponding capabilities. |
|
72 */ |
|
73 void UnifyCapabilitiesList(const SISCertificateChain& aChain); |
|
74 |
|
75 /** |
|
76 Returns a vector containing the Root Certificates . |
|
77 */ |
|
78 const std::vector <X509*>& GetRootCertVector() const { return iRootCertVector;} |
|
79 |
|
80 /** |
|
81 Returns the unified list of capabilities that are grabted by the root certificates |
|
82 which validates the chains. |
|
83 */ |
|
84 int GetUnifiedCapabilities() const { return iUnifiedCapabilities ;} |
|
85 |
|
86 void DisplayUnifiedCapabilities(const SISCertificateChain& aChain); |
|
87 |
|
88 const MandatoryCertInfo* GetMandatoryCertInfoList() const { return iMandatoryCertInfo ; } |
|
89 |
|
90 private: |
|
91 |
|
92 /** |
|
93 Extracts the capability value of the corressponding root certificate label passed |
|
94 as a parameter from the swicertstore.cci file . |
|
95 @param aRootLabel Root Certificate label whose capability values needs to be extracted |
|
96 from the swicertstore.cci file. |
|
97 */ |
|
98 int GetRootCertCapabilities(const std::string& aRootLabel); |
|
99 |
|
100 private: |
|
101 |
|
102 int iUnifiedCapabilities; |
|
103 MandatoryCertInfo* iMandatoryCertInfo ; |
|
104 CertstoreInfo* iCertstoreInfo; |
|
105 std::string iCertstoreFile; |
|
106 std::vector <X509*> iRootCertVector; |
|
107 }; |
|
108 |
|
109 #endif |