Split CXXFLAGS of the spec file for -D_SECURE_LOG (fixed)
[platform/framework/native/appfw.git] / inc / FSecCertX509CertificateStore.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 /**
18  * @file                FSecCertX509CertificateStore.h
19  * @brief               This is the header file for the %X509CertificateStore class.
20  *
21  * This header file contains the declarations of the %X509CertificateStore class.
22  */
23 #ifndef _FSEC_CERT_X509_CERTIFICATE_STORE_H_
24 #define _FSEC_CERT_X509_CERTIFICATE_STORE_H_
25
26 #include <FBaseString.h>
27 #include <FBaseByteBuffer.h>
28 #include <FSecIPrivateKey.h>
29 #include <FSecCertICertificateStore.h>
30 #include <FSecCertICertificateSelector.h>
31
32 namespace Tizen { namespace Security { namespace Cert
33 {
34
35 class _CertMgrSvcProxy;
36
37 /**
38  *      @class  X509CertificateStore
39  *      @brief  This class is used for retrieving and managing certificates from a repository.
40  *
41  *      @since  2.0
42  *
43  *      The %X509CertificateStore class is used for retrieving and managing certificates from a repository.
44  */
45 class _OSP_EXPORT_ X509CertificateStore
46         : public virtual ICertificateStore
47         , public Tizen::Base::Object
48 {
49
50 public:
51         /**
52          *      This is the default constructor for this class.
53          *
54          *      @since          2.0
55          */
56         X509CertificateStore(void);
57
58         /**
59          *      This is the destructor for this class.
60          *
61          *      @since          2.0
62          */
63         virtual ~X509CertificateStore(void);
64
65         /**
66          *      Gets the name of the current certificate store.
67          *
68          *      @since                  2.0
69          *
70          *      @privlevel              partner
71          *      @privilege              %http://tizen.org/privilege/certificate.read
72          *
73          *      @return                 An error code
74          *      @param[out]             name                            The name of the certificate store
75          *      @exception              E_SUCCESS                       The method is successful.
76          *      @exception              E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
77          */
78         virtual result GetName(Tizen::Base::String& name) const;
79
80         /**
81          *      Sets a list of certificates that match the specified @c selector.
82          *
83          *      @since                  2.0
84          *
85          *      @privlevel              partner
86          *      @privilege              %http://tizen.org/privilege/certificate.read
87          *
88          *      @return                 An error code
89          *      @param[in]              selector                        A selector that defines a set of criterion for selecting certificates
90          *      @exception              E_SUCCESS                       The method is successful.
91          *      @exception              E_OUT_OF_MEMORY         The memory is insufficient.
92          *      @exception              E_SYSTEM                        A system error has occurred. @n
93          *                                                                              The IPC operation has failed.
94          *      @exception              E_INVALID_ARG           The specified @c selector is invalid.
95          *      @exception              E_PRIVILEGE_DENIED  The application does not have the privilege to call this method.
96          */
97         virtual result SetCertificateSelector(const Tizen::Security::Cert::ICertificateSelector& selector);
98
99         /**
100          *      Gets a count of certificates that match the specified selector.
101          *
102          *      @since                  2.0
103          *
104          *      @privlevel              partner
105          *      @privilege              %http://tizen.org/privilege/certificate.read
106          *
107          *      @return                 An error code
108          *      @param[out]             count                                   The count of certificates
109          *      @exception              E_SUCCESS                               The method is successful.
110          *      @exception              E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
111          */
112         virtual result GetCertificateCount(int& count) const;
113
114         /**
115          *      Gets each certificate that matches the specified selector.
116          *
117          *      @since                  2.0
118          *
119          *      @privlevel              partner
120          *      @privilege              %http://tizen.org/privilege/certificate.read
121          *
122          *      @return                 The certificates that matches the specified selector
123          *      @exception              E_SUCCESS                       The method is successful.
124          *      @exception              E_OUT_OF_MEMORY         The memory is insufficient.
125          *      @exception              E_OBJ_NOT_FOUND         The certificate is not found.
126          *      @exception              E_SYSTEM                        A system error has occurred. @n
127          *                                                                              The Tizen::Base::ByteBuffer operation has failed.
128          *      @exception              E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
129          */
130         virtual Tizen::Security::Cert::ICertificate* GetNextCertificateN(void) const;
131
132         /**
133          *      Inserts the certificate into the certificate store.
134          *
135          *      @since                  2.0
136          *
137          *      @privlevel              partner
138          *      @privilege              %http://tizen.org/privilege/certificate.write
139          *
140          *      @return                 An error code
141          *      @param[in]              certificateType         The type of the Certificate (@c ROOT_CA, @c OPERATOR_DOMAIN, or @c TRUSTED_THIRD_PARTY_DOMAIN)
142          *      @param[in]              certificate                     A reference to the certificate to insert
143          *      @exception              E_SUCCESS                       The method is successful.
144          *      @exception              E_OUT_OF_MEMORY         The memory is insufficient.
145          *      @exception              E_INVALID_ARG           The specified @c certificate or the certificate data is invalid, or
146          *                                                                              the specified @c certificateType is invalid.
147          *      @exception              E_SYSTEM                        A system error has occurred. @n
148          *                                      Either the IPC operation or the file operation or the DB operation has failed.
149          *      @exception              E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
150          */
151         virtual result Insert(CertificateType certificateType, const Tizen::Security::Cert::ICertificate& certificate);
152
153         /**
154          *  Updates the certificate in the certificate store.
155          *
156          *      @since                  2.0
157          *
158          *      @privlevel              partner
159          *      @privilege              %http://tizen.org/privilege/certificate.write
160          *
161          *      @return                 An error code
162          *      @param[in]              certificateType         The type of the Certificate (@c ROOT_CA, @c OPERATOR_DOMAIN, or @c TRUSTED_THIRD_PARTY_DOMAIN)
163          *      @param[in]              oldCert                         A reference to the old certificate
164          *      @param[in]              newCert                         A reference to the new certificate
165          *      @exception              E_SUCCESS                       The method is successful.
166          *      @exception              E_OUT_OF_MEMORY         The memory is insufficient.
167          *      @exception              E_INVALID_ARG           The specified @c certificate or the certificate data is invalid, or
168          *                                                                              the specified @c certificateType is invalid.
169          *      @exception              E_OBJ_NOT_FOUND         The certificate is not found.
170          *      @exception              E_SYSTEM                        A system error has occurred. @n
171          *                                      Either the IPC operation or the file operation or the DB operation has failed.
172          *      @exception              E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
173          */
174         virtual result Update(CertificateType certificateType, const Tizen::Security::Cert::ICertificate& oldCert, const Tizen::Security::Cert::ICertificate& newCert);
175
176         /**
177          *  Removes the certificate from the certificate store.
178          *
179          *      @since                  2.0
180          *
181          *      @privlevel              partner
182          *      @privilege              %http://tizen.org/privilege/certificate.write
183          *
184          *      @return                 An error code
185          *      @param[in]              certificateType         The type of the Certificate (@c ROOT_CA, @c OPERATOR_DOMAIN, @c TRUSTED_THIRD_PARTY_DOMAIN)
186          *      @param[in]              certificate                     A reference to the certificate to remove
187          *      @exception              E_SUCCESS                       The method is successful.
188          *      @exception              E_OUT_OF_MEMORY         The memory is insufficient.
189          *      @exception              E_INVALID_ARG           The specified @c certificate or the certificate data is invalid, or
190          *                                                                              the specified @c certificateType is invalid.
191          *      @exception              E_OBJ_NOT_FOUND         The certificate is not found.
192          *      @exception              E_SYSTEM                        A system error has occurred. @n
193          *                                      Either the IPC operation or the file operation or the DB operation has failed.
194          *      @exception              E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
195          */
196         virtual result Remove(CertificateType certificateType, const Tizen::Security::Cert::ICertificate& certificate);
197
198         /**
199          *  Inserts the user certificate of PKCS 12 format into the certificate store.
200          *
201          *      @since 2.0
202          *
203          *      @privlevel              partner
204          *      @privilege              %http://tizen.org/privilege/certificate.write
205          *
206          *      @return                 An error code
207          *  @param[in]          filePath                        The file path of PKCS 12 certificate to insert
208          *  @param[in]          password                        The password string to decrypt PKCS 12 certificate
209          *      @exception              E_SUCCESS                       The method is successful.
210          *      @exception              E_INVALID_ARG           The specified @c certificate or the certificate data is invalid.
211          *      @exception              E_SYSTEM                        The method cannot proceed due to a severe system error.
212          *      @exception              E_DATA_NOT_FOUND        A root CA certificate does not exist.
213          *      @exception              E_PRIVILEGE_DENIED      The application does not have the privilege to call this method.
214          */
215         result InsertPkcs12(const Tizen::Base::String& filePath, const Tizen::Base::String& password);
216
217 private:
218         X509CertificateStore(const X509CertificateStore& rhs);
219         X509CertificateStore& operator =(const X509CertificateStore& rhs);
220
221 private:
222         class _X509CertificateStoreImpl* __pX509CertificateStoreImpl;
223         friend class _X509CertificateStoreImpl;
224
225 }; //X509CertificateStore
226
227 } } } //Tizen::Security::Cert
228
229 #endif //_FSEC_CERT_X509_CERTIFICATE_STORE_H_