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 FSecCertX509CertificatePath.h
19 * @brief This is the header file for the %X509CertificatePath class.
21 * This header file contains the declarations of the %X509CertificatePath class.
23 #ifndef _FSEC_CERT_X509_CERTIFICATE_PATH_H_
24 #define _FSEC_CERT_X509_CERTIFICATE_PATH_H_
26 #include <FBaseObject.h>
27 #include <FSecCertICertificatePath.h>
28 #include <FSecCertX509Certificate.h>
31 namespace Tizen { namespace Security { namespace Cert
34 class _CertMgrSvcProxy;
37 * @class X509CertificatePath
38 * @brief This class provides methods for the certificate path.
42 * The %X509CertificatePath class provides methods for the certificate path. @n
44 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/security/certificate_namespace.htm">Certificates</a>.
46 class _OSP_EXPORT_ X509CertificatePath
47 : public virtual ICertificatePath
48 , public Tizen::Base::Object
53 * This is the default constructor for this class.
57 X509CertificatePath(void);
60 * This is the destructor for this class.
64 virtual ~X509CertificatePath(void);
67 * Gets the format name for the certificate path.
71 * @return The format of the certificate
73 virtual Tizen::Base::String GetFormat(void) const;
76 * Adds a certificate to the certificate chain.
77 * The order of certificates should be as follows: @n
78 * 1. User certificate.
79 * 2. Intermediate certificate.
80 * 3. Root CA certificate.
84 * @return An error code
85 * @param[in] certificate A reference to a certificate
86 * @exception E_SUCCESS The method is successful.
87 * @exception E_INVALID_ARG The specified @c certificate or the certificate data is invalid.
88 * @exception E_OUT_OF_MEMORY The memory is insufficient.
89 * @exception E_SYSTEM Either of the following conditions has occurred:
90 * - A system error has occurred.
91 * - The certificate link list operation has failed.
93 virtual result AddCertificate(const Tizen::Security::Cert::ICertificate& certificate);
96 * Validates the specified certificate path.
100 * @return The result of the certificate path validation
101 * @exception E_SUCCESS The method is successful.
102 * @exception E_SYSTEM Either of the following conditions has occurred:
103 * - A system error has occurred.
104 * - The certificate link list operation has failed.
105 * @remarks The specific error code can be accessed using the GetLastResult() method.
107 virtual Tizen::Security::Cert::ValidationResult Validate(void);
110 * Validates the specified certificate path.
114 * @return The result of the certificate path validation
115 * @param[in] trustAnchor The most trusted Certificate Authority (CA)
116 * @exception E_SUCCESS The method is successful.
117 * @exception E_OUT_OF_MEMORY The memory is insufficient.
118 * @exception E_INVALID_ARG The specified input parameter is invalid.
119 * @exception E_SYSTEM Either of the following conditions has occurred:
120 * - A system error has occurred.
121 * - The certificate link list operation has failed.
122 * @remarks The specific error code can be accessed using the GetLastResult() method.
124 virtual Tizen::Security::Cert::ValidationResult Validate(const Tizen::Security::Cert::ICertificate& trustAnchor);
127 * Gets the length of the certificate path.
131 * @return The length of the certificate path, @n
132 * else @c -1 if an error occurs
133 * @exception E_SUCCESS The method is successful.
134 * @exception E_SYSTEM Either of the following conditions has occurred:
135 * - A system error has occurred.
136 * - The certificate link list operation has failed.
138 virtual int GetLength(void) const;
141 * Gets the list of the certificates in this certificate path.
145 * @return A pointer to the ICertificate interface, @n
146 * else @c null if an error occurs
147 * @param[in] nth The nth certificate in the certificate path (starts from @c 0)
148 * @exception E_SUCCESS The method is successful.
149 * @exception E_OUT_OF_MEMORY The memory is insufficient.
150 * @exception E_INVALID_ARG The value of the specified @c nth is out of the valid range. @n
151 * It must be less than the value retrieved by the GetLength() method.
152 * @exception E_OBJ_NOT_FOUND The certificate is not found.
153 * @exception E_SYSTEM Either of the following conditions has occurred:
154 * - A system error has occurred.
155 * - The certificate link list operation has failed.
156 * @remarks The specific error code can be accessed using the GetLastResult() method.
158 virtual Tizen::Security::Cert::ICertificate* GetCertificateN(int nth) const;
161 * Gets the trust anchor for the certificate path.
165 * @return The root certificate, @n
166 * else @c null if an error occurs
167 * @exception E_SUCCESS The method is successful.
168 * @exception E_OUT_OF_MEMORY The memory is insufficient.
169 * @exception E_OBJ_NOT_FOUND The certificate is not found.
170 * @exception E_SYSTEM Either of the following conditions has occurred:
171 * - A system error has occurred.
172 * - The certificate link list operation has failed.
173 * - The Tizen::Base::ByteBuffer operation has failed.
174 * @remarks The specific error code can be accessed using the GetLastResult() method.
176 virtual Tizen::Security::Cert::ICertificate* GetTrustAnchorN(void) const;
179 X509CertificatePath(const X509CertificatePath& rhs);
180 X509CertificatePath& operator =(const X509CertificatePath& rhs);
185 int __trustAnchorIndex;
187 class _X509CertificatePathImpl* __pX509CertificatePathImpl;
188 friend class _X509CertificatePathImpl;
190 }; //X509CertificatePath
192 } } } //Tizen::Security::Cert
194 #endif //_FSEC_CERT_X509_CERTIFICATE_PATH_H_