|
Evan@653
|
1 |
/** |
|
Evan@653
|
2 |
* @file certificate.h Public-Key Certificate API |
|
Evan@653
|
3 |
* @ingroup core |
|
Evan@653
|
4 |
* @see @ref certificate-signals |
|
Evan@653
|
5 |
* @since 2.2.0 |
|
Evan@653
|
6 |
*/ |
|
Evan@653
|
7 |
|
|
Evan@653
|
8 |
/* |
|
Evan@653
|
9 |
* |
|
Evan@653
|
10 |
* purple |
|
Evan@653
|
11 |
* |
|
Evan@653
|
12 |
* Purple is the legal property of its developers, whose names are too numerous |
|
Evan@653
|
13 |
* to list here. Please refer to the COPYRIGHT file distributed with this |
|
Evan@653
|
14 |
* source distribution. |
|
Evan@653
|
15 |
* |
|
Evan@653
|
16 |
* This program is free software; you can redistribute it and/or modify |
|
Evan@653
|
17 |
* it under the terms of the GNU General Public License as published by |
|
Evan@653
|
18 |
* the Free Software Foundation; either version 2 of the License, or |
|
Evan@653
|
19 |
* (at your option) any later version. |
|
Evan@653
|
20 |
* |
|
Evan@653
|
21 |
* This program is distributed in the hope that it will be useful, |
|
Evan@653
|
22 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
Evan@653
|
23 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
Evan@653
|
24 |
* GNU General Public License for more details. |
|
Evan@653
|
25 |
* |
|
Evan@653
|
26 |
* You should have received a copy of the GNU General Public License |
|
Evan@653
|
27 |
* along with this program; if not, write to the Free Software |
|
Evan@653
|
28 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
Evan@653
|
29 |
*/ |
|
Evan@653
|
30 |
|
|
Evan@653
|
31 |
#ifndef _PURPLE_CERTIFICATE_H |
|
Evan@653
|
32 |
#define _PURPLE_CERTIFICATE_H |
|
Evan@653
|
33 |
|
|
Evan@653
|
34 |
#include <time.h> |
|
Evan@653
|
35 |
|
|
Evan@653
|
36 |
#include <glib.h> |
|
Evan@653
|
37 |
|
|
Evan@653
|
38 |
#ifdef __cplusplus |
|
Evan@653
|
39 |
extern "C" { |
|
Evan@653
|
40 |
#endif /* __cplusplus */ |
|
Evan@653
|
41 |
|
|
Evan@653
|
42 |
|
|
Evan@653
|
43 |
typedef enum |
|
Evan@653
|
44 |
{ |
|
Evan@653
|
45 |
PURPLE_CERTIFICATE_INVALID = 0, |
|
Evan@653
|
46 |
PURPLE_CERTIFICATE_VALID = 1 |
|
Evan@653
|
47 |
} PurpleCertificateVerificationStatus; |
|
Evan@653
|
48 |
|
|
Evan@653
|
49 |
typedef struct _PurpleCertificate PurpleCertificate; |
|
Evan@653
|
50 |
typedef struct _PurpleCertificatePool PurpleCertificatePool; |
|
Evan@653
|
51 |
typedef struct _PurpleCertificateScheme PurpleCertificateScheme; |
|
Evan@653
|
52 |
typedef struct _PurpleCertificateVerifier PurpleCertificateVerifier; |
|
Evan@653
|
53 |
typedef struct _PurpleCertificateVerificationRequest PurpleCertificateVerificationRequest; |
|
Evan@653
|
54 |
|
|
Evan@653
|
55 |
/** |
|
Evan@653
|
56 |
* Callback function for the results of a verification check |
|
Evan@653
|
57 |
* @param st Status code |
|
Evan@653
|
58 |
* @param userdata User-defined data |
|
Evan@653
|
59 |
*/ |
|
Evan@653
|
60 |
typedef void (*PurpleCertificateVerifiedCallback) |
|
Evan@653
|
61 |
(PurpleCertificateVerificationStatus st, |
|
Evan@653
|
62 |
gpointer userdata); |
|
Evan@1427
|
63 |
|
|
Evan@653
|
64 |
/** A certificate instance |
|
Evan@653
|
65 |
* |
|
Evan@653
|
66 |
* An opaque data structure representing a single certificate under some |
|
Evan@653
|
67 |
* CertificateScheme |
|
Evan@653
|
68 |
*/ |
|
Evan@653
|
69 |
struct _PurpleCertificate |
|
Evan@653
|
70 |
{ |
|
Evan@653
|
71 |
/** Scheme this certificate is under */ |
|
Evan@653
|
72 |
PurpleCertificateScheme * scheme; |
|
Evan@653
|
73 |
/** Opaque pointer to internal data */ |
|
Evan@653
|
74 |
gpointer data; |
|
Evan@653
|
75 |
}; |
|
Evan@653
|
76 |
|
|
Evan@653
|
77 |
/** |
|
Evan@653
|
78 |
* Database for retrieval or storage of Certificates |
|
Evan@653
|
79 |
* |
|
Evan@653
|
80 |
* More or less a hash table; all lookups and writes are controlled by a string |
|
Evan@653
|
81 |
* key. |
|
Evan@653
|
82 |
*/ |
|
Evan@653
|
83 |
struct _PurpleCertificatePool |
|
Evan@653
|
84 |
{ |
|
Evan@653
|
85 |
/** Scheme this Pool operates for */ |
|
Evan@653
|
86 |
gchar *scheme_name; |
|
Evan@653
|
87 |
/** Internal name to refer to the pool by */ |
|
Evan@653
|
88 |
gchar *name; |
|
Evan@653
|
89 |
|
|
Evan@653
|
90 |
/** User-friendly name for this type |
|
Evan@653
|
91 |
* ex: N_("SSL Servers") |
|
Evan@653
|
92 |
* When this is displayed anywhere, it should be i18ned |
|
Evan@653
|
93 |
* ex: _(pool->fullname) |
|
Evan@653
|
94 |
*/ |
|
Evan@653
|
95 |
gchar *fullname; |
|
Evan@653
|
96 |
|
|
Evan@653
|
97 |
/** Internal pool data */ |
|
Evan@653
|
98 |
gpointer data; |
|
Evan@1427
|
99 |
|
|
Evan@653
|
100 |
/** |
|
Evan@653
|
101 |
* Set up the Pool's internal state |
|
Evan@653
|
102 |
* |
|
Evan@653
|
103 |
* Upon calling purple_certificate_register_pool() , this function will |
|
Evan@653
|
104 |
* be called. May be NULL. |
|
Evan@653
|
105 |
* @return TRUE if the initialization succeeded, otherwise FALSE |
|
Evan@653
|
106 |
*/ |
|
Evan@653
|
107 |
gboolean (* init)(void); |
|
Evan@653
|
108 |
|
|
Evan@653
|
109 |
/** |
|
Evan@653
|
110 |
* Uninit the Pool's internal state |
|
Evan@653
|
111 |
* |
|
Evan@653
|
112 |
* Will be called by purple_certificate_unregister_pool() . May be NULL |
|
Evan@653
|
113 |
*/ |
|
Evan@653
|
114 |
void (* uninit)(void); |
|
Evan@653
|
115 |
|
|
Evan@653
|
116 |
/** Check for presence of a certificate in the pool using unique ID */ |
|
Evan@653
|
117 |
gboolean (* cert_in_pool)(const gchar *id); |
|
Evan@653
|
118 |
/** Retrieve a PurpleCertificate from the pool */ |
|
Evan@653
|
119 |
PurpleCertificate * (* get_cert)(const gchar *id); |
|
Evan@653
|
120 |
/** Add a certificate to the pool. Must overwrite any other |
|
Evan@653
|
121 |
* certificates sharing the same ID in the pool. |
|
Evan@653
|
122 |
* @return TRUE if the operation succeeded, otherwise FALSE |
|
Evan@653
|
123 |
*/ |
|
Evan@653
|
124 |
gboolean (* put_cert)(const gchar *id, PurpleCertificate *crt); |
|
Evan@653
|
125 |
/** Delete a certificate from the pool */ |
|
Evan@653
|
126 |
gboolean (* delete_cert)(const gchar *id); |
|
Evan@653
|
127 |
|
|
Evan@653
|
128 |
/** Returns a list of IDs stored in the pool */ |
|
Evan@653
|
129 |
GList * (* get_idlist)(void); |
|
Evan@653
|
130 |
|
|
Evan@653
|
131 |
void (*_purple_reserved1)(void); |
|
Evan@653
|
132 |
void (*_purple_reserved2)(void); |
|
Evan@653
|
133 |
void (*_purple_reserved3)(void); |
|
Evan@653
|
134 |
void (*_purple_reserved4)(void); |
|
Evan@653
|
135 |
}; |
|
Evan@653
|
136 |
|
|
Evan@653
|
137 |
/** A certificate type |
|
Evan@653
|
138 |
* |
|
Evan@653
|
139 |
* A CertificateScheme must implement all of the fields in the structure, |
|
Evan@653
|
140 |
* and register it using purple_certificate_register_scheme() |
|
Evan@653
|
141 |
* |
|
Evan@653
|
142 |
* There may be only ONE CertificateScheme provided for each certificate |
|
Evan@653
|
143 |
* type, as specified by the "name" field. |
|
Evan@653
|
144 |
*/ |
|
Evan@653
|
145 |
struct _PurpleCertificateScheme |
|
Evan@653
|
146 |
{ |
|
Evan@653
|
147 |
/** Name of the certificate type |
|
Evan@653
|
148 |
* ex: "x509", "pgp", etc. |
|
Evan@653
|
149 |
* This must be globally unique - you may not register more than one |
|
Evan@653
|
150 |
* CertificateScheme of the same name at a time. |
|
Evan@653
|
151 |
*/ |
|
Evan@653
|
152 |
gchar * name; |
|
Evan@653
|
153 |
|
|
Evan@653
|
154 |
/** User-friendly name for this type |
|
Evan@653
|
155 |
* ex: N_("X.509 Certificates") |
|
Evan@653
|
156 |
* When this is displayed anywhere, it should be i18ned |
|
Evan@653
|
157 |
* ex: _(scheme->fullname) |
|
Evan@653
|
158 |
*/ |
|
Evan@653
|
159 |
gchar * fullname; |
|
Evan@653
|
160 |
|
|
Evan@653
|
161 |
/** Imports a certificate from a file |
|
Evan@653
|
162 |
* |
|
Evan@653
|
163 |
* @param filename File to import the certificate from |
|
Evan@653
|
164 |
* @return Pointer to the newly allocated Certificate struct |
|
Evan@653
|
165 |
* or NULL on failure. |
|
Evan@653
|
166 |
*/ |
|
Evan@653
|
167 |
PurpleCertificate * (* import_certificate)(const gchar * filename); |
|
Evan@653
|
168 |
|
|
Evan@653
|
169 |
/** |
|
Evan@653
|
170 |
* Exports a certificate to a file |
|
Evan@653
|
171 |
* |
|
Evan@653
|
172 |
* @param filename File to export the certificate to |
|
Evan@653
|
173 |
* @param crt Certificate to export |
|
Evan@653
|
174 |
* @return TRUE if the export succeeded, otherwise FALSE |
|
Evan@653
|
175 |
* @see purple_certificate_export() |
|
Evan@653
|
176 |
*/ |
|
Evan@653
|
177 |
gboolean (* export_certificate)(const gchar *filename, PurpleCertificate *crt); |
|
Evan@653
|
178 |
|
|
Evan@653
|
179 |
/** |
|
Evan@653
|
180 |
* Duplicates a certificate |
|
Evan@653
|
181 |
* |
|
Evan@653
|
182 |
* Certificates are generally assumed to be read-only, so feel free to |
|
Evan@653
|
183 |
* do any sort of reference-counting magic you want here. If this ever |
|
Evan@653
|
184 |
* changes, please remember to change the magic accordingly. |
|
Evan@653
|
185 |
* @return Reference to the new copy |
|
Evan@653
|
186 |
*/ |
|
Evan@653
|
187 |
PurpleCertificate * (* copy_certificate)(PurpleCertificate *crt); |
|
Evan@653
|
188 |
|
|
Evan@653
|
189 |
/** Destroys and frees a Certificate structure |
|
Evan@653
|
190 |
* |
|
Evan@653
|
191 |
* Destroys a Certificate's internal data structures and calls |
|
Evan@653
|
192 |
* free(crt) |
|
Evan@653
|
193 |
* |
|
Evan@653
|
194 |
* @param crt Certificate instance to be destroyed. It WILL NOT be |
|
Evan@653
|
195 |
* destroyed if it is not of the correct |
|
Evan@653
|
196 |
* CertificateScheme. Can be NULL |
|
Evan@653
|
197 |
*/ |
|
Evan@653
|
198 |
void (* destroy_certificate)(PurpleCertificate * crt); |
|
Evan@653
|
199 |
|
|
Evan@653
|
200 |
/** Find whether "crt" has a valid signature from issuer "issuer" |
|
Evan@653
|
201 |
* @see purple_certificate_signed_by() */ |
|
Evan@653
|
202 |
gboolean (*signed_by)(PurpleCertificate *crt, PurpleCertificate *issuer); |
|
Evan@653
|
203 |
/** |
|
Evan@653
|
204 |
* Retrieves the certificate public key fingerprint using SHA1 |
|
Evan@653
|
205 |
* |
|
Evan@653
|
206 |
* @param crt Certificate instance |
|
Evan@653
|
207 |
* @return Binary representation of SHA1 hash - must be freed using |
|
Evan@653
|
208 |
* g_byte_array_free() |
|
Evan@653
|
209 |
*/ |
|
Evan@653
|
210 |
GByteArray * (* get_fingerprint_sha1)(PurpleCertificate *crt); |
|
Evan@653
|
211 |
|
|
Evan@653
|
212 |
/** |
|
Evan@653
|
213 |
* Retrieves a unique certificate identifier |
|
Evan@653
|
214 |
* |
|
Evan@653
|
215 |
* @param crt Certificate instance |
|
Evan@653
|
216 |
* @return Newly allocated string that can be used to uniquely |
|
Evan@653
|
217 |
* identify the certificate. |
|
Evan@653
|
218 |
*/ |
|
Evan@653
|
219 |
gchar * (* get_unique_id)(PurpleCertificate *crt); |
|
Evan@653
|
220 |
|
|
Evan@653
|
221 |
/** |
|
Evan@653
|
222 |
* Retrieves a unique identifier for the certificate's issuer |
|
Evan@653
|
223 |
* |
|
Evan@653
|
224 |
* @param crt Certificate instance |
|
Evan@653
|
225 |
* @return Newly allocated string that can be used to uniquely |
|
Evan@653
|
226 |
* identify the issuer's certificate. |
|
Evan@653
|
227 |
*/ |
|
Evan@653
|
228 |
gchar * (* get_issuer_unique_id)(PurpleCertificate *crt); |
|
Evan@653
|
229 |
|
|
Evan@653
|
230 |
/** |
|
Evan@653
|
231 |
* Gets the certificate subject's name |
|
Evan@653
|
232 |
* |
|
Evan@653
|
233 |
* For X.509, this is the "Common Name" field, as we're only using it |
|
Evan@653
|
234 |
* for hostname verification at the moment |
|
Evan@653
|
235 |
* |
|
Evan@653
|
236 |
* @see purple_certificate_get_subject_name() |
|
Evan@653
|
237 |
* |
|
Evan@653
|
238 |
* @param crt Certificate instance |
|
Evan@653
|
239 |
* @return Newly allocated string with the certificate subject. |
|
Evan@653
|
240 |
*/ |
|
Evan@653
|
241 |
gchar * (* get_subject_name)(PurpleCertificate *crt); |
|
Evan@653
|
242 |
|
|
Evan@653
|
243 |
/** |
|
Evan@653
|
244 |
* Check the subject name against that on the certificate |
|
Evan@653
|
245 |
* @see purple_certificate_check_subject_name() |
|
Evan@653
|
246 |
* @return TRUE if it is a match, else FALSE |
|
Evan@653
|
247 |
*/ |
|
Evan@653
|
248 |
gboolean (* check_subject_name)(PurpleCertificate *crt, const gchar *name); |
|
Evan@653
|
249 |
|
|
Evan@653
|
250 |
/** Retrieve the certificate activation/expiration times */ |
|
Evan@653
|
251 |
gboolean (* get_times)(PurpleCertificate *crt, time_t *activation, time_t *expiration); |
|
Evan@1427
|
252 |
|
|
Evan@653
|
253 |
void (*_purple_reserved1)(void); |
|
Evan@653
|
254 |
void (*_purple_reserved2)(void); |
|
Evan@653
|
255 |
void (*_purple_reserved3)(void); |
|
Evan@653
|
256 |
void (*_purple_reserved4)(void); |
|
Evan@653
|
257 |
}; |
|
Evan@653
|
258 |
|
|
Evan@653
|
259 |
/** A set of operations used to provide logic for verifying a Certificate's |
|
Evan@653
|
260 |
* authenticity. |
|
Evan@653
|
261 |
* |
|
Evan@653
|
262 |
* A Verifier provider must fill out these fields, then register it using |
|
Evan@653
|
263 |
* purple_certificate_register_verifier() |
|
Evan@653
|
264 |
* |
|
Evan@653
|
265 |
* The (scheme_name, name) value must be unique for each Verifier - you may not |
|
Evan@653
|
266 |
* register more than one Verifier of the same name for each Scheme |
|
Evan@653
|
267 |
*/ |
|
Evan@653
|
268 |
struct _PurpleCertificateVerifier |
|
Evan@653
|
269 |
{ |
|
Evan@653
|
270 |
/** Name of the scheme this Verifier operates on |
|
Evan@653
|
271 |
* |
|
Evan@653
|
272 |
* The scheme will be looked up by name when a Request is generated |
|
Evan@653
|
273 |
* using this Verifier |
|
Evan@653
|
274 |
*/ |
|
Evan@653
|
275 |
gchar *scheme_name; |
|
Evan@653
|
276 |
|
|
Evan@653
|
277 |
/** Name of the Verifier - case insensitive */ |
|
Evan@653
|
278 |
gchar *name; |
|
Evan@1427
|
279 |
|
|
Evan@653
|
280 |
/** |
|
Evan@653
|
281 |
* Start the verification process |
|
Evan@653
|
282 |
* |
|
Evan@653
|
283 |
* To be called from purple_certificate_verify once it has |
|
Evan@653
|
284 |
* constructed the request. This will use the information in the |
|
Evan@653
|
285 |
* given VerificationRequest to check the certificate and callback |
|
Evan@653
|
286 |
* the requester with the verification results. |
|
Evan@653
|
287 |
* |
|
Evan@653
|
288 |
* @param vrq Request to process |
|
Evan@653
|
289 |
*/ |
|
Evan@653
|
290 |
void (* start_verification)(PurpleCertificateVerificationRequest *vrq); |
|
Evan@653
|
291 |
|
|
Evan@653
|
292 |
/** |
|
Evan@653
|
293 |
* Destroy a completed Request under this Verifier |
|
Evan@653
|
294 |
* The function pointed to here is only responsible for cleaning up |
|
Evan@653
|
295 |
* whatever PurpleCertificateVerificationRequest::data points to. |
|
Evan@653
|
296 |
* It should not call free(vrq) |
|
Evan@653
|
297 |
* |
|
Evan@653
|
298 |
* @param vrq Request to destroy |
|
Evan@653
|
299 |
*/ |
|
Evan@653
|
300 |
void (* destroy_request)(PurpleCertificateVerificationRequest *vrq); |
|
Evan@653
|
301 |
|
|
Evan@653
|
302 |
void (*_purple_reserved1)(void); |
|
Evan@653
|
303 |
void (*_purple_reserved2)(void); |
|
Evan@653
|
304 |
void (*_purple_reserved3)(void); |
|
Evan@653
|
305 |
void (*_purple_reserved4)(void); |
|
Evan@653
|
306 |
}; |
|
Evan@653
|
307 |
|
|
Evan@653
|
308 |
/** Structure for a single certificate request |
|
Evan@653
|
309 |
* |
|
Evan@653
|
310 |
* Useful for keeping track of the state of a verification that involves |
|
Evan@653
|
311 |
* several steps |
|
Evan@653
|
312 |
*/ |
|
Evan@653
|
313 |
struct _PurpleCertificateVerificationRequest |
|
Evan@653
|
314 |
{ |
|
Evan@653
|
315 |
/** Reference to the verification logic used */ |
|
Evan@653
|
316 |
PurpleCertificateVerifier *verifier; |
|
Evan@653
|
317 |
/** Reference to the scheme used. |
|
Evan@653
|
318 |
* |
|
Evan@653
|
319 |
* This is looked up from the Verifier when the Request is generated |
|
Evan@653
|
320 |
*/ |
|
Evan@653
|
321 |
PurpleCertificateScheme *scheme; |
|
Evan@653
|
322 |
|
|
Evan@653
|
323 |
/** |
|
Evan@653
|
324 |
* Name to check that the certificate is issued to |
|
Evan@653
|
325 |
* |
|
Evan@653
|
326 |
* For X.509 certificates, this is the Common Name |
|
Evan@653
|
327 |
*/ |
|
Evan@653
|
328 |
gchar *subject_name; |
|
Evan@1427
|
329 |
|
|
Evan@653
|
330 |
/** List of certificates in the chain to be verified (such as that returned by purple_ssl_get_peer_certificates ) |
|
Evan@653
|
331 |
* |
|
Evan@653
|
332 |
* This is most relevant for X.509 certificates used in SSL sessions. |
|
Evan@653
|
333 |
* The list order should be: certificate, issuer, issuer's issuer, etc. |
|
Evan@653
|
334 |
*/ |
|
Evan@653
|
335 |
GList *cert_chain; |
|
Evan@1427
|
336 |
|
|
Evan@653
|
337 |
/** Internal data used by the Verifier code */ |
|
Evan@653
|
338 |
gpointer data; |
|
Evan@653
|
339 |
|
|
Evan@653
|
340 |
/** Function to call with the verification result */ |
|
Evan@653
|
341 |
PurpleCertificateVerifiedCallback cb; |
|
Evan@653
|
342 |
/** Data to pass to the post-verification callback */ |
|
Evan@653
|
343 |
gpointer cb_data; |
|
Evan@653
|
344 |
}; |
|
Evan@653
|
345 |
|
|
Evan@653
|
346 |
/*****************************************************************************/ |
|
Evan@653
|
347 |
/** @name Certificate Verification Functions */ |
|
Evan@653
|
348 |
/*****************************************************************************/ |
|
Evan@653
|
349 |
/*@{*/ |
|
Evan@653
|
350 |
|
|
Evan@653
|
351 |
/** |
|
Evan@653
|
352 |
* Constructs a verification request and passed control to the specified Verifier |
|
Evan@653
|
353 |
* |
|
Evan@653
|
354 |
* It is possible that the callback will be called immediately upon calling |
|
Evan@653
|
355 |
* this function. Plan accordingly. |
|
Evan@653
|
356 |
* |
|
Evan@653
|
357 |
* @param verifier Verification logic to use. |
|
Evan@653
|
358 |
* @see purple_certificate_find_verifier() |
|
Evan@653
|
359 |
* |
|
Evan@653
|
360 |
* @param subject_name Name that should match the first certificate in the |
|
Evan@653
|
361 |
* chain for the certificate to be valid. Will be strdup'd |
|
Evan@653
|
362 |
* into the Request struct |
|
Evan@653
|
363 |
* |
|
Evan@653
|
364 |
* @param cert_chain Certificate chain to check. If there is more than one |
|
Evan@653
|
365 |
* certificate in the chain (X.509), the peer's |
|
Evan@653
|
366 |
* certificate comes first, then the issuer/signer's |
|
Evan@653
|
367 |
* certificate, etc. The whole list is duplicated into the |
|
Evan@653
|
368 |
* Request struct. |
|
Evan@653
|
369 |
* |
|
Evan@653
|
370 |
* @param cb Callback function to be called with whether the |
|
Evan@653
|
371 |
* certificate was approved or not. |
|
Evan@653
|
372 |
* @param cb_data User-defined data for the above. |
|
Evan@653
|
373 |
*/ |
|
Evan@653
|
374 |
void |
|
Evan@653
|
375 |
purple_certificate_verify (PurpleCertificateVerifier *verifier, |
|
Evan@653
|
376 |
const gchar *subject_name, GList *cert_chain, |
|
Evan@653
|
377 |
PurpleCertificateVerifiedCallback cb, |
|
Evan@653
|
378 |
gpointer cb_data); |
|
Evan@653
|
379 |
|
|
Evan@653
|
380 |
/** |
|
Evan@653
|
381 |
* Completes and destroys a VerificationRequest |
|
Evan@653
|
382 |
* |
|
Evan@653
|
383 |
* @param vrq Request to conclude |
|
Evan@653
|
384 |
* @param st Success/failure code to pass to the request's |
|
Evan@653
|
385 |
* completion callback. |
|
Evan@653
|
386 |
*/ |
|
Evan@653
|
387 |
void |
|
Evan@653
|
388 |
purple_certificate_verify_complete(PurpleCertificateVerificationRequest *vrq, |
|
Evan@653
|
389 |
PurpleCertificateVerificationStatus st); |
|
Evan@653
|
390 |
|
|
Evan@653
|
391 |
/*@}*/ |
|
Evan@653
|
392 |
|
|
Evan@653
|
393 |
/*****************************************************************************/ |
|
Evan@653
|
394 |
/** @name Certificate Functions */ |
|
Evan@653
|
395 |
/*****************************************************************************/ |
|
Evan@653
|
396 |
/*@{*/ |
|
Evan@653
|
397 |
|
|
Evan@653
|
398 |
/** |
|
Evan@653
|
399 |
* Makes a duplicate of a certificate |
|
Evan@653
|
400 |
* |
|
Evan@653
|
401 |
* @param crt Instance to duplicate |
|
Evan@653
|
402 |
* @return Pointer to new instance |
|
Evan@653
|
403 |
*/ |
|
Evan@653
|
404 |
PurpleCertificate * |
|
Evan@653
|
405 |
purple_certificate_copy(PurpleCertificate *crt); |
|
Evan@653
|
406 |
|
|
Evan@653
|
407 |
/** |
|
Evan@653
|
408 |
* Duplicates an entire list of certificates |
|
Evan@653
|
409 |
* |
|
Evan@653
|
410 |
* @param crt_list List to duplicate |
|
Evan@653
|
411 |
* @return New list copy |
|
Evan@653
|
412 |
*/ |
|
Evan@653
|
413 |
GList * |
|
Evan@653
|
414 |
purple_certificate_copy_list(GList *crt_list); |
|
Evan@653
|
415 |
|
|
Evan@653
|
416 |
/** |
|
Evan@653
|
417 |
* Destroys and free()'s a Certificate |
|
Evan@653
|
418 |
* |
|
Evan@653
|
419 |
* @param crt Instance to destroy. May be NULL. |
|
Evan@653
|
420 |
*/ |
|
Evan@653
|
421 |
void |
|
Evan@653
|
422 |
purple_certificate_destroy (PurpleCertificate *crt); |
|
Evan@653
|
423 |
|
|
Evan@653
|
424 |
/** |
|
Evan@653
|
425 |
* Destroy an entire list of Certificate instances and the containing list |
|
Evan@653
|
426 |
* |
|
Evan@653
|
427 |
* @param crt_list List of certificates to destroy. May be NULL. |
|
Evan@653
|
428 |
*/ |
|
Evan@653
|
429 |
void |
|
Evan@653
|
430 |
purple_certificate_destroy_list (GList * crt_list); |
|
Evan@653
|
431 |
|
|
Evan@653
|
432 |
/** |
|
Evan@653
|
433 |
* Check whether 'crt' has a valid signature made by 'issuer' |
|
Evan@653
|
434 |
* |
|
Evan@653
|
435 |
* @param crt Certificate instance to check signature of |
|
Evan@653
|
436 |
* @param issuer Certificate thought to have signed 'crt' |
|
Evan@653
|
437 |
* |
|
Evan@653
|
438 |
* @return TRUE if 'crt' has a valid signature made by 'issuer', |
|
Evan@653
|
439 |
* otherwise FALSE |
|
Evan@1427
|
440 |
* @todo Find a way to give the reason (bad signature, not the issuer, etc.) |
|
Evan@653
|
441 |
*/ |
|
Evan@653
|
442 |
gboolean |
|
Evan@653
|
443 |
purple_certificate_signed_by(PurpleCertificate *crt, PurpleCertificate *issuer); |
|
Evan@653
|
444 |
|
|
Evan@653
|
445 |
/** |
|
Evan@2571
|
446 |
* Check that a certificate chain is valid and, if not, the failing certificate. |
|
Evan@2571
|
447 |
* |
|
Evan@2571
|
448 |
* Uses purple_certificate_signed_by() to verify that each PurpleCertificate |
|
Evan@2571
|
449 |
* in the chain carries a valid signature from the next. A single-certificate |
|
Evan@2571
|
450 |
* chain is considered to be valid. |
|
Evan@2571
|
451 |
* |
|
Evan@2571
|
452 |
* @param chain List of PurpleCertificate instances comprising the chain, |
|
Evan@2571
|
453 |
* in the order certificate, issuer, issuer's issuer, etc. |
|
Evan@2571
|
454 |
* @param failing A pointer to a PurpleCertificate*. If not NULL, if the |
|
Evan@2571
|
455 |
* chain fails to validate, this will be set to the |
|
Evan@2571
|
456 |
* certificate whose signature could not be validated. |
|
Evan@2571
|
457 |
* @return TRUE if the chain is valid. See description. |
|
Evan@2571
|
458 |
* |
|
Evan@2571
|
459 |
* @since 2.6.0 |
|
Evan@2571
|
460 |
* @deprecated This function will become |
|
Evan@2571
|
461 |
* purple_certificate_check_signature_chain in 3.0.0 |
|
Evan@2571
|
462 |
*/ |
|
Evan@2571
|
463 |
gboolean |
|
Evan@2571
|
464 |
purple_certificate_check_signature_chain_with_failing(GList *chain, |
|
Evan@2571
|
465 |
PurpleCertificate **failing); |
|
Evan@2571
|
466 |
|
|
Evan@2571
|
467 |
/** |
|
Evan@653
|
468 |
* Check that a certificate chain is valid |
|
Evan@653
|
469 |
* |
|
Evan@653
|
470 |
* Uses purple_certificate_signed_by() to verify that each PurpleCertificate |
|
Evan@653
|
471 |
* in the chain carries a valid signature from the next. A single-certificate |
|
Evan@653
|
472 |
* chain is considered to be valid. |
|
Evan@653
|
473 |
* |
|
Evan@653
|
474 |
* @param chain List of PurpleCertificate instances comprising the chain, |
|
Evan@653
|
475 |
* in the order certificate, issuer, issuer's issuer, etc. |
|
Evan@653
|
476 |
* @return TRUE if the chain is valid. See description. |
|
Evan@653
|
477 |
* @todo Specify which certificate in the chain caused a failure |
|
Evan@2571
|
478 |
* @deprecated This function will be removed in 3.0.0 and replaced with |
|
Evan@2571
|
479 |
* purple_certificate_check_signature_chain_with_failing |
|
Evan@653
|
480 |
*/ |
|
Evan@653
|
481 |
gboolean |
|
Evan@653
|
482 |
purple_certificate_check_signature_chain(GList *chain); |
|
Evan@653
|
483 |
|
|
Evan@653
|
484 |
/** |
|
Evan@653
|
485 |
* Imports a PurpleCertificate from a file |
|
Evan@653
|
486 |
* |
|
Evan@653
|
487 |
* @param scheme Scheme to import under |
|
Evan@653
|
488 |
* @param filename File path to import from |
|
Evan@653
|
489 |
* @return Pointer to a new PurpleCertificate, or NULL on failure |
|
Evan@653
|
490 |
*/ |
|
Evan@653
|
491 |
PurpleCertificate * |
|
Evan@653
|
492 |
purple_certificate_import(PurpleCertificateScheme *scheme, const gchar *filename); |
|
Evan@653
|
493 |
|
|
Evan@653
|
494 |
/** |
|
Evan@653
|
495 |
* Exports a PurpleCertificate to a file |
|
Evan@653
|
496 |
* |
|
Evan@653
|
497 |
* @param filename File to export the certificate to |
|
Evan@653
|
498 |
* @param crt Certificate to export |
|
Evan@653
|
499 |
* @return TRUE if the export succeeded, otherwise FALSE |
|
Evan@653
|
500 |
*/ |
|
Evan@653
|
501 |
gboolean |
|
Evan@653
|
502 |
purple_certificate_export(const gchar *filename, PurpleCertificate *crt); |
|
Evan@653
|
503 |
|
|
Evan@653
|
504 |
|
|
Evan@653
|
505 |
/** |
|
Evan@653
|
506 |
* Retrieves the certificate public key fingerprint using SHA1. |
|
Evan@653
|
507 |
* |
|
Evan@653
|
508 |
* @param crt Certificate instance |
|
Evan@653
|
509 |
* @return Binary representation of the hash. You are responsible for free()ing |
|
Evan@653
|
510 |
* this. |
|
Evan@653
|
511 |
* @see purple_base16_encode_chunked() |
|
Evan@653
|
512 |
*/ |
|
Evan@653
|
513 |
GByteArray * |
|
Evan@653
|
514 |
purple_certificate_get_fingerprint_sha1(PurpleCertificate *crt); |
|
Evan@653
|
515 |
|
|
Evan@653
|
516 |
/** |
|
Evan@653
|
517 |
* Get a unique identifier for the certificate |
|
Evan@653
|
518 |
* |
|
Evan@653
|
519 |
* @param crt Certificate instance |
|
Evan@653
|
520 |
* @return String representing the certificate uniquely. Must be g_free()'ed |
|
Evan@653
|
521 |
*/ |
|
Evan@653
|
522 |
gchar * |
|
Evan@653
|
523 |
purple_certificate_get_unique_id(PurpleCertificate *crt); |
|
Evan@653
|
524 |
|
|
Evan@653
|
525 |
/** |
|
Evan@653
|
526 |
* Get a unique identifier for the certificate's issuer |
|
Evan@653
|
527 |
* |
|
Evan@653
|
528 |
* @param crt Certificate instance |
|
Evan@653
|
529 |
* @return String representing the certificate's issuer uniquely. Must be |
|
Evan@653
|
530 |
* g_free()'ed |
|
Evan@653
|
531 |
*/ |
|
Evan@653
|
532 |
gchar * |
|
Evan@653
|
533 |
purple_certificate_get_issuer_unique_id(PurpleCertificate *crt); |
|
Evan@653
|
534 |
|
|
Evan@653
|
535 |
/** |
|
Evan@653
|
536 |
* Gets the certificate subject's name |
|
Evan@653
|
537 |
* |
|
Evan@653
|
538 |
* For X.509, this is the "Common Name" field, as we're only using it |
|
Evan@653
|
539 |
* for hostname verification at the moment |
|
Evan@653
|
540 |
* |
|
Evan@653
|
541 |
* @param crt Certificate instance |
|
Evan@653
|
542 |
* @return Newly allocated string with the certificate subject. |
|
Evan@653
|
543 |
*/ |
|
Evan@653
|
544 |
gchar * |
|
Evan@653
|
545 |
purple_certificate_get_subject_name(PurpleCertificate *crt); |
|
Evan@653
|
546 |
|
|
Evan@653
|
547 |
/** |
|
Evan@653
|
548 |
* Check the subject name against that on the certificate |
|
Evan@653
|
549 |
* @param crt Certificate instance |
|
Evan@1427
|
550 |
* @param name Name to check. |
|
Evan@653
|
551 |
* @return TRUE if it is a match, else FALSE |
|
Evan@653
|
552 |
*/ |
|
Evan@653
|
553 |
gboolean |
|
Evan@653
|
554 |
purple_certificate_check_subject_name(PurpleCertificate *crt, const gchar *name); |
|
Evan@653
|
555 |
|
|
Evan@653
|
556 |
/** |
|
Evan@653
|
557 |
* Get the expiration/activation times. |
|
Evan@653
|
558 |
* |
|
Evan@653
|
559 |
* @param crt Certificate instance |
|
Evan@653
|
560 |
* @param activation Reference to store the activation time at. May be NULL |
|
Evan@653
|
561 |
* if you don't actually want it. |
|
Evan@653
|
562 |
* @param expiration Reference to store the expiration time at. May be NULL |
|
Evan@653
|
563 |
* if you don't actually want it. |
|
Evan@653
|
564 |
* @return TRUE if the requested values were obtained, otherwise FALSE. |
|
Evan@653
|
565 |
*/ |
|
Evan@653
|
566 |
gboolean |
|
Evan@653
|
567 |
purple_certificate_get_times(PurpleCertificate *crt, time_t *activation, time_t *expiration); |
|
Evan@653
|
568 |
|
|
Evan@653
|
569 |
/*@}*/ |
|
Evan@653
|
570 |
|
|
Evan@653
|
571 |
/*****************************************************************************/ |
|
Evan@653
|
572 |
/** @name Certificate Pool Functions */ |
|
Evan@653
|
573 |
/*****************************************************************************/ |
|
Evan@653
|
574 |
/*@{*/ |
|
Evan@653
|
575 |
/** |
|
Evan@653
|
576 |
* Helper function for generating file paths in ~/.purple/certificates for |
|
Evan@653
|
577 |
* CertificatePools that use them. |
|
Evan@653
|
578 |
* |
|
Evan@653
|
579 |
* All components will be escaped for filesystem friendliness. |
|
Evan@653
|
580 |
* |
|
Evan@653
|
581 |
* @param pool CertificatePool to build a path for |
|
Evan@653
|
582 |
* @param id Key to look up a Certificate by. May be NULL. |
|
Evan@653
|
583 |
* @return A newly allocated path of the form |
|
Evan@653
|
584 |
* ~/.purple/certificates/scheme_name/pool_name/unique_id |
|
Evan@653
|
585 |
*/ |
|
Evan@653
|
586 |
gchar * |
|
Evan@653
|
587 |
purple_certificate_pool_mkpath(PurpleCertificatePool *pool, const gchar *id); |
|
Evan@653
|
588 |
|
|
Evan@653
|
589 |
/** |
|
Evan@653
|
590 |
* Determines whether a pool can be used. |
|
Evan@653
|
591 |
* |
|
Evan@653
|
592 |
* Checks whether the associated CertificateScheme is loaded. |
|
Evan@653
|
593 |
* |
|
Evan@653
|
594 |
* @param pool Pool to check |
|
Evan@653
|
595 |
* |
|
Evan@653
|
596 |
* @return TRUE if the pool can be used, otherwise FALSE |
|
Evan@653
|
597 |
*/ |
|
Evan@653
|
598 |
gboolean |
|
Evan@653
|
599 |
purple_certificate_pool_usable(PurpleCertificatePool *pool); |
|
Evan@653
|
600 |
|
|
Evan@653
|
601 |
/** |
|
Evan@653
|
602 |
* Looks up the scheme the pool operates under |
|
Evan@653
|
603 |
* |
|
Evan@653
|
604 |
* @param pool Pool to get the scheme of |
|
Evan@653
|
605 |
* |
|
Evan@653
|
606 |
* @return Pointer to the pool's scheme, or NULL if it isn't loaded. |
|
Evan@653
|
607 |
* @see purple_certificate_pool_usable() |
|
Evan@653
|
608 |
*/ |
|
Evan@653
|
609 |
PurpleCertificateScheme * |
|
Evan@653
|
610 |
purple_certificate_pool_get_scheme(PurpleCertificatePool *pool); |
|
Evan@653
|
611 |
|
|
Evan@653
|
612 |
/** |
|
Evan@653
|
613 |
* Check for presence of an ID in a pool. |
|
Evan@653
|
614 |
* @param pool Pool to look in |
|
Evan@653
|
615 |
* @param id ID to look for |
|
Evan@653
|
616 |
* @return TRUE if the ID is in the pool, else FALSE |
|
Evan@653
|
617 |
*/ |
|
Evan@653
|
618 |
gboolean |
|
Evan@653
|
619 |
purple_certificate_pool_contains(PurpleCertificatePool *pool, const gchar *id); |
|
Evan@653
|
620 |
|
|
Evan@653
|
621 |
/** |
|
Evan@653
|
622 |
* Retrieve a certificate from a pool. |
|
Evan@653
|
623 |
* @param pool Pool to fish in |
|
Evan@653
|
624 |
* @param id ID to look up |
|
Evan@653
|
625 |
* @return Retrieved certificate, or NULL if it wasn't there |
|
Evan@653
|
626 |
*/ |
|
Evan@653
|
627 |
PurpleCertificate * |
|
Evan@653
|
628 |
purple_certificate_pool_retrieve(PurpleCertificatePool *pool, const gchar *id); |
|
Evan@653
|
629 |
|
|
Evan@653
|
630 |
/** |
|
Evan@653
|
631 |
* Add a certificate to a pool |
|
Evan@653
|
632 |
* |
|
Evan@653
|
633 |
* Any pre-existing certificate of the same ID will be overwritten. |
|
Evan@653
|
634 |
* |
|
Evan@653
|
635 |
* @param pool Pool to add to |
|
Evan@653
|
636 |
* @param id ID to store the certificate with |
|
Evan@653
|
637 |
* @param crt Certificate to store |
|
Evan@653
|
638 |
* @return TRUE if the operation succeeded, otherwise FALSE |
|
Evan@653
|
639 |
*/ |
|
Evan@653
|
640 |
gboolean |
|
Evan@653
|
641 |
purple_certificate_pool_store(PurpleCertificatePool *pool, const gchar *id, PurpleCertificate *crt); |
|
Evan@653
|
642 |
|
|
Evan@653
|
643 |
/** |
|
Evan@653
|
644 |
* Remove a certificate from a pool |
|
Evan@653
|
645 |
* |
|
Evan@653
|
646 |
* @param pool Pool to remove from |
|
Evan@653
|
647 |
* @param id ID to remove |
|
Evan@653
|
648 |
* @return TRUE if the operation succeeded, otherwise FALSE |
|
Evan@653
|
649 |
*/ |
|
Evan@653
|
650 |
gboolean |
|
Evan@653
|
651 |
purple_certificate_pool_delete(PurpleCertificatePool *pool, const gchar *id); |
|
Evan@653
|
652 |
|
|
Evan@653
|
653 |
/** |
|
Evan@653
|
654 |
* Get the list of IDs currently in the pool. |
|
Evan@653
|
655 |
* |
|
Evan@653
|
656 |
* @param pool Pool to enumerate |
|
Evan@653
|
657 |
* @return GList pointing to newly-allocated id strings. Free using |
|
Evan@653
|
658 |
* purple_certificate_pool_destroy_idlist() |
|
Evan@653
|
659 |
*/ |
|
Evan@653
|
660 |
GList * |
|
Evan@653
|
661 |
purple_certificate_pool_get_idlist(PurpleCertificatePool *pool); |
|
Evan@653
|
662 |
|
|
Evan@653
|
663 |
/** |
|
Evan@653
|
664 |
* Destroys the result given by purple_certificate_pool_get_idlist() |
|
Evan@653
|
665 |
* |
|
Evan@653
|
666 |
* @param idlist ID List to destroy |
|
Evan@653
|
667 |
*/ |
|
Evan@653
|
668 |
void |
|
Evan@653
|
669 |
purple_certificate_pool_destroy_idlist(GList *idlist); |
|
Evan@653
|
670 |
|
|
Evan@653
|
671 |
/*@}*/ |
|
Evan@653
|
672 |
|
|
Evan@653
|
673 |
/*****************************************************************************/ |
|
Evan@653
|
674 |
/** @name Certificate Subsystem API */ |
|
Evan@653
|
675 |
/*****************************************************************************/ |
|
Evan@653
|
676 |
/*@{*/ |
|
Evan@653
|
677 |
|
|
Evan@653
|
678 |
/** |
|
Evan@653
|
679 |
* Initialize the certificate system |
|
Evan@653
|
680 |
*/ |
|
Evan@653
|
681 |
void |
|
Evan@653
|
682 |
purple_certificate_init(void); |
|
Evan@653
|
683 |
|
|
Evan@653
|
684 |
/** |
|
Evan@653
|
685 |
* Un-initialize the certificate system |
|
Evan@653
|
686 |
*/ |
|
Evan@653
|
687 |
void |
|
Evan@653
|
688 |
purple_certificate_uninit(void); |
|
Evan@653
|
689 |
|
|
Evan@653
|
690 |
/** |
|
Evan@653
|
691 |
* Get the Certificate subsystem handle for signalling purposes |
|
Evan@653
|
692 |
*/ |
|
Evan@653
|
693 |
gpointer |
|
Evan@653
|
694 |
purple_certificate_get_handle(void); |
|
Evan@653
|
695 |
|
|
Evan@653
|
696 |
/** Look up a registered CertificateScheme by name |
|
Evan@653
|
697 |
* @param name The scheme name. Case insensitive. |
|
Evan@653
|
698 |
* @return Pointer to the located Scheme, or NULL if it isn't found. |
|
Evan@653
|
699 |
*/ |
|
Evan@653
|
700 |
PurpleCertificateScheme * |
|
Evan@653
|
701 |
purple_certificate_find_scheme(const gchar *name); |
|
Evan@653
|
702 |
|
|
Evan@653
|
703 |
/** |
|
Evan@653
|
704 |
* Get all registered CertificateSchemes |
|
Evan@653
|
705 |
* |
|
Evan@653
|
706 |
* @return GList pointing to all registered CertificateSchemes . This value |
|
Evan@653
|
707 |
* is owned by libpurple |
|
Evan@653
|
708 |
*/ |
|
Evan@653
|
709 |
GList * |
|
Evan@653
|
710 |
purple_certificate_get_schemes(void); |
|
Evan@653
|
711 |
|
|
Evan@653
|
712 |
/** Register a CertificateScheme with libpurple |
|
Evan@653
|
713 |
* |
|
Evan@653
|
714 |
* No two schemes can be registered with the same name; this function enforces |
|
Evan@653
|
715 |
* that. |
|
Evan@653
|
716 |
* |
|
Evan@653
|
717 |
* @param scheme Pointer to the scheme to register. |
|
Evan@653
|
718 |
* @return TRUE if the scheme was successfully added, otherwise FALSE |
|
Evan@653
|
719 |
*/ |
|
Evan@653
|
720 |
gboolean |
|
Evan@653
|
721 |
purple_certificate_register_scheme(PurpleCertificateScheme *scheme); |
|
Evan@653
|
722 |
|
|
Evan@653
|
723 |
/** Unregister a CertificateScheme from libpurple |
|
Evan@653
|
724 |
* |
|
Evan@653
|
725 |
* @param scheme Scheme to unregister. |
|
Evan@653
|
726 |
* If the scheme is not registered, this is a no-op. |
|
Evan@653
|
727 |
* |
|
Evan@653
|
728 |
* @return TRUE if the unregister completed successfully |
|
Evan@653
|
729 |
*/ |
|
Evan@653
|
730 |
gboolean |
|
Evan@653
|
731 |
purple_certificate_unregister_scheme(PurpleCertificateScheme *scheme); |
|
Evan@653
|
732 |
|
|
Evan@653
|
733 |
/** Look up a registered PurpleCertificateVerifier by scheme and name |
|
Evan@653
|
734 |
* @param scheme_name Scheme name. Case insensitive. |
|
Evan@653
|
735 |
* @param ver_name The verifier name. Case insensitive. |
|
Evan@653
|
736 |
* @return Pointer to the located Verifier, or NULL if it isn't found. |
|
Evan@653
|
737 |
*/ |
|
Evan@653
|
738 |
PurpleCertificateVerifier * |
|
Evan@653
|
739 |
purple_certificate_find_verifier(const gchar *scheme_name, const gchar *ver_name); |
|
Evan@653
|
740 |
|
|
Evan@653
|
741 |
/** |
|
Evan@653
|
742 |
* Get the list of registered CertificateVerifiers |
|
Evan@653
|
743 |
* |
|
Evan@653
|
744 |
* @return GList of all registered PurpleCertificateVerifier. This value |
|
Evan@653
|
745 |
* is owned by libpurple |
|
Evan@653
|
746 |
*/ |
|
Evan@653
|
747 |
GList * |
|
Evan@653
|
748 |
purple_certificate_get_verifiers(void); |
|
Evan@653
|
749 |
|
|
Evan@653
|
750 |
/** |
|
Evan@653
|
751 |
* Register a CertificateVerifier with libpurple |
|
Evan@653
|
752 |
* |
|
Evan@653
|
753 |
* @param vr Verifier to register. |
|
Evan@653
|
754 |
* @return TRUE if register succeeded, otherwise FALSE |
|
Evan@653
|
755 |
*/ |
|
Evan@653
|
756 |
gboolean |
|
Evan@653
|
757 |
purple_certificate_register_verifier(PurpleCertificateVerifier *vr); |
|
Evan@653
|
758 |
|
|
Evan@653
|
759 |
/** |
|
Evan@653
|
760 |
* Unregister a CertificateVerifier with libpurple |
|
Evan@653
|
761 |
* |
|
Evan@653
|
762 |
* @param vr Verifier to unregister. |
|
Evan@653
|
763 |
* @return TRUE if unregister succeeded, otherwise FALSE |
|
Evan@653
|
764 |
*/ |
|
Evan@653
|
765 |
gboolean |
|
Evan@653
|
766 |
purple_certificate_unregister_verifier(PurpleCertificateVerifier *vr); |
|
Evan@653
|
767 |
|
|
Evan@653
|
768 |
/** Look up a registered PurpleCertificatePool by scheme and name |
|
Evan@653
|
769 |
* @param scheme_name Scheme name. Case insensitive. |
|
Evan@653
|
770 |
* @param pool_name Pool name. Case insensitive. |
|
Evan@653
|
771 |
* @return Pointer to the located Pool, or NULL if it isn't found. |
|
Evan@653
|
772 |
*/ |
|
Evan@653
|
773 |
PurpleCertificatePool * |
|
Evan@653
|
774 |
purple_certificate_find_pool(const gchar *scheme_name, const gchar *pool_name); |
|
Evan@653
|
775 |
|
|
Evan@653
|
776 |
/** |
|
Evan@653
|
777 |
* Get the list of registered Pools |
|
Evan@653
|
778 |
* |
|
Evan@653
|
779 |
* @return GList of all registered PurpleCertificatePool s. This value |
|
Evan@653
|
780 |
* is owned by libpurple |
|
Evan@653
|
781 |
*/ |
|
Evan@653
|
782 |
GList * |
|
Evan@653
|
783 |
purple_certificate_get_pools(void); |
|
Evan@653
|
784 |
|
|
Evan@653
|
785 |
/** |
|
Evan@653
|
786 |
* Register a CertificatePool with libpurple and call its init function |
|
Evan@653
|
787 |
* |
|
Evan@653
|
788 |
* @param pool Pool to register. |
|
Evan@653
|
789 |
* @return TRUE if the register succeeded, otherwise FALSE |
|
Evan@653
|
790 |
*/ |
|
Evan@653
|
791 |
gboolean |
|
Evan@653
|
792 |
purple_certificate_register_pool(PurpleCertificatePool *pool); |
|
Evan@653
|
793 |
|
|
Evan@653
|
794 |
/** |
|
Evan@653
|
795 |
* Unregister a CertificatePool with libpurple and call its uninit function |
|
Evan@653
|
796 |
* |
|
Evan@653
|
797 |
* @param pool Pool to unregister. |
|
Evan@653
|
798 |
* @return TRUE if the unregister succeeded, otherwise FALSE |
|
Evan@653
|
799 |
*/ |
|
Evan@653
|
800 |
gboolean |
|
Evan@653
|
801 |
purple_certificate_unregister_pool(PurpleCertificatePool *pool); |
|
Evan@653
|
802 |
|
|
Evan@653
|
803 |
/*@}*/ |
|
Evan@653
|
804 |
|
|
Evan@653
|
805 |
|
|
Evan@653
|
806 |
/** |
|
Evan@653
|
807 |
* Displays a window showing X.509 certificate information |
|
Evan@653
|
808 |
* |
|
Evan@653
|
809 |
* @param crt Certificate under an "x509" Scheme |
|
Evan@653
|
810 |
* @todo Will break on CA certs, as they have no Common Name |
|
Evan@653
|
811 |
*/ |
|
Evan@653
|
812 |
void |
|
Evan@653
|
813 |
purple_certificate_display_x509(PurpleCertificate *crt); |
|
Evan@653
|
814 |
|
|
Evan@653
|
815 |
/** |
|
Evan@653
|
816 |
* Add a search path for certificates. |
|
Evan@653
|
817 |
* |
|
Evan@653
|
818 |
* @param path Path to search for certificates. |
|
Evan@653
|
819 |
*/ |
|
Evan@653
|
820 |
void purple_certificate_add_ca_search_path(const char *path); |
|
Evan@653
|
821 |
|
|
Evan@653
|
822 |
#ifdef __cplusplus |
|
Evan@653
|
823 |
} |
|
Evan@653
|
824 |
#endif /* __cplusplus */ |
|
Evan@653
|
825 |
|
|
Evan@653
|
826 |
#endif /* _PURPLE_CERTIFICATE_H */ |