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 is the interface 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 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.
82 virtual result SetCertificateSelector(const Tizen::Security::Cert::ICertificateSelector& selector) = 0;
85 * Gets the count of certificates that match the specified selector.
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.
94 virtual result GetCertificateCount(int& count) const = 0;
97 * Gets each certificate that matches the specified selector.
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.
110 virtual Tizen::Security::Cert::ICertificate* GetNextCertificateN(void) const = 0;
113 * Inserts the certificate into the certificate store.
117 * @return An error code
118 * @param[in] certificateType The type of the Certificate (that is, ROOT_CA, OPERATOR_DOMAIN, or 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.
128 virtual result Insert(CertificateType certificateType, const Tizen::Security::Cert::ICertificate& certificate) = 0;
131 * Updates the certificate in the certificate store.
135 * @return An error code
136 * @param[in] certificateType The type of the Certificate (that is, ROOT_CA, OPERATOR_DOMAIN, or 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.
148 virtual result Update(CertificateType certificateType, const Tizen::Security::Cert::ICertificate& oldCert, const Tizen::Security::Cert::ICertificate& newCert) = 0;
151 * Removes the certificate from the certificate store.
155 * @return An error code
156 * @param[in] certificateType The type of the Certificate (that is, ROOT_CA, OPERATOR_DOMAIN, or 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.
167 virtual result Remove(CertificateType certificateType, const Tizen::Security::Cert::ICertificate& certificate) = 0;
171 // This method is for internal use only. Using this method can cause behavioral, security-related,
172 // and consistency-related issues in the application.
174 // This method is reserved and may change its name at any time without prior notice.
178 virtual void ICertificateStore_Reserved1(void) {}
181 // This method is for internal use only. Using this method can cause behavioral, security-related,
182 // and consistency-related issues in the application.
184 // This method is reserved and may change its name at any time without prior notice.
188 virtual void ICertificateStore_Reserved2(void) {}
191 // This method is for internal use only. Using this method can cause behavioral, security-related,
192 // and consistency-related issues in the application.
194 // This method is reserved and may change its name at any time without prior notice.
198 virtual void ICertificateStore_Reserved3(void) {}
200 }; //ICertificateStore
202 } } } //Tizen::Security::Cert
204 #endif //_FSEC_CERT_ICERTIFICATE_STORE_H_