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.
19 * @file FSecCertICertificateStore.h
20 * @brief This is the header file for the %ICertificateStore interface.
22 * This header file contains the declarations of the %ICertificateStore interface.
25 #ifndef _FSEC_CERT_ICERTIFICATE_STORE_H_
26 #define _FSEC_CERT_ICERTIFICATE_STORE_H_
28 #include <FBaseString.h>
29 #include <FBaseByteBuffer.h>
30 #include <FSecIPrivateKey.h>
31 #include <FSecCertICertificate.h>
32 #include <FSecCertICertificateSelector.h>
35 namespace Tizen { namespace Security { namespace Cert
39 * @interface ICertificateStore
40 * @brief This is the interface for retrieving and managing the certificates from a repository.
44 * The %ICertificateStore interface is used for retrieving and managing the certificates from a repository.
46 class _OSP_EXPORT_ ICertificateStore
51 * This is the destructor for this class.
55 virtual ~ICertificateStore(void) {}
58 * Gets the @c name of the certificate store.
62 * @return An error code
63 * @param[out] name The name of the certificate store
64 * @exception E_SUCCESS The method is successful.
65 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
67 virtual result GetName(Tizen::Base::String& name) const = 0;
70 * Sets a list of certificates that match the specified selector.
74 * @return An error code
75 * @param[in] selector A selector that defines a set of criterion for selecting certificates
76 * @exception E_SUCCESS The method is successful.
77 * @exception E_OUT_OF_MEMORY The memory is insufficient.
78 * @exception E_SYSTEM A system error has occurred. @n
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 each certificate that matches the specified selector.
102 * @return The certificates that match 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 A system error has occurred. @n
107 * The Tizen::Base::ByteBuffer operation has failed.
108 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
109 * @remarks The specific error code can be accessed using the GetLastResult() method.
111 virtual Tizen::Security::Cert::ICertificate* GetNextCertificateN(void) const = 0;
114 * Inserts the certificate into the certificate store.
118 * @return An error code
119 * @param[in] certificateType The type of the Certificate (that is, ROOT_CA, OPERATOR_DOMAIN, or TRUSTED_THIRD_PARTY_DOMAIN)
120 * @param[in] certificate A reference to the certificate to insert
121 * @exception E_SUCCESS The method is successful.
122 * @exception E_OUT_OF_MEMORY The memory is insufficient.
123 * @exception E_INVALID_ARG The specified @c certificate or the certificate data is invalid, or
124 * the specified @c certificateType is invalid.
125 * @exception E_SYSTEM A system error has occurred. @n
126 * Either the IPC operation or the file operation or the DB operation has failed.
127 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
129 virtual result Insert(CertificateType certificateType, const Tizen::Security::Cert::ICertificate& certificate) = 0;
132 * Updates the certificate in the certificate store.
136 * @return An error code
137 * @param[in] certificateType The type of the Certificate (that is, ROOT_CA, OPERATOR_DOMAIN, or TRUSTED_THIRD_PARTY_DOMAIN)
138 * @param[in] oldCert A reference to the old certificate
139 * @param[in] newCert A reference to the new certificate
140 * @exception E_SUCCESS The method is successful.
141 * @exception E_OUT_OF_MEMORY The memory is insufficient.
142 * @exception E_INVALID_ARG The specified @c certificate or the certificate data is invalid, or
143 * the specified @c certificateType is invalid.
144 * @exception E_OBJ_NOT_FOUND The certificate is not found.
145 * @exception E_SYSTEM A system error has occurred. @n
146 * Either the IPC operation or the file operation or the DB operation has failed.
147 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
149 virtual result Update(CertificateType certificateType, const Tizen::Security::Cert::ICertificate& oldCert, const Tizen::Security::Cert::ICertificate& newCert) = 0;
152 * Removes the certificate from the certificate store.
156 * @return An error code
157 * @param[in] certificateType The type of the Certificate (that is, ROOT_CA, OPERATOR_DOMAIN, or TRUSTED_THIRD_PARTY_DOMAIN)
158 * @param[in] certificate A reference to the certificate to remove
159 * @exception E_SUCCESS The method is successful.
160 * @exception E_OUT_OF_MEMORY The memory is insufficient.
161 * @exception E_INVALID_ARG The specified @c certificate or the certificate data is invalid, or
162 * the specified @c certificateType is invalid.
163 * @exception E_OBJ_NOT_FOUND The certificate is not found.
164 * @exception E_SYSTEM A system error has occurred. @n
165 * Either the IPC operation or the file operation or the DB operation has failed.
166 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
168 virtual result Remove(CertificateType certificateType, const Tizen::Security::Cert::ICertificate& certificate) = 0;
172 // This method is for internal use only. Using this method can cause behavioral, security-related,
173 // and consistency-related issues in the application.
175 // This method is reserved and may change its name at any time without prior notice.
179 virtual void ICertificateStore_Reserved1(void) {}
182 // This method is for internal use only. Using this method can cause behavioral, security-related,
183 // and consistency-related issues in the application.
185 // This method is reserved and may change its name at any time without prior notice.
189 virtual void ICertificateStore_Reserved2(void) {}
192 // This method is for internal use only. Using this method can cause behavioral, security-related,
193 // and consistency-related issues in the application.
195 // This method is reserved and may change its name at any time without prior notice.
199 virtual void ICertificateStore_Reserved3(void) {}
201 }; //ICertificateStore
203 } } } //Tizen::Security::Cert
205 #endif //_FSEC_CERT_ICERTIFICATE_STORE_H_