9b3aa9fe8604a8ca2ab31bbc10336d58ae3f38cd
[platform/framework/native/security-service.git] / src / CertificateServiceStub.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 #include <unique_ptr.h>
19 #include <stdio.h>
20 #include <string.h>
21 #include <stdlib.h>
22 #include <error.h>
23 #include <memory.h>
24 #include <new>
25 #include <sys/stat.h>
26 #include <assert.h>
27 #include <dirent.h>
28 #include <FBaseByteBuffer.h>
29 #include <FBaseResult.h>
30 #include <FBaseSysLog.h>
31 #include <FBaseRt_EventDispatcher.h>
32 #include <FIo_IpcServer.h>
33 #include <FSec_AccessController.h>
34 #include <FSec_AccessControlTypes.h>
35 #include <FApp_AppInfo.h>
36 #include <CertificateServiceStub.h>
37 #include <FSecCert_CertMgrMessages.h>
38 #include <FSec_CertServer.h>
39
40 using namespace Tizen::Base;
41 using namespace Tizen::Base::Collection;
42 using namespace Tizen::Base::Runtime;
43 using namespace Tizen::App;
44 using namespace Tizen::Io;
45
46 namespace Tizen { namespace Security { namespace Cert
47 {
48
49 int
50 GetIndexFromCertType(int certType)
51 {
52         int index = 0;
53         switch (certType)
54         {
55         case _CERT_TYPE_ROOT_CA:
56                 index = 0;
57                 break;
58
59         case _CERT_TYPE_ROOT_DOMAIN1:
60                 index = 1;
61                 break;
62
63         case _CERT_TYPE_ROOT_DOMAIN3:
64                 index = 2;
65                 break;
66
67         case _CERT_TYPE_USER_CERT:
68                 index = 3;
69                 break;
70
71         default:
72                 SysTryReturnResult(NID_SEC_CERT, false, -1, "Invalid certificate type.");
73                 break;
74         }
75
76         return index;
77 }
78
79 _CertServiceStub::_CertServiceStub(void)
80         : __pIpcServer(null)
81 {
82         memset(__context, 0, sizeof(__context));
83         memset(__refCount, 0, sizeof(__refCount));
84 }
85
86 _CertServiceStub::~_CertServiceStub(void)
87 {
88         if (__pIpcServer != null)
89         {
90                 __pIpcServer->Stop();
91                 delete __pIpcServer;
92         }
93 }
94
95 result
96 _CertServiceStub::Construct(void)
97 {
98         result r = E_SUCCESS;
99
100         std::unique_ptr< _IpcServer > pIpcServer(new (std::nothrow) _IpcServer());
101         TryReturnResult(pIpcServer != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
102
103         r = pIpcServer->Construct(L"osp.security.ipcserver.certmanager", *this);
104         TryReturnResult(!IsFailed(r), r, r, "[%s] Failed to create IPC server(%s)", GetErrorMessage(r), "CertService");
105
106         __pIpcServer = pIpcServer.release();
107
108         _CertServer::InitializeDb();
109
110         return r;
111 }
112
113 bool
114 _CertServiceStub::OnUpdateRootCa(int type, Tizen::Io::_IpcBuffer certOldBufferIpc, Tizen::Io::_IpcBuffer certNewBufferIpc, result* pRet)
115 {
116         result r = E_SUCCESS;
117
118         *pRet = _AccessController::CheckSystemPrivilege(__pIpcServer->GetClientAppId(), _PRV_CERTIFICATE_WRITE);
119         TryCatchResult(!IsFailed(*pRet), *pRet = E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");
120
121         *pRet = _CertServer::UpdateCaCertificate(static_cast< _CaCertType >(type), static_cast< char* >(certOldBufferIpc.pBuffer), certOldBufferIpc.size,
122                                                                                          static_cast< char* >(certNewBufferIpc.pBuffer), certNewBufferIpc.size);
123
124         r = UpdateCertStoreContext(_CERT_TYPE_ROOT_CA);
125         TryCatchResult(!IsFailed(r), , r, "[%s] Failed to update certificate store context.", GetErrorMessage(r), "_CertServer");
126
127 CATCH:
128         return true;
129 }
130
131 bool
132 _CertServiceStub::OnRemoveRootCa(int type, Tizen::Io::_IpcBuffer certBufferIpc, int bufLen, result* pRet)
133 {
134         result r = E_SUCCESS;
135
136         *pRet = _AccessController::CheckSystemPrivilege(__pIpcServer->GetClientAppId(), _PRV_CERTIFICATE_WRITE);
137         TryCatchResult(!IsFailed(*pRet), *pRet = E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");
138
139         *pRet = _CertServer::RemoveCaCertificate(static_cast< _CaCertType >(type), static_cast< char* >(certBufferIpc.pBuffer), bufLen);
140
141         r = UpdateCertStoreContext(_CERT_TYPE_ROOT_CA);
142         TryCatchResult(!IsFailed(r), , r, "[%s] Failed to update certificate store context.", GetErrorMessage(r), "_CertServer");
143
144 CATCH:
145         return true;
146 }
147
148 bool
149 _CertServiceStub::OnInsertCaCertificate(int type, int format, Tizen::Io::_IpcBuffer pCert, long certLen, result* pRet)
150 {
151         result r = E_SUCCESS;
152
153         *pRet = _AccessController::CheckSystemPrivilege(__pIpcServer->GetClientAppId(), _PRV_CERTIFICATE_WRITE);
154         TryCatchResult(!IsFailed(*pRet), *pRet = E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");
155
156         *pRet = _CertServer::InsertCaCertificate(static_cast< _CaCertType >(type), static_cast< _CertFormat >(format), static_cast< byte* >(pCert.pBuffer), certLen);
157
158         r = UpdateCertStoreContext(type);
159         TryCatchResult(!IsFailed(r), , r, "[%s] Failed to update certificate store context.", GetErrorMessage(r), "_CertServer");
160
161 CATCH:
162         return true;
163 }
164
165 bool
166 _CertServiceStub::OnInsertUserCaCertificate(int format, Tizen::Io::_IpcBuffer pCert, int certLen, result* pRet)
167 {
168         *pRet = _CertServer::InsertUserCaCertificate(static_cast< _CertFormat >(format), static_cast< char* >(pCert.pBuffer), certLen);
169
170         return true;
171 }
172
173 bool
174 _CertServiceStub::OnInstallUserRootCertificate(Tizen::Io::_IpcBuffer filePath, result* pRet)
175 {
176         *pRet = _CertServer::InsertUserCaCertificate(static_cast< byte* >(filePath.pBuffer));
177
178         return true;
179 }
180
181 //User Certificate APIs
182 bool
183 _CertServiceStub::OnInsertUserCertChainPrivateKey(Tizen::Io::_IpcBuffer certChainBufferIpc, int certSize, Tizen::Io::_IpcBuffer privateKeyBufferIpc, int userPriKeyLen, result* pRet)
184 {
185         result r = E_SUCCESS;
186
187         *pRet = _AccessController::CheckSystemPrivilege(__pIpcServer->GetClientAppId(), _PRV_CERTIFICATE_WRITE);
188         TryCatchResult(!IsFailed(*pRet), *pRet = E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");
189
190         *pRet = _CertServer::InsertUserCertChainPrivateKey(static_cast< char* >(certChainBufferIpc.pBuffer), certSize, static_cast< char* >(privateKeyBufferIpc.pBuffer), userPriKeyLen);
191
192         r = UpdateCertStoreContext(_CERT_TYPE_USER_CERT);
193         TryCatchResult(!IsFailed(r), , r, "[%s] Failed to update certificate store context.", GetErrorMessage(r), "_CertServer");
194
195 CATCH:
196         return true;
197 }
198
199 bool
200 _CertServiceStub::OnInsertCertificateChainWithPrivateKey(Tizen::Io::_IpcBuffer certChainPrivateKeyBufferIpc, int certChainPrivateKeyLength, result* pRet)
201 {
202         *pRet = _CertServer::InsertCertificateChainWithPrivateKey(static_cast< char* >(certChainPrivateKeyBufferIpc.pBuffer), certChainPrivateKeyLength);
203
204         return true;
205 }
206
207 bool
208 _CertServiceStub::OnInstallPkcs12Content(Tizen::Io::_IpcBuffer pkcs12FilePath, Tizen::Io::_IpcBuffer pkcs12ImportPassword, result* pRet)
209 {
210         result r = E_SUCCESS;
211
212         *pRet = _AccessController::CheckSystemPrivilege(__pIpcServer->GetClientAppId(), _PRV_CERTIFICATE_WRITE);
213         TryCatchResult(!IsFailed(*pRet), *pRet = E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");
214
215         *pRet = _CertServer::InsertPkcs12Content(static_cast< char* >(pkcs12FilePath.pBuffer), static_cast< char* >(pkcs12ImportPassword.pBuffer));
216
217         r = UpdateCertStoreContext(_CERT_TYPE_ROOT_CA);
218         TryCatchResult(!IsFailed(r), , r, "[%s] Failed to update certificate store context.", GetErrorMessage(r), "_CertServer");
219
220         r = UpdateCertStoreContext(_CERT_TYPE_USER_CERT);
221         TryCatchResult(!IsFailed(r), , r, "[%s] Failed to update certificate store context.", GetErrorMessage(r), "_CertServer");
222
223 CATCH:
224         return true;
225 }
226
227 bool
228 _CertServiceStub::OnDeleteUserCertChainByCertId(int certId, result* pRet)
229 {
230         result r = E_SUCCESS;
231
232         *pRet = _CertServer::RemoveUserCertChainByCertId(certId);
233
234         r = UpdateCertStoreContext(_CERT_TYPE_USER_CERT);
235         TryCatchResult(!IsFailed(r), , r, "[%s] Failed to update certificate store context.", GetErrorMessage(r), "_CertServer");
236
237 CATCH:
238         return true;
239 }
240
241 bool
242 _CertServiceStub::OnUninstallUserRootCertificateByCertId(int certId, result* pRet)
243 {
244         *pRet = _AccessController::CheckSystemPrivilege(__pIpcServer->GetClientAppId(), _PRV_CERTIFICATE_WRITE);
245         TryCatchResult(!IsFailed(*pRet), *pRet = E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");
246
247         *pRet = _CertServer::RemoveUserCaCertificateByCertId(certId);
248
249 CATCH:
250         return true;
251 }
252
253 bool
254 _CertServiceStub::OnGetUserCertChainByIssuerAndSubjectNameN(Tizen::Io::_IpcBuffer issuerBufferIpc, int issuerNameLen, Tizen::Io::_IpcBuffer subjectBufferIpc, int subNameLen, _CertificateListInfo* pCertList, result* pRet)
255 {
256         _CertificateListInfo* pCertListIpc = null;
257
258         *pRet = _CertServer::GetUserCertChainByIssuerAndSubjectNameN(static_cast< char* >(issuerBufferIpc.pBuffer), issuerNameLen, static_cast< char* >(subjectBufferIpc.pBuffer), subNameLen, pCertListIpc);
259
260         if (pCertListIpc != null)
261         {
262                 std::unique_ptr< _CertificateListInfo > pCertListAuto(pCertListIpc);
263
264                 pCertList->certFileId = pCertListIpc->certFileId;
265
266                 pCertList->format = pCertListIpc->format;
267                 pCertList->certType = pCertListIpc->certType;
268                 pCertList->length = pCertListIpc->length;
269                 pCertList->priKeyLen = pCertListIpc->priKeyLen;
270
271                 memcpy(pCertList->certificate, pCertListIpc->certificate, _MAX_CERTIFICATE_SIZE);
272                 memcpy(pCertList->privatekey, pCertListIpc->privatekey, _MAX_CERT_PRIVATE_KEY_SIZE);
273
274                 pCertList->pNext = pCertListIpc->pNext;
275         }
276         else
277         {
278                 memset(pCertList, 0, sizeof(*pCertList));
279         }
280
281         return true;
282 }
283
284 bool
285 _CertServiceStub::OnGetUserCertificateByCertIdN(int certId, int encodingType, _CertInfo* pUserCertificateList, result* pRet)
286 {
287         _CertInfo* pUserCertificateInfoIpc = null;
288
289         *pRet = _CertServer::GetUserCertificateByCertIdN(certId, static_cast< _CertEncodingType >(encodingType), pUserCertificateInfoIpc);
290
291         if (pUserCertificateInfoIpc != null)
292         {
293                 std::unique_ptr< _CertInfo > pCertInfoAuto(pUserCertificateInfoIpc);
294
295                 pUserCertificateList->certId = pUserCertificateInfoIpc->certId;
296                 pUserCertificateList->certFormat = pUserCertificateInfoIpc->certFormat;
297                 pUserCertificateList->certType = pUserCertificateInfoIpc->certType;
298                 pUserCertificateList->certLength = pUserCertificateInfoIpc->certLength;
299                 pUserCertificateList->privateKeyLen = pUserCertificateInfoIpc->privateKeyLen;
300
301                 memcpy(pUserCertificateList->certificate, pUserCertificateInfoIpc->certificate, _MAX_CERTIFICATE_SIZE);
302                 memcpy(pUserCertificateList->privatekey, pUserCertificateInfoIpc->privatekey, _MAX_CERT_PRIVATE_KEY_SIZE);
303         }
304         else
305         {
306                 memset(pUserCertificateList, 0, sizeof(*pUserCertificateList));
307         }
308         return true;
309 }
310
311 bool
312 _CertServiceStub::OnGetUserCertFieldInfoByCertId(int certId, _CertFieldInfos* pCertInfoBufferIpc, result* pRet)
313 {
314         _CertFieldInfos certInfo;
315
316         *pRet = _CertServer::GetUserCertFieldInfoByCertId(certId, &certInfo);
317
318         if (!IsFailed(*pRet))
319         {
320                 pCertInfoBufferIpc->certType = certInfo.certType;
321                 pCertInfoBufferIpc->certFileId = certInfo.certFileId;
322
323                 memcpy(pCertInfoBufferIpc->serialNo, certInfo.serialNo, _MAX_SERIAL_NUMBER_SIZE + 1);
324                 memcpy(pCertInfoBufferIpc->sigAlgorithm, certInfo.sigAlgorithm, _MAX_CERT_ALGORITHM_SIZE + 1);
325                 memcpy(pCertInfoBufferIpc->validityFrom, certInfo.validityFrom, _MAX_CERT_VALIDITY_SIZE + 1);
326                 memcpy(pCertInfoBufferIpc->validityTo, certInfo.validityTo, _MAX_CERT_VALIDITY_SIZE + 1);
327                 memcpy(pCertInfoBufferIpc->subjectName, certInfo.subjectName, _MAX_ISSUER_SUBJECT_NAME_SIZE + 1);
328                 memcpy(pCertInfoBufferIpc->issuerName, certInfo.issuerName, _MAX_ISSUER_SUBJECT_NAME_SIZE + 1);
329                 memcpy(pCertInfoBufferIpc->fingerPrint, certInfo.fingerPrint, _MAX_CERT_FINGERPRINT_SIZE + 1);
330
331                 pCertInfoBufferIpc->fingerPrintLen = certInfo.fingerPrintLen;
332
333                 memcpy(pCertInfoBufferIpc->publicKey, certInfo.publicKey, _MAX_CERT_PUBLIC_KEY_SIZE + 1);
334                 memcpy(static_cast< void* >(pCertInfoBufferIpc->certTypeFormat), static_cast< const void* >(certInfo.certTypeFormat), _MAX_CERT_TYPE_SIZE + 1);
335
336                 pCertInfoBufferIpc->certVersion = certInfo.certVersion;
337
338                 memcpy(pCertInfoBufferIpc->certTitle, certInfo.certTitle, _MAX_ISSUER_SUBJECT_NAME_SIZE + 1);
339                 memcpy(pCertInfoBufferIpc->certSubTitle, certInfo.certSubTitle, _MAX_ISSUER_SUBJECT_NAME_SIZE + 1);
340
341         }
342         else
343         {
344                 memset(pCertInfoBufferIpc, 0, sizeof(*pCertInfoBufferIpc));
345         }
346         return true;
347 }
348
349
350 bool
351 _CertServiceStub::OnGetName(result* pRet)
352 {
353         *pRet = _AccessController::CheckSystemPrivilege(__pIpcServer->GetClientAppId(), _PRV_CERTIFICATE_READ);
354         TryCatchResult(!IsFailed(*pRet), *pRet = E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");
355
356         *pRet = E_SUCCESS;
357
358 CATCH:
359         return true;
360 }
361
362 bool
363 _CertServiceStub::OnCloseCertificateStore(int type, result* pRet)
364 {
365         int index = GetIndexFromCertType(type);
366
367         *pRet = _AccessController::CheckSystemPrivilege(__pIpcServer->GetClientAppId(), _PRV_CERTIFICATE_READ);
368         TryCatchResult(!IsFailed(*pRet), *pRet = E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");
369
370         if (__refCount[index] > 0)
371         {
372                 __refCount[index] -= 1;
373
374                 if (__refCount[index] == 0 && __context[index] != 0)
375                 {
376                         *pRet = _CertServer::CloseCertificateStore(reinterpret_cast< CertificateStoreCtx >(__context[index]));
377                         __context[index] = 0;
378                 }
379         }
380
381         *pRet = E_SUCCESS;
382
383 CATCH:
384         return true;
385 }
386
387 bool
388 _CertServiceStub::OnOpenCertificateStoreByType(int type, int* pCount, result* pRet)
389 {
390         void* pCertList = null;
391         int index = GetIndexFromCertType(type);
392
393         *pRet = _AccessController::CheckSystemPrivilege(__pIpcServer->GetClientAppId(), _PRV_CERTIFICATE_READ);
394         TryCatchResult(!IsFailed(*pRet), *pRet = E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");
395
396         if (__context[index] == 0)
397         {
398                 *pCount = 0;
399                 pCertList = _CertServer::OpenCertificateStoreByType(static_cast< _CaCertType >(type), pCount);
400
401                 __context[index] = reinterpret_cast< int >(pCertList);
402         }
403         else
404         {
405                 *pCount = _CertServer::GetCertificateCount(reinterpret_cast< CertificateStoreCtx >(__context[index]));
406         }
407
408         __refCount[index] += 1;
409
410         *pRet = E_SUCCESS;
411
412 CATCH:
413         return true;
414 }
415
416 bool
417 _CertServiceStub::OnGetCertificateCount(int type, int* pCertCount, result* pRet)
418 {
419         int index = GetIndexFromCertType(type);
420
421         *pRet = _AccessController::CheckSystemPrivilege(__pIpcServer->GetClientAppId(), _PRV_CERTIFICATE_READ);
422         TryCatchResult(!IsFailed(*pRet), *pRet = E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");
423
424         *pCertCount = _CertServer::GetCertificateCount(reinterpret_cast< CertificateStoreCtx >(__context[index]));
425
426         *pRet = E_SUCCESS;
427
428 CATCH:
429         return true;
430 }
431
432 bool
433 _CertServiceStub::OnGetNextCertificate(int type, int curPos, int length, Tizen::Io::_IpcBuffer* pCertBufferIpc, int* pNewPos, result* pRet)
434 {
435         char* pBuffer = null;
436         int index = GetIndexFromCertType(type);
437
438         *pRet = _AccessController::CheckSystemPrivilege(__pIpcServer->GetClientAppId(), _PRV_CERTIFICATE_READ);
439         TryCatchResult(!IsFailed(*pRet), *pRet = E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");
440
441         pBuffer = new (std::nothrow) char[length];
442         TryCatchResult(pBuffer, *pRet = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]Allocation failed");
443
444         *pRet = _CertServer::GetNextCertificate(reinterpret_cast< CertificateStoreCtx >(__context[index]), curPos, pBuffer, &length);
445         *pNewPos = curPos;
446
447 CATCH:
448         if (!IsFailed(*pRet))
449         {
450                 pCertBufferIpc->size = length;
451                 pCertBufferIpc->pBuffer = pBuffer;
452         }
453         else
454         {
455                 pCertBufferIpc->size = 0;
456                 pCertBufferIpc->pBuffer = null;
457         }
458
459         return true;
460 }
461
462 result
463 _CertServiceStub::UpdateCertStoreContext(int type)
464 {
465         result r = E_SUCCESS;
466         result* pRet = E_SUCCESS;
467         void* pCertList = null;
468
469         int index = GetIndexFromCertType(type);
470         int* pCount = 0;
471
472         if (__refCount[index] > 0)
473         {
474                 *pRet = _CertServer::CloseCertificateStore(reinterpret_cast< CertificateStoreCtx >(__context[index]));
475                 pCertList = _CertServer::OpenCertificateStoreByType(static_cast< _CaCertType >(type), pCount);
476                 __context[index] = reinterpret_cast< int >(pCertList);
477         }
478         return r;
479 }
480
481 void
482 _CertServiceStub::OnIpcRequestReceived(_IpcServer& server, const IPC::Message& message)
483 {
484         IPC_BEGIN_MESSAGE_MAP(_CertServiceStub, message)
485         IPC_MESSAGE_HANDLER_EX(CertServer_GetName, &server, OnGetName)
486         IPC_MESSAGE_HANDLER_EX(CertServer_CloseCertificateStore, &server, OnCloseCertificateStore)
487         IPC_MESSAGE_HANDLER_EX(CertServer_OpenCertificateStoreByType, &server, OnOpenCertificateStoreByType)
488         IPC_MESSAGE_HANDLER_EX(CertServer_GetCertificateCount, &server, OnGetCertificateCount)
489         IPC_MESSAGE_HANDLER_EX(CertServer_GetNextCertificate, &server, OnGetNextCertificate)
490         IPC_MESSAGE_HANDLER_EX(CertServer_UpdateRootCa, &server, OnUpdateRootCa)
491         IPC_MESSAGE_HANDLER_EX(CertServer_RemoveRootCa, &server, OnRemoveRootCa)
492         IPC_MESSAGE_HANDLER_EX(CertServer_UninstallUserRootCertificateByCertId, &server, OnUninstallUserRootCertificateByCertId)
493         IPC_MESSAGE_HANDLER_EX(CertServer_InsertCaCertificate, &server, OnInsertCaCertificate)
494         IPC_MESSAGE_HANDLER_EX(CertServer_InsertUserCaCertificate, &server, OnInsertUserCaCertificate)
495         IPC_MESSAGE_HANDLER_EX(CertServer_InstallUserRootCertificate, &server, OnInstallUserRootCertificate)
496
497         //User Certificates API
498         IPC_MESSAGE_HANDLER_EX(CertServer_InsertUserCertChainPrivateKey, &server, OnInsertUserCertChainPrivateKey)
499         IPC_MESSAGE_HANDLER_EX(CertServer_InsertCertificateChainWithPrivateKey, &server, OnInsertCertificateChainWithPrivateKey)
500         IPC_MESSAGE_HANDLER_EX(CertServer_InstallPkcs12Content, &server, OnInstallPkcs12Content)
501         IPC_MESSAGE_HANDLER_EX(CertServer_DeleteUserCertChainByCertId, &server, OnDeleteUserCertChainByCertId)
502         IPC_MESSAGE_HANDLER_EX(CertServer_GetUserCertChainByIssuerAndSubjectNameN, &server, OnGetUserCertChainByIssuerAndSubjectNameN)
503         IPC_MESSAGE_HANDLER_EX(CertServer_GetUserCertificateByCertIdN, &server, OnGetUserCertificateByCertIdN)
504         IPC_MESSAGE_HANDLER_EX(CertServer_GetUserCertFieldInfoByCertId, &server, OnGetUserCertFieldInfoByCertId)
505
506         IPC_END_MESSAGE_MAP_EX();
507 }
508
509
510 void
511 _CertServiceStub::OnIpcServerStarted(const _IpcServer& server)
512 {
513
514 }
515
516 void
517 _CertServiceStub::OnIpcServerStopped(const _IpcServer& server)
518 {
519
520 }
521
522 void
523 _CertServiceStub::OnIpcClientConnected(const _IpcServer& server, int clientId)
524 {
525
526 }
527
528 void
529 _CertServiceStub::OnIpcClientDisconnected(const _IpcServer& server, int clientId)
530 {
531
532 }
533
534 } } }