2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file FSecCertICertificateStore.h
19 * @brief This is the header file for the %ICertificateStore interface.
21 * This header file contains the declarations of the %ICertificateStore interface.
24 #ifndef _FSEC_CERT_ICERTIFICATE_STORE_H_
25 #define _FSEC_CERT_ICERTIFICATE_STORE_H_
27 #include <FBaseString.h>
28 #include <FBaseByteBuffer.h>
29 #include <FSecIPrivateKey.h>
30 #include <FSecCertICertificate.h>
31 #include <FSecCertICertificateSelector.h>
34 namespace Tizen { namespace Security { namespace Cert
38 * @interface ICertificateStore
39 * @brief This interface provides methods for retrieving and managing the certificates from a repository.
43 * The %ICertificateStore interface is used for retrieving and managing the certificates from a repository.
45 class _OSP_EXPORT_ ICertificateStore
50 * This is the destructor for this class.
54 virtual ~ICertificateStore(void) {}
57 * Gets the @c name of the certificate store.
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.
66 virtual result GetName(Tizen::Base::String& name) const = 0;
69 * Sets a list of certificates that match the specified selector.
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.
83 virtual result SetCertificateSelector(const Tizen::Security::Cert::ICertificateSelector& selector) = 0;
86 * Gets the count of certificates that match the specified selector.
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.
95 virtual result GetCertificateCount(int& count) const = 0;
98 * Gets the certificate that matches the specified selector.
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.
112 virtual Tizen::Security::Cert::ICertificate* GetNextCertificateN(void) const = 0;
115 * Inserts the certificate into the certificate store.
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.
132 virtual result Insert(CertificateType certificateType, const Tizen::Security::Cert::ICertificate& certificate) = 0;
135 * Updates the certificate in the certificate store.
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.
154 virtual result Update(CertificateType certificateType, const Tizen::Security::Cert::ICertificate& oldCert, const Tizen::Security::Cert::ICertificate& newCert) = 0;
157 * Removes the certificate from the certificate store.
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.
175 virtual result Remove(CertificateType certificateType, const Tizen::Security::Cert::ICertificate& certificate) = 0;
179 // This method is for internal use only. Using this method can cause behavioral, security-related,
180 // and consistency-related issues in the application.
182 // This method is reserved and may change its name at any time without prior notice.
186 virtual void ICertificateStore_Reserved1(void) {}
189 // This method is for internal use only. Using this method can cause behavioral, security-related,
190 // and consistency-related issues in the application.
192 // This method is reserved and may change its name at any time without prior notice.
196 virtual void ICertificateStore_Reserved2(void) {}
199 // This method is for internal use only. Using this method can cause behavioral, security-related,
200 // and consistency-related issues in the application.
202 // This method is reserved and may change its name at any time without prior notice.
206 virtual void ICertificateStore_Reserved3(void) {}
208 }; //ICertificateStore
210 } } } //Tizen::Security::Cert
212 #endif //_FSEC_CERT_ICERTIFICATE_STORE_H_