Merge "[Native][25/11/2013][Add]Adding BigInteger class" into tizen
[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 is the interface 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                                A 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                                A system error has occurred. @n
78          *                                                                              The IPC operation has failed.
79          *      @exception      E_INVALID_ARG                   The specified @c selector is invalid.
80          *      @exception      E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
81          */
82         virtual result SetCertificateSelector(const Tizen::Security::Cert::ICertificateSelector& selector) = 0;
83
84         /**
85          *      Gets the count of certificates that match the specified selector.
86          *
87          *      @since          2.0
88          *
89          *      @return         An error code
90          *      @param[out] count                                       The count of certificates
91          *      @exception      E_SUCCESS                               The method is successful.
92          *      @exception      E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
93          */
94         virtual result GetCertificateCount(int& count) const = 0;
95
96         /**
97          *      Gets each certificate that matches the specified selector.
98          *
99          *      @since          2.0
100          *
101          *      @return         The certificates that match the specified selector
102          *      @exception      E_SUCCESS                               The method is successful.
103          *      @exception      E_OUT_OF_MEMORY                 The memory is insufficient.
104          *      @exception      E_OBJ_NOT_FOUND                 The certificate is not found.
105          *      @exception      E_SYSTEM                                A system error has occurred. @n
106          *                                                                              The Tizen::Base::ByteBuffer operation has failed.
107          *      @exception      E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
108          *  @remarks        The specific error code can be accessed using the GetLastResult() method.
109          */
110         virtual Tizen::Security::Cert::ICertificate* GetNextCertificateN(void) const = 0;
111
112         /**
113          *  Inserts the certificate into the certificate store.
114          *
115          *      @since          2.0
116          *
117          *      @return         An error code
118          *      @param[in]      certificateType                 The type of the Certificate (that is, @c ROOT_CA, @c OPERATOR_DOMAIN, or @c TRUSTED_THIRD_PARTY_DOMAIN)
119          *      @param[in]      certificate                             A reference to the certificate to insert
120          *      @exception      E_SUCCESS                               The method is successful.
121          *      @exception      E_OUT_OF_MEMORY                 The memory is insufficient.
122          *      @exception      E_INVALID_ARG                   The specified @c certificate or the certificate data is invalid, or
123          *                                                                              the specified @c certificateType is invalid.
124          *      @exception      E_SYSTEM                                A system error has occurred. @n
125          *                                      Either the IPC operation or the file operation or the DB operation has failed.
126          *      @exception      E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
127          */
128         virtual result Insert(CertificateType certificateType, const Tizen::Security::Cert::ICertificate& certificate) = 0;
129
130         /**
131          *  Updates the certificate in the certificate store.
132          *
133          *      @since          2.0
134          *
135          *      @return         An error code
136          *      @param[in]      certificateType                 The type of the Certificate (that is, @c ROOT_CA, @c OPERATOR_DOMAIN, or @c TRUSTED_THIRD_PARTY_DOMAIN)
137          *      @param[in]      oldCert                                 A reference to the old certificate
138          *      @param[in]      newCert                                 A reference to the new certificate
139          *      @exception      E_SUCCESS                               The method is successful.
140          *      @exception      E_OUT_OF_MEMORY                 The memory is insufficient.
141          *      @exception      E_INVALID_ARG                   The specified @c certificate or the certificate data is invalid, or
142          *                                                                                      the specified @c certificateType is invalid.
143          *      @exception      E_OBJ_NOT_FOUND                 The certificate is not found.
144          *      @exception      E_SYSTEM                                A system error has occurred. @n
145          *                                      Either the IPC operation or the file operation or the DB operation has failed.
146          *      @exception      E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
147          */
148         virtual result Update(CertificateType certificateType, const Tizen::Security::Cert::ICertificate& oldCert, const Tizen::Security::Cert::ICertificate& newCert) = 0;
149
150         /**
151          *  Removes the certificate from the certificate store.
152          *
153          *      @since          2.0
154          *
155          *      @return         An error code
156          *      @param[in]      certificateType                 The type of the Certificate (that is, @c ROOT_CA, @c OPERATOR_DOMAIN, or @c TRUSTED_THIRD_PARTY_DOMAIN)
157          *      @param[in]      certificate                             A reference to the certificate to remove
158          *      @exception      E_SUCCESS                               The method is successful.
159          *      @exception      E_OUT_OF_MEMORY                 The memory is insufficient.
160          *      @exception      E_INVALID_ARG                   The specified @c certificate or the certificate data is invalid, or
161          *                                                                                      the specified @c certificateType is invalid.
162          *      @exception      E_OBJ_NOT_FOUND                 The certificate is not found.
163          *      @exception      E_SYSTEM                                A system error has occurred. @n
164          *                                      Either the IPC operation or the file operation or the DB operation has failed.
165          *      @exception      E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
166          */
167         virtual result Remove(CertificateType certificateType, const Tizen::Security::Cert::ICertificate& certificate) = 0;
168
169 protected:
170         //
171         // This method is for internal use only. Using this method can cause behavioral, security-related,
172         // and consistency-related issues in the application.
173         //
174         // This method is reserved and may change its name at any time without prior notice.
175         //
176         // @since 2.0
177         //
178         virtual void ICertificateStore_Reserved1(void) {}
179
180         //
181         // This method is for internal use only. Using this method can cause behavioral, security-related,
182         // and consistency-related issues in the application.
183         //
184         // This method is reserved and may change its name at any time without prior notice.
185         //
186         // @since 2.0
187         //
188         virtual void ICertificateStore_Reserved2(void) {}
189
190         //
191         // This method is for internal use only. Using this method can cause behavioral, security-related,
192         // and consistency-related issues in the application.
193         //
194         // This method is reserved and may change its name at any time without prior notice.
195         //
196         // @since 2.0
197         //
198         virtual void ICertificateStore_Reserved3(void) {}
199
200 }; //ICertificateStore
201
202 } } } //Tizen::Security::Cert
203
204 #endif //_FSEC_CERT_ICERTIFICATE_STORE_H_