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
;
35 * @brief X.509 certification authority information record
45 * @brief Compare two ca info records
47 * Comparison is done via the keyid of the ca certificate
49 * @param this first ca info object
50 * @param that second ca info objct
51 * @return TRUE if a match is found
53 bool (*equals
) (const ca_info_t
*this, const ca_info_t
* that
);
56 * @brief If the ca info record has the same name then release the name and URIs
58 * @param this ca info object
59 * @return TRUE if a match is found
61 bool (*equals_name_release_info
) (ca_info_t
*this, const char *name
);
64 * @brief Checks if a certificate was issued by this ca
66 * @param this ca info object
67 * @param cert certificate to be checked
68 * @return TRUE if the issuing ca has been found
70 bool (*is_cert_issuer
) (ca_info_t
*this, const x509_t
*cert
);
73 * @brief Checks if a crl was issued by this ca
75 * @param this ca info object
76 * @param crl crl to be checked
77 * @return TRUE if the issuing ca has been found
79 bool (*is_crl_issuer
) (ca_info_t
*this, const crl_t
*crl
);
82 * @brief Merges info from a secondary ca info object
84 * @param this primary ca info object
85 * @param that secondary ca info object
87 void (*add_info
) (ca_info_t
*this, const ca_info_t
*that
);
90 * @brief Adds a new or replaces an obsoleted CRL
92 * @param this ca info object
93 * @param crl crl to be added
95 void (*add_crl
) (ca_info_t
*this, crl_t
*crl
);
98 * @brief Does the CA have a CRL?
100 * @param this ca info object
101 * @return TRUE if crl is available
103 bool (*has_crl
) (ca_info_t
*this);
106 * @brief List the CRL onto the console
108 * @param this ca info object
109 * @param utc TRUE - utc
112 void (*list_crl
) (ca_info_t
*this, FILE *out
, bool utc
);
115 * @brief Adds a CRL URI to a list
117 * @param this ca info object
118 * @param uri crl uri to be added
120 void (*add_crluri
) (ca_info_t
*this, chunk_t uri
);
123 * @brief Adds a OCSP URI to a list
125 * @param this ca info object
126 * @param uri ocsp uri to be added
128 void (*add_ocspuri
) (ca_info_t
*this, chunk_t uri
);
131 * @brief Get the ca certificate
133 * @param this ca info object
134 * @return ca certificate
136 x509_t
* (*get_certificate
) (ca_info_t
*this);
139 * @brief Verify the status of a certificate by CRL
141 * @param this ca info object
142 * @param cert certificate to be verified
143 * @param certinfo detailed certificate status information
144 * @return certificate status
146 cert_status_t (*verify_by_crl
) (ca_info_t
* this, const x509_t
* cert
, certinfo_t
* certinfo
);
149 * @brief Verify the status of a certificate by OCSP
151 * @param this ca info object
152 * @param cert certificate to be verified
153 * @param certinfo detailed certificate status information
154 * @return certificate status
156 cert_status_t (*verify_by_ocsp
) (ca_info_t
* this, const x509_t
* cert
, certinfo_t
* certinfo
);
159 * @brief Destroys a ca info record
161 * @param this ca info to destroy
163 void (*destroy
) (ca_info_t
*this);
167 * @brief Create a ca info record
169 * @param name name of the ca info record
170 * @param cacert path to the ca certificate
171 * @return created ca_info_t, or NULL if invalid.
173 * @ingroup transforms
175 ca_info_t
*ca_info_create(const char *name
, x509_t
*cacert
);