27 #include "PolicyEngineClientServerDefs.h" |
27 #include "PolicyEngineClientServerDefs.h" |
28 #include "PolicyEngineClient.h" |
28 #include "PolicyEngineClient.h" |
29 #include "ErrorCodes.h" |
29 #include "ErrorCodes.h" |
30 #include "debug.h" |
30 #include "debug.h" |
31 |
31 |
32 |
32 #include <f32file.h> |
|
33 #include <s32file.h> |
|
34 |
|
35 const TInt KMaxLabelIdLength = 25; //take 25 from cert store or some header file |
33 |
36 |
34 |
37 |
35 // Standard server startup code |
38 // Standard server startup code |
36 // |
39 // |
37 static TInt StartServer() |
40 static TInt StartServer() |
266 |
269 |
267 //Send CertInfo to server |
270 //Send CertInfo to server |
268 return SendReceive( EAddSessionTrust, TIpcArgs( &certInfoPck)); |
271 return SendReceive( EAddSessionTrust, TIpcArgs( &certInfoPck)); |
269 } |
272 } |
270 |
273 |
|
274 EXPORT_C TInt RPolicyManagement::AddServerCert(const CX509Certificate& aCert, TDes& aLabel) |
|
275 { |
|
276 RDEBUG("RPolicyManagement::AddServerCert()" ); |
|
277 |
|
278 TPtrC8 ptr(aCert.Encoding()); |
|
279 TInt size =ptr.Length(); |
|
280 |
|
281 TBuf<1024> certData; |
|
282 certData.Copy(ptr); |
|
283 //label buffer to be written by server |
|
284 TBuf<KMaxLabelIdLength> cLabel; |
|
285 |
|
286 TIpcArgs args(&certData,size,&cLabel); |
|
287 |
|
288 TInt err = SendReceive(EServerCertAddRequest, args); |
|
289 // copy returned label |
|
290 aLabel.Append(cLabel); |
|
291 |
|
292 return err; |
|
293 |
|
294 } |
|
295 |
|
296 |
|
297 EXPORT_C TInt RPolicyManagement:: RemoveServerCert(const TDesC& aLabel) |
|
298 { |
|
299 RDEBUG("RPolicyManagement:: RemoveServerCert"); |
|
300 |
|
301 TBuf<KMaxLabelIdLength> labelData; |
|
302 labelData.Copy(aLabel); |
|
303 |
|
304 TInt err = SendReceive(EServerCertRemoveRequest, TIpcArgs(&labelData)); |
|
305 return err; |
|
306 } |
|
307 |
|
308 |
271 EXPORT_C TInt RPolicyManagement::IsAllowedServerId( const TDesC& aServerID) |
309 EXPORT_C TInt RPolicyManagement::IsAllowedServerId( const TDesC& aServerID) |
272 { |
310 { |
273 RDEBUG_2("RPolicyManagement::IsAllowedServerId( %S )", &aServerID ); |
311 RDEBUG_2("RPolicyManagement::IsAllowedServerId( %S )", &aServerID ); |
274 |
312 |
275 //Create package for data |
313 //Create package for data |