2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
20 * @file FSecCertICertificateStore.h
21 * @brief This is the header file for the %ICertificateStore interface.
23 * This header file contains the declarations of the %ICertificateStore interface.
27 #ifndef _FSEC_CERT_ICERTIFICATE_STORE_H_
28 #define _FSEC_CERT_ICERTIFICATE_STORE_H_
30 #include <FBaseString.h>
31 #include <FBaseByteBuffer.h>
32 #include <FSecIPrivateKey.h>
33 #include <FSecCertICertificate.h>
34 #include <FSecCertICertificateSelector.h>
37 namespace Tizen { namespace Security { namespace Cert
42 * @interface ICertificateStore
43 * @brief This is the interface for retrieving and managing the certificates from a repository.
49 * The %ICertificateStore interface is used for retrieving and managing the certificates from a repository.
52 class _OSP_EXPORT_ ICertificateStore
57 * This is the destructor for this class.
61 virtual ~ICertificateStore(void) {}
64 * Gets the @c name of the certificate store.
68 * @return An error code
69 * @param[out] name The name of the certificate store
70 * @exception E_SUCCESS The method is successful.
71 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
73 virtual result GetName(Tizen::Base::String& name) const = 0;
76 * Sets a list of certificates that match the specified selector.
80 * @return An error code
81 * @param[in] selector A selector that defines a set of criterion for selecting certificates
82 * @exception E_SUCCESS The method is successful.
83 * @exception E_OUT_OF_MEMORY The memory is insufficient.
84 * @exception E_SYSTEM A system error has occurred. @n
85 * The IPC operation has failed.
86 * @exception E_INVALID_ARG The specified @c selector is invalid.
87 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
89 virtual result SetCertificateSelector(const Tizen::Security::Cert::ICertificateSelector& selector) = 0;
92 * Gets the count of certificates that match the specified selector.
96 * @return An error code
97 * @param[out] count The count of certificates
98 * @exception E_SUCCESS The method is successful.
99 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
101 virtual result GetCertificateCount(int& count) const = 0;
104 * Gets each certificate that matches the specified selector.
108 * @return The certificates that match the specified selector
109 * @exception E_SUCCESS The method is successful.
110 * @exception E_OUT_OF_MEMORY The memory is insufficient.
111 * @exception E_OBJ_NOT_FOUND The certificate is not found.
112 * @exception E_SYSTEM A system error has occurred. @n
113 * The Tizen::Base::ByteBuffer operation has failed.
114 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
115 * @remarks The specific error code can be accessed using the GetLastResult() method.
117 virtual Tizen::Security::Cert::ICertificate* GetNextCertificateN(void) const = 0;
120 * Inserts the certificate into the certificate store.
124 * @return An error code
125 * @param[in] certificateType The type of the Certificate (that is, ROOT_CA, OPERATOR_DOMAIN, or TRUSTED_THIRD_PARTY_DOMAIN)
126 * @param[in] certificate A reference to the certificate to insert
127 * @exception E_SUCCESS The method is successful.
128 * @exception E_OUT_OF_MEMORY The memory is insufficient.
129 * @exception E_INVALID_ARG The specified @c certificate or the certificate data is invalid, or
130 * the specified @c certificateType is invalid.
131 * @exception E_SYSTEM A system error has occurred. @n
132 * Either the IPC operation or the file operation or the DB operation has failed.
133 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
135 virtual result Insert(CertificateType certificateType, const Tizen::Security::Cert::ICertificate& certificate) = 0;
138 * Updates the certificate in the certificate store.
142 * @return An error code
143 * @param[in] certificateType The type of the Certificate (that is, ROOT_CA, OPERATOR_DOMAIN, or TRUSTED_THIRD_PARTY_DOMAIN)
144 * @param[in] oldCert A reference to the old certificate
145 * @param[in] newCert A reference to the new certificate
146 * @exception E_SUCCESS The method is successful.
147 * @exception E_OUT_OF_MEMORY The memory is insufficient.
148 * @exception E_INVALID_ARG The specified @c certificate or the certificate data is invalid, or
149 * the specified @c certificateType is invalid.
150 * @exception E_OBJ_NOT_FOUND The certificate is not found.
151 * @exception E_SYSTEM A system error has occurred. @n
152 * Either the IPC operation or the file operation or the DB operation has failed.
153 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
155 virtual result Update(CertificateType certificateType, const Tizen::Security::Cert::ICertificate& oldCert, const Tizen::Security::Cert::ICertificate& newCert) = 0;
158 * Removes the certificate from the certificate store.
162 * @return An error code
163 * @param[in] certificateType The type of the Certificate (that is, ROOT_CA, OPERATOR_DOMAIN, or TRUSTED_THIRD_PARTY_DOMAIN)
164 * @param[in] certificate A reference to the certificate to remove
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.
174 virtual result Remove(CertificateType certificateType, const Tizen::Security::Cert::ICertificate& certificate) = 0;
178 // This method is for internal use only. Using this method can cause behavioral, security-related,
179 // and consistency-related issues in the application.
181 // This method is reserved and may change its name at any time without prior notice.
185 virtual void ICertificateStore_Reserved1(void) {}
188 // This method is for internal use only. Using this method can cause behavioral, security-related,
189 // and consistency-related issues in the application.
191 // This method is reserved and may change its name at any time without prior notice.
195 virtual void ICertificateStore_Reserved2(void) {}
198 // This method is for internal use only. Using this method can cause behavioral, security-related,
199 // and consistency-related issues in the application.
201 // This method is reserved and may change its name at any time without prior notice.
205 virtual void ICertificateStore_Reserved3(void) {}
207 }; //ICertificateStore
209 } } } //Tizen::Security::Cert
211 #endif //_FSEC_CERT_ICERTIFICATE_STORE_H_