46a10378b95ef5b50f64b4230e804949568db11d
4 * @brief Interface of ca_info_t.
9 * Copyright (C) 2007 Andreas Steffen
10 * Hochschule fuer Technik Rapperswil
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
26 typedef struct ca_info_t ca_info_t
;
31 #include <credential_store.h>
37 * @brief X.509 certification authority information record
47 * @brief Compare two ca info records
49 * Comparison is done via the keyid of the ca certificate
51 * @param this first ca info object
52 * @param that second ca info objct
53 * @return TRUE if a match is found
55 bool (*equals
) (const ca_info_t
*this, const ca_info_t
* that
);
58 * @brief If the ca info record has the same name then release the name and URIs
60 * @param this ca info object
61 * @return TRUE if a match is found
63 bool (*equals_name_release_info
) (ca_info_t
*this, const char *name
);
66 * @brief Checks if a certificate was issued by this ca
68 * @param this ca info object
69 * @param cert certificate to be checked
70 * @return TRUE if the issuing ca has been found
72 bool (*is_cert_issuer
) (ca_info_t
*this, const x509_t
*cert
);
75 * @brief Checks if a crl was issued by this ca
77 * @param this ca info object
78 * @param crl crl to be checked
79 * @return TRUE if the issuing ca has been found
81 bool (*is_crl_issuer
) (ca_info_t
*this, const crl_t
*crl
);
84 * @brief Merges info from a secondary ca info object
86 * @param this primary ca info object
87 * @param that secondary ca info object
89 void (*add_info
) (ca_info_t
*this, const ca_info_t
*that
);
92 * @brief Adds a new or replaces an obsoleted CRL
94 * @param this ca info object
95 * @param crl crl to be added
97 void (*add_crl
) (ca_info_t
*this, crl_t
*crl
);
100 * @brief Does the CA have a CRL?
102 * @param this ca info object
103 * @return TRUE if crl is available
105 bool (*has_crl
) (ca_info_t
*this);
108 * @brief Does the CA have OCSP certinfos?
110 * @param this ca info object
111 * @return TRUE if there are any certinfos
113 bool (*has_certinfos
) (ca_info_t
*this);
116 * @brief Print the CA info onto the console
118 * @param this ca info object
119 * @param out output stream
120 * @param utc TRUE - utc
123 void (*list
) (ca_info_t
*this, FILE *out
, bool utc
);
126 * @brief List the CRL onto the console
128 * @param this ca info object
129 * @param out output stream
130 * @param utc TRUE - utc
133 void (*list_crl
) (ca_info_t
*this, FILE *out
, bool utc
);
136 * @brief List the OCSP certinfos onto the console
138 * @param this ca info object
139 * @param out output stream
140 * @param utc TRUE - utc
143 void (*list_certinfos
) (ca_info_t
*this, FILE *out
, bool utc
);
146 * @brief Adds a CRL URI to a list
148 * @param this ca info object
149 * @param uri crl uri to be added
151 void (*add_crluri
) (ca_info_t
*this, chunk_t uri
);
154 * @brief Adds a OCSP URI to a list
156 * @param this ca info object
157 * @param uri ocsp uri to be added
159 void (*add_ocspuri
) (ca_info_t
*this, chunk_t uri
);
162 * @brief Get the ca certificate
164 * @param this ca info object
165 * @return ca certificate
167 x509_t
* (*get_certificate
) (ca_info_t
*this);
170 * @brief Verify the status of a certificate by CRL
172 * @param this ca info object
173 * @param certinfo detailed certificate status information
174 * @param crl_dir directory where fetched crls should be stored
175 * @return certificate status
177 cert_status_t (*verify_by_crl
) (ca_info_t
*this, certinfo_t
*certinfo
, const char *crl_dir
);
180 * @brief Verify the status of a certificate by OCSP
182 * @param this ca info object
183 * @param certinfo detailed certificate status information
184 * @param credentials credential store needed for trust path verification
185 * @return certificate status
187 cert_status_t (*verify_by_ocsp
) (ca_info_t
* this, certinfo_t
* certinfo
, credential_store_t
* credentials
);
190 * @brief Purge the OCSP certinfos of a ca info record
192 * @param this ca info object
194 void (*purge_ocsp
) (ca_info_t
*this);
197 * @brief Destroys a ca info record
199 * @param this ca info to destroy
201 void (*destroy
) (ca_info_t
*this);
205 * @brief Set ca info options
207 * @param cache TRUE if crls shall be cached by storing them
208 * @param interval crl_check_interval to be set in seconds
212 void ca_info_set_options(bool cache
, u_int interval
);
215 * @brief Create a ca info record
217 * @param name name of the ca info record
218 * @param cacert path to the ca certificate
219 * @return created ca_info_t, or NULL if invalid.
223 ca_info_t
*ca_info_create(const char *name
, x509_t
*cacert
);