8b1bd3d717dcb94cd1105fad34f05d5670afd4ed
[strongswan.git] / src / libstrongswan / crypto / ca.h
1 /**
2 * @file ca.h
3 *
4 * @brief Interface of ca_info_t.
5 *
6 */
7
8 /*
9 * Copyright (C) 2007 Andreas Steffen
10 * Hochschule fuer Technik Rapperswil
11 *
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>.
16 *
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
20 * for more details.
21 */
22
23 #ifndef CA_H_
24 #define CA_H_
25
26 typedef struct ca_info_t ca_info_t;
27
28 #include <library.h>
29 #include <chunk.h>
30
31 #include "x509.h"
32
33 /**
34 * @brief X.509 certification authority information record
35 *
36 * @b Constructors:
37 * - ca_info_create()
38 *
39 * @ingroup transforms
40 */
41 struct ca_info_t {
42
43 /**
44 * @brief Compare two ca info records
45 *
46 * Comparison is doen via the keyid of the ca certificate
47 *
48 * @param this first ca info object
49 * @param that second ca info objct
50 * @return TRUE if a match is found
51 */
52 bool (*equals) (const ca_info_t *this, const ca_info_t* that);
53
54 /**
55 * @brief Checks if the ca info record has the same name
56 *
57 * @param this ca info object
58 * @return TRUE if a match is found
59 */
60 bool (*equals_name) (const ca_info_t *this, const char *name);
61
62 /**
63 * @brief Merges info from a secondary ca info object
64 *
65 * @param this primary ca info object
66 * @param that secondary ca info object
67 */
68 void (*add_info) (ca_info_t *this, const ca_info_t *that);
69
70 /**
71 * @brief Adds a CRL URI to a list
72 *
73 * @param this ca info object
74 * @param uri crl uri to be added
75 */
76 void (*add_crluri) (ca_info_t *this, chunk_t uri);
77
78 /**
79 * @brief Adds a CRL URI to a list
80 *
81 * @param this ca info object
82 * @param uri ocsp uri to be added
83 */
84 void (*add_ocspuri) (ca_info_t *this, chunk_t uri);
85
86 /**
87 * @brief Releases the name and URIs of ca info record
88 *
89 * @param this ca info to release
90 */
91 void (*release_info) (ca_info_t *this);
92
93 /**
94 * @brief Destroys a ca info record
95 *
96 * @param this ca info to destroy
97 */
98 void (*destroy) (ca_info_t *this);
99 };
100
101 /**
102 * @brief Create a ca info record
103 *
104 * @param name name of the ca info record
105 * @param cacert path to the ca certificate
106 * @return created ca_info_t, or NULL if invalid.
107 *
108 * @ingroup transforms
109 */
110 ca_info_t *ca_info_create(const char *name, const x509_t *cacert);
111
112 #endif /* CA_H_ */