Apply reviewed doxygen header
[platform/framework/native/appfw.git] / inc / FSecCertICertificateStore.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                        FSecCertICertificateStore.h
19  * @brief               This is the header file for the %ICertificateStore interface.
20  *
21  * This header file contains the declarations of the %ICertificateStore interface.
22  *
23  */
24 #ifndef _FSEC_CERT_ICERTIFICATE_STORE_H_
25 #define _FSEC_CERT_ICERTIFICATE_STORE_H_
26
27 #include <FBaseString.h>
28 #include <FBaseByteBuffer.h>
29 #include <FSecIPrivateKey.h>
30 #include <FSecCertICertificate.h>
31 #include <FSecCertICertificateSelector.h>
32
33
34 namespace Tizen { namespace Security { namespace Cert
35 {
36
37 /**
38  *      @interface      ICertificateStore
39  *      @brief          This interface provides methods for retrieving and managing the certificates from a repository.
40  *
41  *      @since          2.0
42  *
43  *      The %ICertificateStore interface is used for retrieving and managing the certificates from a repository.
44  */
45 class _OSP_EXPORT_ ICertificateStore
46 {
47
48 public:
49         /**
50          *      This is the destructor for this class.
51          *
52          *      @since          2.0
53          */
54         virtual ~ICertificateStore(void) {}
55
56         /**
57          *  Gets the @c name of the certificate store.
58          *
59          *      @since          2.0
60          *
61          *      @return         An error code
62          *      @param[out]     name                                    The name of the certificate store
63          *      @exception      E_SUCCESS                               The method is successful.
64          *      @exception      E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
65          */
66         virtual result GetName(Tizen::Base::String& name) const = 0;
67
68         /**
69          *      Sets a list of certificates that match the specified selector.
70          *
71          *      @since          2.0
72          *
73          *      @return         An error code
74          *      @param[in]      selector                                The selector that defines a set of criterion for selecting certificates
75          *      @exception      E_SUCCESS                               The method is successful.
76          *      @exception      E_OUT_OF_MEMORY                 The memory is insufficient.
77          *      @exception      E_SYSTEM                                Either of the following conditions has occurred:
78          *                                                                              - A system error has occurred.
79          *                                                                              - The IPC operation has failed.
80          *      @exception      E_INVALID_ARG                   The specified @c selector is invalid.
81          *      @exception      E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
82          */
83         virtual result SetCertificateSelector(const Tizen::Security::Cert::ICertificateSelector& selector) = 0;
84
85         /**
86          *      Gets the count of certificates that match the specified selector.
87          *
88          *      @since          2.0
89          *
90          *      @return         An error code
91          *      @param[out] count                                       The count of certificates
92          *      @exception      E_SUCCESS                               The method is successful.
93          *      @exception      E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
94          */
95         virtual result GetCertificateCount(int& count) const = 0;
96
97         /**
98          *      Gets the certificate that matches the specified selector.
99          *
100          *      @since          2.0
101          *
102          *      @return         The certificate that matches the specified selector
103          *      @exception      E_SUCCESS                               The method is successful.
104          *      @exception      E_OUT_OF_MEMORY                 The memory is insufficient.
105          *      @exception      E_OBJ_NOT_FOUND                 The certificate is not found.
106          *      @exception      E_SYSTEM                                Either of the following conditions has occurred:
107          *                                                                              - A system error has occurred.
108          *                                                                              - The Tizen::Base::ByteBuffer operation has failed.
109          *      @exception      E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
110          *  @remarks    The specific error code can be accessed using the GetLastResult() method.
111          */
112         virtual Tizen::Security::Cert::ICertificate* GetNextCertificateN(void) const = 0;
113
114         /**
115          *  Inserts the certificate into the certificate store.
116          *
117          *      @since          2.0
118          *
119          *      @return         An error code
120          *      @param[in]      certificateType                 The type of the Certificate (that is, @c ROOT_CA, @c OPERATOR_DOMAIN, or @c TRUSTED_THIRD_PARTY_DOMAIN)
121          *      @param[in]      certificate                             A reference to the certificate to insert
122          *      @exception      E_SUCCESS                               The method is successful.
123          *      @exception      E_OUT_OF_MEMORY                 The memory is insufficient.
124          *      @exception      E_INVALID_ARG                   Either of the following conditions has occurred:
125          *                                                                              - The specified @c certificate or the certificate data is invalid.
126          *                                                                              - The specified @c certificateType is invalid.
127          *      @exception      E_SYSTEM                                Either of the following conditions has occurred:
128          *                                                                              - A system error has occurred.
129          *                                                                              - Either the IPC operation or the file operation or the DB operation has failed.
130          *      @exception      E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
131          */
132         virtual result Insert(CertificateType certificateType, const Tizen::Security::Cert::ICertificate& certificate) = 0;
133
134         /**
135          *  Updates the certificate in the certificate store.
136          *
137          *      @since          2.0
138          *
139          *      @return         An error code
140          *      @param[in]      certificateType                 The type of the Certificate (that is, @c ROOT_CA, @c OPERATOR_DOMAIN, or @c TRUSTED_THIRD_PARTY_DOMAIN)
141          *      @param[in]      oldCert                                 A reference to the old certificate
142          *      @param[in]      newCert                                 A reference to the new certificate
143          *      @exception      E_SUCCESS                               The method is successful.
144          *      @exception      E_OUT_OF_MEMORY                 The memory is insufficient.
145          *      @exception      E_INVALID_ARG                   Either of the following conditions has occurred:
146          *                                                                              - The specified @c certificate or the certificate data is invalid.
147          *                                                                              - The specified @c certificateType is invalid.
148          *      @exception      E_OBJ_NOT_FOUND                 The certificate is not found.
149          *      @exception      E_SYSTEM                                Either of the following conditions has occurred:
150          *                                                                              - A system error has occurred.
151          *                                                                              - Either the IPC operation or the file operation or the DB operation has failed.
152          *      @exception      E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
153          */
154         virtual result Update(CertificateType certificateType, const Tizen::Security::Cert::ICertificate& oldCert, const Tizen::Security::Cert::ICertificate& newCert) = 0;
155
156         /**
157          *  Removes the certificate from the certificate store.
158          *
159          *      @since          2.0
160          *
161          *      @return         An error code
162          *      @param[in]      certificateType                 The type of the Certificate (that is, @c ROOT_CA, @c OPERATOR_DOMAIN, or @c TRUSTED_THIRD_PARTY_DOMAIN)
163          *      @param[in]      certificate                             A reference to the certificate to remove
164          *      @exception      E_SUCCESS                               The method is successful.
165          *      @exception      E_OUT_OF_MEMORY                 The memory is insufficient.
166          *      @exception      E_INVALID_ARG                   Either of the following conditions has occurred:
167          *                                                                              - The specified @c certificate or the certificate data is invalid.
168          *                                                                              - The specified @c certificateType is invalid.
169          *      @exception      E_OBJ_NOT_FOUND                 The certificate is not found.
170          *      @exception      E_SYSTEM                                Either of the following conditions has occurred:
171          *                                                                              - A system error has occurred.
172          *                                                                              - Either the IPC operation or the file operation or the DB operation has failed.
173          *      @exception      E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
174          */
175         virtual result Remove(CertificateType certificateType, const Tizen::Security::Cert::ICertificate& certificate) = 0;
176
177 protected:
178         //
179         // This method is for internal use only. Using this method can cause behavioral, security-related,
180         // and consistency-related issues in the application.
181         //
182         // This method is reserved and may change its name at any time without prior notice.
183         //
184         // @since 2.0
185         //
186         virtual void ICertificateStore_Reserved1(void) {}
187
188         //
189         // This method is for internal use only. Using this method can cause behavioral, security-related,
190         // and consistency-related issues in the application.
191         //
192         // This method is reserved and may change its name at any time without prior notice.
193         //
194         // @since 2.0
195         //
196         virtual void ICertificateStore_Reserved2(void) {}
197
198         //
199         // This method is for internal use only. Using this method can cause behavioral, security-related,
200         // and consistency-related issues in the application.
201         //
202         // This method is reserved and may change its name at any time without prior notice.
203         //
204         // @since 2.0
205         //
206         virtual void ICertificateStore_Reserved3(void) {}
207
208 }; //ICertificateStore
209
210 } } } //Tizen::Security::Cert
211
212 #endif //_FSEC_CERT_ICERTIFICATE_STORE_H_