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 FSecCertX509CertificateStore.h
20 * @brief This is the header file for the %X509CertificateStore class.
22 * This header file contains the declarations of the %X509CertificateStore class.
24 #ifndef _FSEC_CERT_X509_CERTIFICATE_STORE_H_
25 #define _FSEC_CERT_X509_CERTIFICATE_STORE_H_
27 #include <FBaseString.h>
28 #include <FBaseByteBuffer.h>
29 #include <FSecIPrivateKey.h>
30 #include <FSecCertICertificateStore.h>
31 #include <FSecCertICertificateSelector.h>
33 namespace Tizen { namespace Security { namespace Cert
36 class _CertMgrSvcProxy;
39 * @class X509CertificateStore
40 * @brief This class is used for retrieving and managing certificates from a repository.
44 * The %X509CertificateStore class is used for retrieving and managing certificates from a repository.
46 class _OSP_EXPORT_ X509CertificateStore
47 : public virtual ICertificateStore
48 , public Tizen::Base::Object
53 * This is the default constructor for this class.
57 X509CertificateStore(void);
60 * This is the destructor for this class.
64 virtual ~X509CertificateStore(void);
67 * Gets the name of the current certificate store.
72 * @privilege %http://tizen.org/privilege/certificate.read
74 * @return An error code
75 * @param[out] name The name of the certificate store
76 * @exception E_SUCCESS The method is successful.
77 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
79 virtual result GetName(Tizen::Base::String& name) const;
82 * Sets a list of certificates that match the specified @c selector.
87 * @privilege %http://tizen.org/privilege/certificate.read
89 * @return An error code
90 * @param[in] selector A selector that defines a set of criterion for selecting certificates
91 * @exception E_SUCCESS The method is successful.
92 * @exception E_OUT_OF_MEMORY The memory is insufficient.
93 * @exception E_SYSTEM A system error has occurred. @n
94 * The IPC operation has failed.
95 * @exception E_INVALID_ARG The specified @c selector is invalid.
96 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
98 virtual result SetCertificateSelector(const Tizen::Security::Cert::ICertificateSelector& selector);
101 * Gets a count of certificates that match the specified selector.
106 * @privilege %http://tizen.org/privilege/certificate.read
108 * @return An error code
109 * @param[out] count The count of certificates
110 * @exception E_SUCCESS The method is successful.
111 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
113 virtual result GetCertificateCount(int& count) const;
116 * Gets each certificate that matches the specified selector.
121 * @privilege %http://tizen.org/privilege/certificate.read
123 * @return The certificates that matches the specified selector
124 * @exception E_SUCCESS The method is successful.
125 * @exception E_OUT_OF_MEMORY The memory is insufficient.
126 * @exception E_OBJ_NOT_FOUND The certificate is not found.
127 * @exception E_SYSTEM A system error has occurred. @n
128 * The Tizen::Base::ByteBuffer operation has failed.
129 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
131 virtual Tizen::Security::Cert::ICertificate* GetNextCertificateN(void) const;
134 * Inserts the certificate into the certificate store.
139 * @privilege %http://tizen.org/privilege/certificate.write
141 * @return An error code
142 * @param[in] certificateType The type of the Certificate (ROOT_CA, OPERATOR_DOMAIN, or TRUSTED_THIRD_PARTY_DOMAIN)
143 * @param[in] certificate A reference to the certificate to insert
144 * @exception E_SUCCESS The method is successful.
145 * @exception E_OUT_OF_MEMORY The memory is insufficient.
146 * @exception E_INVALID_ARG The specified @c certificate or the certificate data is invalid, or
147 * the specified @c certificateType is invalid.
148 * @exception E_SYSTEM A system error has occurred. @n
149 * Either the IPC operation or the file operation or the DB operation has failed.
150 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
152 virtual result Insert(CertificateType certificateType, const Tizen::Security::Cert::ICertificate& certificate);
155 * Updates the certificate in the certificate store.
160 * @privilege %http://tizen.org/privilege/certificate.write
162 * @return An error code
163 * @param[in] certificateType The type of the Certificate (ROOT_CA, OPERATOR_DOMAIN, or TRUSTED_THIRD_PARTY_DOMAIN)
164 * @param[in] oldCert A reference to the old certificate
165 * @param[in] newCert A reference to the new certificate
166 * @exception E_SUCCESS The method is successful.
167 * @exception E_OUT_OF_MEMORY The memory is insufficient.
168 * @exception E_INVALID_ARG The specified @c certificate or the certificate data is invalid, or
169 * the specified @c certificateType is invalid.
170 * @exception E_OBJ_NOT_FOUND The certificate is not found.
171 * @exception E_SYSTEM A system error has occurred. @n
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 Update(CertificateType certificateType, const Tizen::Security::Cert::ICertificate& oldCert, const Tizen::Security::Cert::ICertificate& newCert);
178 * Removes the certificate from the certificate store.
183 * @privilege %http://tizen.org/privilege/certificate.write
185 * @return An error code
186 * @param[in] certificateType The type of the Certificate (ROOT_CA, OPERATOR_DOMAIN, TRUSTED_THIRD_PARTY_DOMAIN)
187 * @param[in] certificate A reference to the certificate to remove
188 * @exception E_SUCCESS The method is successful.
189 * @exception E_OUT_OF_MEMORY The memory is insufficient.
190 * @exception E_INVALID_ARG The specified @c certificate or the certificate data is invalid, or
191 * the specified @c certificateType is invalid.
192 * @exception E_OBJ_NOT_FOUND The certificate is not found.
193 * @exception E_SYSTEM A system error has occurred. @n
194 * Either the IPC operation or the file operation or the DB operation has failed.
195 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
197 virtual result Remove(CertificateType certificateType, const Tizen::Security::Cert::ICertificate& certificate);
200 * Inserts the user certificate of PKCS 12 format into the certificate store.
205 * @privilege %http://tizen.org/privilege/certificate.write
207 * @return An error code
208 * @param[in] filePath The file path of PKCS 12 certificate to insert
209 * @param[in] password The password string to decrypt PKCS 12 certificate
210 * @exception E_SUCCESS The method is successful.
211 * @exception E_INVALID_ARG The specified @c certificate or the certificate data is invalid.
212 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
213 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
215 result InsertPkcs12(const Tizen::Base::String& filePath, const Tizen::Base::String& password);
218 X509CertificateStore(const X509CertificateStore& rhs);
219 X509CertificateStore& operator =(const X509CertificateStore& rhs);
222 class _X509CertificateStoreImpl* __pX509CertificateStoreImpl;
223 friend class _X509CertificateStoreImpl;
225 }; //X509CertificateStore
227 } } } //Tizen::Security::Cert
229 #endif //_FSEC_CERT_X509_CERTIFICATE_STORE_H_