29 #include "PolicyStorage.h" |
29 #include "PolicyStorage.h" |
30 #include <e32base.h> |
30 #include <e32base.h> |
31 #include <msvapi.h> |
31 #include <msvapi.h> |
32 #include <hbsymbianvariant.h> |
32 #include <hbsymbianvariant.h> |
33 #include <hbdevicedialogsymbian.h> |
33 #include <hbdevicedialogsymbian.h> |
34 |
34 #include <x509cert.h> |
|
35 #include <unifiedcertstore.h> |
|
36 #include <mctwritablecertstore.h> |
|
37 #include <ccertattributefilter.h> |
35 // CONSTANTS |
38 // CONSTANTS |
36 // MACROS |
39 // MACROS |
37 // DATA TYPES |
40 // DATA TYPES |
38 // FUNCTION PROTOTYPES |
41 // FUNCTION PROTOTYPES |
39 // FORWARD DECLARATIONS |
42 // FORWARD DECLARATIONS |
|
43 class CCertStore; |
|
44 class CRepository; |
40 |
45 |
41 class CDataType; |
46 class CDataType; |
42 class CAttribute; |
47 class CAttribute; |
43 class CAttributeValue; |
48 class CAttributeValue; |
44 class CTrustedSession; |
49 class CTrustedSession; |
105 void FunctionL( const TDesC8 &aFunctionId, RParameterList& aParams, CAttributeValue* aResponseElement); |
110 void FunctionL( const TDesC8 &aFunctionId, RParameterList& aParams, CAttributeValue* aResponseElement); |
106 |
111 |
107 //For management functions |
112 //For management functions |
108 void SetTargetElement( CElementBase * aElement); |
113 void SetTargetElement( CElementBase * aElement); |
109 void SetSessionTrust( CTrustedSession * aTrustedSession); |
114 void SetSessionTrust( CTrustedSession * aTrustedSession); |
|
115 |
|
116 //certificate store functions |
|
117 TInt AddCertificateToStoreL(const RMessage2& aMessage); |
|
118 //Read that counter value from central repository |
|
119 TInt GetCertCounterValue(); |
|
120 TInt RemoveCertificateFromStoreL(const RMessage2& aMessage); |
|
121 void UpdateSilentTrustServerId(); |
|
122 TInt CheckCurrentServerIdFromCR(); |
|
123 |
110 protected: |
124 protected: |
111 //From CActive |
125 //From CActive |
112 void RunL(); |
126 void RunL(); |
113 void DoCancel(); |
127 void DoCancel(); |
114 TInt RunError( TInt aError); |
128 TInt RunError( TInt aError); |
141 |
155 |
142 //RunL handling |
156 //RunL handling |
143 const RMessage2 * iMessage; |
157 const RMessage2 * iMessage; |
144 HBufC8 * iRequestBuffer; |
158 HBufC8 * iRequestBuffer; |
145 TInt iProcessorState; |
159 TInt iProcessorState; |
146 }; |
160 |
|
161 //cert store pointer |
|
162 CCertStore* iStore; |
|
163 HBufC8 *iCertBuffer; |
|
164 |
|
165 }; |
|
166 |
|
167 |
|
168 class CCertStore:public CActive |
|
169 { |
|
170 enum TCertState |
|
171 { |
|
172 EReady, |
|
173 EInitializeStore, |
|
174 EGetFPrint, |
|
175 EAddCert, |
|
176 ERemoveCert, |
|
177 EExistsInStore |
|
178 } iCertState; |
|
179 public: |
|
180 |
|
181 static CCertStore* NewL(); |
|
182 |
|
183 ~CCertStore(); |
|
184 |
|
185 |
|
186 void InitializeCertStore(); |
|
187 TInt AddCert(HBufC8 *aCertBuffer); |
|
188 void GetWritableCertStoreIndex(); |
|
189 TInt GenerateNewCertLabel(); |
|
190 void UpdateLabelCounterInCR(); |
|
191 HBufC* GetCurrentCertLabel(); |
|
192 TInt RemoveCert(const TDesC& aCertLabel); |
|
193 const TDesC8& RetrieveCertFPrint(const TDesC& aCertLabel); |
|
194 TBool CheckCertInStore( const TDesC& aLabel ); |
|
195 void WaitUntilOperationDone(); |
|
196 |
|
197 protected: |
|
198 virtual void RunL(); |
|
199 virtual void DoCancel(); |
|
200 |
|
201 private: |
|
202 CCertStore(); |
|
203 void ConstructL(); |
|
204 |
|
205 private: |
|
206 // Data |
|
207 CUnifiedCertStore* iCertStore; |
|
208 TInt iStoreIndex; |
|
209 RMPointerArray< CCTCertInfo > iCertInfoArray; |
|
210 CCTCertInfo* iCertInfoRetrieved; |
|
211 HBufC8* iCertData; |
|
212 |
|
213 // to track the counter of cert labels |
|
214 TInt iLabelCounter; |
|
215 |
|
216 //cert data from SCCM cerver |
|
217 HBufC8 *iCertBuffer; |
|
218 |
|
219 //cert Label to be used for storage and removal |
|
220 HBufC *iCertLabel; |
|
221 |
|
222 //Waits for the operation to complete. Owned. |
|
223 CActiveSchedulerWait* iWait; |
|
224 TBuf8<40> iFingerPrint; |
|
225 |
|
226 }; |
|
227 |
|
228 |
147 |
229 |
148 |
230 |
149 //Class to launch PolicyEngine Dialog |
231 //Class to launch PolicyEngine Dialog |
150 class CProcessorClient: public CActive,public MHbDeviceDialogObserver |
232 class CProcessorClient: public CActive,public MHbDeviceDialogObserver |
151 { |
233 { |