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 FSecCertX509CertificatePath.h
20 * @brief This is the header file for the %X509CertificatePath class.
22 * This header file contains the declarations of the %X509CertificatePath class.
24 #ifndef _FSEC_CERT_X509_CERTIFICATE_PATH_H_
25 #define _FSEC_CERT_X509_CERTIFICATE_PATH_H_
27 #include <FBaseObject.h>
28 #include <FSecCertICertificatePath.h>
29 #include <FSecCertX509Certificate.h>
32 namespace Tizen { namespace Security { namespace Cert
35 class _CertMgrSvcProxy;
38 * @class X509CertificatePath
39 * @brief This class provides the certificate path.
43 * The %X509CertificatePath class provides the certificate path. @n
45 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/security/certificate_namespace.htm">Certificates</a>.
47 class _OSP_EXPORT_ X509CertificatePath
48 : public virtual ICertificatePath
49 , public Tizen::Base::Object
54 * This is the default constructor for this class.
58 X509CertificatePath(void);
61 * This is the destructor for this class.
65 virtual ~X509CertificatePath(void);
68 * Gets the format name for the certificate path.
72 * @return The format of the certificate
74 virtual Tizen::Base::String GetFormat(void) const;
77 * Adds a certificate to the certificate chain.
81 * @return An error code
82 * @param[in] certificate A reference to a certificate
83 * @exception E_SUCCESS The method is successful.
84 * @exception E_INVALID_ARG The specified @c certificate or the certificate data is invalid.
85 * @exception E_OUT_OF_MEMORY The memory is insufficient.
86 * @exception E_SYSTEM A system error has occurred. @n
87 * The certificate link list operation has failed.
89 virtual result AddCertificate(const Tizen::Security::Cert::ICertificate& certificate);
92 * Validates the specified certificate path.
96 * @return The result of the certificate path validation
97 * @exception E_SUCCESS The method is successful.
98 * @exception E_SYSTEM A system error has occurred.
99 * The certificate link list operation has failed.
100 * @remarks The specific error code can be accessed using the GetLastResult() method.
102 virtual Tizen::Security::Cert::ValidationResult Validate(void);
105 * Validates the specified certificate path.
109 * @return The result of the certificate path validation
110 * @param[in] trustAnchor The most trusted Certificate Authority (CA)
111 * @exception E_SUCCESS The method is successful.
112 * @exception E_OUT_OF_MEMORY The memory is insufficient.
113 * @exception E_INVALID_ARG The specified input parameter is invalid.
114 * @exception E_SYSTEM A system error has occurred. @n
115 * The certificate link list operation has failed.
116 * @remarks The specific error code can be accessed using the GetLastResult() method.
118 virtual Tizen::Security::Cert::ValidationResult Validate(const Tizen::Security::Cert::ICertificate& trustAnchor);
121 * Gets the length of the certificate path.
125 * @return The length of the certificate path, @n
126 * else @c -1 if an error occurs
127 * @exception E_SUCCESS The method is successful.
128 * @exception E_SYSTEM A system error has occurred. @n
129 * The certificate link list operation has failed.
131 virtual int GetLength(void) const;
134 * Gets the list of the certificates in this certificate path.
138 * @return A pointer to the ICertificate interface, @n
139 * else @c null if an error occurs
140 * @param[in] nth The nth certificate in the certificate path (starts from @c 0)
141 * @exception E_SUCCESS The method is successful.
142 * @exception E_OUT_OF_MEMORY The memory is insufficient.
143 * @exception E_INVALID_ARG The value of the specified @c nth is out of the valid range. @n
144 * It must be less than GetLength().
145 * @exception E_OBJ_NOT_FOUND The certificate is not found.
146 * @exception E_SYSTEM A system error has occurred. @n
147 * The certificate link list operation has failed.
148 * @remarks The specific error code can be accessed using the GetLastResult() method.
150 virtual Tizen::Security::Cert::ICertificate* GetCertificateN(int nth) const;
153 * Gets the trust anchor for the certificate path.
157 * @return The root certificate, @n
158 * else @c null if an error occurs
159 * @exception E_SUCCESS The method is successful.
160 * @exception E_OUT_OF_MEMORY The memory is insufficient.
161 * @exception E_OBJ_NOT_FOUND The certificate is not found.
162 * @exception E_SYSTEM A system error has occurred. @n
163 * The certificate link list operation or
164 * the Tizen::Base::ByteBuffer operation has failed.
165 * @remarks The specific error code can be accessed using the GetLastResult() method.
167 virtual Tizen::Security::Cert::ICertificate* GetTrustAnchorN(void) const;
170 X509CertificatePath(const X509CertificatePath& rhs);
171 X509CertificatePath& operator =(const X509CertificatePath& rhs);
176 int __trustAnchorIndex;
178 class _X509CertificatePathImpl* __pX509CertificatePathImpl;
179 friend class _X509CertificatePathImpl;
181 }; //X509CertificatePath
183 } } } //Tizen::Security::Cert
185 #endif //_FSEC_CERT_X509_CERTIFICATE_PATH_H_