fixed failing to install user certificate
[platform/framework/native/security-service.git] / inc / CertificateServiceStub.h
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 #ifndef _CERTMGR_SERVICE_STUB_H_
19 #define _CERTMGR_SERVICE_STUB_H_
20
21 #include <FBaseByteBuffer.h>
22 #include <FBaseResult.h>
23 #include <FBaseObject.h>
24 #include <FBaseString.h>
25
26 #include "FIo_IIpcServerEventListener.h"
27 #include "FIo_IpcCommonParamTraits.h"
28 #include "FSecCert_CertTypes.h"
29
30 namespace Tizen { namespace Io
31 {
32 class _IpcServer;
33 } }
34
35 namespace Tizen { namespace Security { namespace Cert
36 {
37
38 class _OSP_EXPORT_ _CertServiceStub
39         : public Tizen::Io::_IIpcServerEventListener
40         , public Tizen::Base::Object
41 {
42 public:
43         _CertServiceStub(void);
44
45         virtual ~_CertServiceStub(void);
46
47 public:
48         // __IIPcServerEventListener interfaces
49         virtual result Construct(void);
50
51         virtual void OnIpcServerStarted(const Tizen::Io::_IpcServer& server);
52
53         virtual void OnIpcServerStopped(const Tizen::Io::_IpcServer& server);
54
55         virtual void OnIpcClientConnected(const Tizen::Io::_IpcServer& server, int clientId);
56
57         virtual void OnIpcClientDisconnected(const Tizen::Io::_IpcServer& server, int clientId);
58
59         virtual void OnIpcRequestReceived(Tizen::Io::_IpcServer& server, const IPC::Message& message);
60
61         //CertService handler method
62
63         bool OnGetName(result* pRet);
64
65         bool OnCloseCertificateStore(int certificateStoreCtx, result* pRet);
66
67         bool OnOpenCertificateStoreByType(int type, int* pCount, result* pRet);
68
69         bool OnGetCertificateCount(int type, int* pCertCount, result* pRet);
70
71         bool OnGetNextCertificate(int type, int curPos, int length, Tizen::Io::_IpcBuffer* pCertBufferIpc, int* pNewPos, result* pRet);
72
73         bool OnUpdateRootCa(int type, Tizen::Io::_IpcBuffer certOldBufferIpc, Tizen::Io::_IpcBuffer certNewBufferIpc, result* pRet);
74
75         bool OnRemoveRootCa(int type, Tizen::Io::_IpcBuffer certBufferIpc, int bufLen, result* pRet);
76
77         bool OnUninstallUserRootCertificateByCertId(int certId, result* pRet);
78
79         bool OnInsertCaCertificate(int type, int format, Tizen::Io::_IpcBuffer certBuffer, long certLen, result* pRet);
80
81         bool OnInsertUserCaCertificate(int format, Tizen::Io::_IpcBuffer certBuffer, int certLen, result* pRet);
82
83         bool OnInstallUserRootCertificate(Tizen::Io::_IpcBuffer filePath, result* pRet);
84
85         bool OnInsertUserCertChainPrivateKey(Tizen::Io::_IpcBuffer certChainBufferIpc, int certSize, Tizen::Io::_IpcBuffer privateKeyBufferIpc, int userPriKeyLen, result* pRet);
86
87         bool OnInsertCertificateChainWithPrivateKey(Tizen::Io::_IpcBuffer certChainPrivateKeyBufferIpc, int certChainPrivateKeyLength, result* pRet);
88
89         bool OnInstallPkcs12Content(Tizen::Io::_IpcBuffer pkcs12FilePath, Tizen::Io::_IpcBuffer pkcs12ImportPassword, bool checkPrivilege, result* pRet);
90
91         bool OnDeleteUserCertChainByCertId(int certID, result* pRet);
92
93         bool OnGetUserCertChainByIssuerAndSubjectNameN(Tizen::Io::_IpcBuffer issuerBufferIpc, int issuerNameLen, Tizen::Io::_IpcBuffer subjectBufferIpc, int subNameLen, _CertificateListInfo* pCertList, result* pRet);
94
95         bool OnGetUserCertificateByCertIdN(int certId, int encodingType, _CertInfo* pUserCertificateList, result* pRet);
96
97         bool OnGetUserCertFieldInfoByCertId(int certId, _CertFieldInfos* pCertFieldInfos, result* pRet);
98
99         result UpdateCertStoreContext(int type);
100
101 private:
102         _CertServiceStub(const _CertServiceStub& rhs);
103
104         _CertServiceStub& operator =(const _CertServiceStub& rhs);
105
106 private:
107         Tizen::Io::_IpcServer* __pIpcServer;
108         int __context[_MAX_CERT_TYPE_COUNT];
109         int __refCount[_MAX_CERT_TYPE_COUNT];
110 }; // _CertServiceStub
111
112 } } } // Tizen::Security::Cert
113
114 #endif // _CERTMGR_SERVICE_STUB_H_