libpurple/certificate.h

Thu, 28 Jun 2007 23:47:07 +0000

author
William Ehlhardt <williamehlhardt@gmail.com>
date
Thu, 28 Jun 2007 23:47:07 +0000
branch
soc.2007.certmgr
changeset 18494
fc93e7020e83
parent 18493
a4ee6630e3fb
child 18496
3bb8e716482e
permissions
-rw-r--r--

- CertificatePool member functions no longer accept a Pool instance, as Pools are expected to be singletons
- Add skeleton for x509 tls_peers CertificatePool

17506
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
1 /**
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
2 * @file certificate.h Public-Key Certificate API
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
3 * @ingroup core
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
4 */
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
5
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
6 /*
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
7 *
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
8 * purple
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
9 *
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
10 * Purple is the legal property of its developers, whose names are too numerous
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
11 * to list here. Please refer to the COPYRIGHT file distributed with this
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
12 * source distribution.
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
13 *
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
14 * This program is free software; you can redistribute it and/or modify
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
15 * it under the terms of the GNU General Public License as published by
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
16 * the Free Software Foundation; either version 2 of the License, or
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
17 * (at your option) any later version.
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
18 *
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
19 * This program is distributed in the hope that it will be useful,
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
22 * GNU General Public License for more details.
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
23 *
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
24 * You should have received a copy of the GNU General Public License
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
25 * along with this program; if not, write to the Free Software
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
27 */
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
28
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
29 #ifndef _PURPLE_CERTIFICATE_H
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
30 #define _PURPLE_CERTIFICATE_H
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
31
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
32 #include <glib.h>
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
33
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
34 #ifdef __cplusplus
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
35 extern "C" {
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
36 #endif /* __cplusplus */
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
37
18448
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
38
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
39 typedef enum
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
40 {
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
41 PURPLE_CERTIFICATE_INVALID = 0,
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
42 PURPLE_CERTIFICATE_VALID = 1
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
43 } PurpleCertificateVerificationStatus;
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
44
18248
8f462eaffecd - Style issues
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18247
diff changeset
45 typedef struct _PurpleCertificate PurpleCertificate;
18489
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
46 typedef struct _PurpleCertificatePool PurpleCertificatePool;
18248
8f462eaffecd - Style issues
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18247
diff changeset
47 typedef struct _PurpleCertificateScheme PurpleCertificateScheme;
18448
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
48 typedef struct _PurpleCertificateVerifier PurpleCertificateVerifier;
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
49 typedef struct _PurpleCertificateVerificationRequest PurpleCertificateVerificationRequest;
17506
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
50
18460
cceca1e961ad - Fill out CertVerifier struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18457
diff changeset
51 /**
cceca1e961ad - Fill out CertVerifier struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18457
diff changeset
52 * Callback function for the results of a verification check
cceca1e961ad - Fill out CertVerifier struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18457
diff changeset
53 * @param st Status code
cceca1e961ad - Fill out CertVerifier struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18457
diff changeset
54 * @param userdata User-defined data
cceca1e961ad - Fill out CertVerifier struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18457
diff changeset
55 */
cceca1e961ad - Fill out CertVerifier struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18457
diff changeset
56 typedef void (*PurpleCertificateVerifiedCallback)
18473
a7251d502f6a - Add purple_certificate_get_fingerprint_sha1
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18472
diff changeset
57 (PurpleCertificateVerificationStatus st,
18460
cceca1e961ad - Fill out CertVerifier struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18457
diff changeset
58 gpointer userdata);
cceca1e961ad - Fill out CertVerifier struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18457
diff changeset
59
17509
fa009823dbfd - Exposed the _Certificate struct definition in certificate.h
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17508
diff changeset
60 /** A certificate instance
fa009823dbfd - Exposed the _Certificate struct definition in certificate.h
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17508
diff changeset
61 *
fa009823dbfd - Exposed the _Certificate struct definition in certificate.h
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17508
diff changeset
62 * An opaque data structure representing a single certificate under some
fa009823dbfd - Exposed the _Certificate struct definition in certificate.h
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17508
diff changeset
63 * CertificateScheme
fa009823dbfd - Exposed the _Certificate struct definition in certificate.h
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17508
diff changeset
64 */
18248
8f462eaffecd - Style issues
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18247
diff changeset
65 struct _PurpleCertificate
17509
fa009823dbfd - Exposed the _Certificate struct definition in certificate.h
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17508
diff changeset
66 {
fa009823dbfd - Exposed the _Certificate struct definition in certificate.h
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17508
diff changeset
67 /** Scheme this certificate is under */
18248
8f462eaffecd - Style issues
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18247
diff changeset
68 PurpleCertificateScheme * scheme;
17509
fa009823dbfd - Exposed the _Certificate struct definition in certificate.h
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17508
diff changeset
69 /** Opaque pointer to internal data */
fa009823dbfd - Exposed the _Certificate struct definition in certificate.h
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17508
diff changeset
70 gpointer data;
fa009823dbfd - Exposed the _Certificate struct definition in certificate.h
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17508
diff changeset
71 };
fa009823dbfd - Exposed the _Certificate struct definition in certificate.h
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17508
diff changeset
72
18489
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
73 /**
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
74 * Database for retrieval or storage of Certificates
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
75 */
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
76 struct _PurpleCertificatePool
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
77 {
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
78 /** Scheme this Pool operates for */
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
79 gchar *scheme_name;
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
80 /** Internal name to refer to the pool by */
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
81 gchar *name;
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
82
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
83 /** User-friendly name for this type
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
84 * ex: N_("SSL Servers")
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
85 * When this is displayed anywhere, it should be i18ned
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
86 * ex: _(pool->fullname)
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
87 */
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
88 gchar *fullname;
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
89
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
90 /** Internal pool data */
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
91 gpointer data;
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
92
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
93 /**
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
94 * Set up the Pool's internal state
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
95 *
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
96 * Upon calling purple_certificate_register_pool() , this function will
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
97 * be called. May be NULL.
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
98 * @return TRUE if the initialization succeeded, otherwise FALSE
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
99 */
18494
fc93e7020e83 - CertificatePool member functions no longer accept a Pool instance, as Pools are expected to be singletons
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18493
diff changeset
100 gboolean (* init)(void);
18489
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
101
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
102 /**
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
103 * Uninit the Pool's internal state
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
104 *
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
105 * Will be called by purple_certificate_unregister_pool() . May be NULL
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
106 */
18494
fc93e7020e83 - CertificatePool member functions no longer accept a Pool instance, as Pools are expected to be singletons
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18493
diff changeset
107 void (* uninit)(void);
18489
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
108
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
109 /** Check for presence of a certificate in the pool using unique ID */
18493
a4ee6630e3fb - cert_in_pool_by_id is now just cert_in_pool; finding the uniqueID of the Certificate wanted is entirely the caller's problem
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18490
diff changeset
110 gboolean (* cert_in_pool)(const gchar *id);
18489
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
111 /** Retrieve a PurpleCertificate from the pool */
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
112 PurpleCertificate * (* get_cert)(const gchar *id);
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
113 /** Add a certificate to the pool. Must overwrite any other
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
114 * certificates sharing the same ID in the pool.
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
115 * @return TRUE if the operation succeeded, otherwise FALSE
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
116 */
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
117 gboolean (* put_cert)(PurpleCertificate *crt);
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
118 };
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
119
17506
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
120 /** A certificate type
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
121 *
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
122 * A CertificateScheme must implement all of the fields in the structure,
18456
1971d0938744 - Documentation correction
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18454
diff changeset
123 * and register it using purple_certificate_register_scheme()
17506
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
124 *
17508
65f10c9a063b - Fixed a comment
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17506
diff changeset
125 * There may be only ONE CertificateScheme provided for each certificate
65f10c9a063b - Fixed a comment
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17506
diff changeset
126 * type, as specified by the "name" field.
17506
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
127 */
18248
8f462eaffecd - Style issues
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18247
diff changeset
128 struct _PurpleCertificateScheme
17506
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
129 {
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
130 /** Name of the certificate type
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
131 * ex: "x509", "pgp", etc.
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
132 * This must be globally unique - you may not register more than one
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
133 * CertificateScheme of the same name at a time.
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
134 */
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
135 gchar * name;
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
136
18247
d9f7c426dbc9 - Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17509
diff changeset
137 /** User-friendly name for this type
d9f7c426dbc9 - Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17509
diff changeset
138 * ex: N_("X.509 Certificates")
18448
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
139 * When this is displayed anywhere, it should be i18ned
18489
591ff6f5dca7 - Add CertificatePool struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18481
diff changeset
140 * ex: _(scheme->fullname)
18247
d9f7c426dbc9 - Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17509
diff changeset
141 */
d9f7c426dbc9 - Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17509
diff changeset
142 gchar * fullname;
d9f7c426dbc9 - Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17509
diff changeset
143
d9f7c426dbc9 - Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17509
diff changeset
144 /** Imports a certificate from a file
d9f7c426dbc9 - Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17509
diff changeset
145 *
d9f7c426dbc9 - Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17509
diff changeset
146 * @param filename File to import the certificate from
d9f7c426dbc9 - Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17509
diff changeset
147 * @return Pointer to the newly allocated Certificate struct
d9f7c426dbc9 - Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17509
diff changeset
148 * or NULL on failure.
d9f7c426dbc9 - Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17509
diff changeset
149 */
18249
21467a007ea7 - Eliminate compiler warning
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18248
diff changeset
150 PurpleCertificate * (* import_certificate)(const gchar * filename);
18247
d9f7c426dbc9 - Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17509
diff changeset
151
d9f7c426dbc9 - Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17509
diff changeset
152 /** Destroys and frees a Certificate structure
d9f7c426dbc9 - Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17509
diff changeset
153 *
d9f7c426dbc9 - Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17509
diff changeset
154 * Destroys a Certificate's internal data structures and calls
d9f7c426dbc9 - Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17509
diff changeset
155 * free(crt)
d9f7c426dbc9 - Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17509
diff changeset
156 *
d9f7c426dbc9 - Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17509
diff changeset
157 * @param crt Certificate instance to be destroyed. It WILL NOT be
d9f7c426dbc9 - Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17509
diff changeset
158 * destroyed if it is not of the correct
d9f7c426dbc9 - Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17509
diff changeset
159 * CertificateScheme. Can be NULL
d9f7c426dbc9 - Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents: 17509
diff changeset
160 */
18248
8f462eaffecd - Style issues
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18247
diff changeset
161 void (* destroy_certificate)(PurpleCertificate * crt);
18454
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
162
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
163 /**
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
164 * Retrieves the certificate public key fingerprint using SHA1
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
165 *
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
166 * @param crt Certificate instance
18457
e9e60bed8906 - More documentation
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18456
diff changeset
167 * @return Binary representation of SHA1 hash - must be freed using
e9e60bed8906 - More documentation
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18456
diff changeset
168 * g_byte_array_free()
18454
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
169 */
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
170 GByteArray * (* get_fingerprint_sha1)(PurpleCertificate *crt);
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
171
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
172 /**
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
173 * Reads "who the certificate is assigned to"
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
174 *
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
175 * For SSL X.509 certificates, this is something like
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
176 * "gmail.com" or "jabber.org"
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
177 *
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
178 * @param crt Certificate instance
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
179 * @return Newly allocated string specifying "whose certificate this
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
180 * is"
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
181 */
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
182 gchar * (* get_certificate_subject)(PurpleCertificate *crt);
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
183
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
184 /**
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
185 * Retrieves a unique certificate identifier
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
186 *
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
187 * @param crt Certificate instance
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
188 * @return Newly allocated string that can be used to uniquely
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
189 * identify the certificate.
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
190 */
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
191 gchar * (* get_unique_id)(PurpleCertificate *crt);
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
192
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
193 /**
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
194 * Retrieves a unique identifier for the certificate's issuer
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
195 *
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
196 * @param crt Certificate instance
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
197 * @return Newly allocated string that can be used to uniquely
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
198 * identify the issuer's certificate.
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
199 */
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
200 gchar * (* get_issuer_unique_id)(PurpleCertificate *crt);
9a56a88152b9 - Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18453
diff changeset
201
18481
d220d85caaf1 - Add purple_certificate_get_subject_name and associated libpurple
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18477
diff changeset
202 /**
d220d85caaf1 - Add purple_certificate_get_subject_name and associated libpurple
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18477
diff changeset
203 * Gets the certificate subject's name
d220d85caaf1 - Add purple_certificate_get_subject_name and associated libpurple
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18477
diff changeset
204 *
d220d85caaf1 - Add purple_certificate_get_subject_name and associated libpurple
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18477
diff changeset
205 * For X.509, this is the "Common Name" field, as we're only using it
d220d85caaf1 - Add purple_certificate_get_subject_name and associated libpurple
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18477
diff changeset
206 * for hostname verification at the moment
d220d85caaf1 - Add purple_certificate_get_subject_name and associated libpurple
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18477
diff changeset
207 *
d220d85caaf1 - Add purple_certificate_get_subject_name and associated libpurple
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18477
diff changeset
208 * @see purple_certificate_get_subject_name()
d220d85caaf1 - Add purple_certificate_get_subject_name and associated libpurple
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18477
diff changeset
209 *
d220d85caaf1 - Add purple_certificate_get_subject_name and associated libpurple
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18477
diff changeset
210 * @param crt Certificate instance
d220d85caaf1 - Add purple_certificate_get_subject_name and associated libpurple
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18477
diff changeset
211 * @return Newly allocated string with the certificate subject.
d220d85caaf1 - Add purple_certificate_get_subject_name and associated libpurple
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18477
diff changeset
212 */
d220d85caaf1 - Add purple_certificate_get_subject_name and associated libpurple
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18477
diff changeset
213 gchar * (* get_subject_name)(PurpleCertificate *crt);
17506
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
214 /* TODO: Fill out this structure */
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
215 };
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
216
18448
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
217 /** A set of operations used to provide logic for verifying a Certificate's
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
218 * authenticity.
18461
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
219 *
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
220 * A Verifier provider must fill out these fields, then register it using
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
221 * purple_certificate_register_verifier()
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
222 *
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
223 * The (scheme_name, name) value must be unique for each Verifier - you may not
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
224 * register more than one Verifier of the same name for each Scheme
18448
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
225 */
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
226 struct _PurpleCertificateVerifier
18460
cceca1e961ad - Fill out CertVerifier struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18457
diff changeset
227 {
cceca1e961ad - Fill out CertVerifier struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18457
diff changeset
228 /** Name of the scheme this Verifier operates on
18448
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
229 *
18460
cceca1e961ad - Fill out CertVerifier struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18457
diff changeset
230 * The scheme will be looked up by name when a Request is generated
cceca1e961ad - Fill out CertVerifier struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18457
diff changeset
231 * using this Verifier
18448
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
232 */
18460
cceca1e961ad - Fill out CertVerifier struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18457
diff changeset
233 gchar *scheme_name;
18461
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
234
18471
2eb86930cfaf - Reorder struct for clarity
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18470
diff changeset
235 /** Name of the Verifier - case insensitive */
2eb86930cfaf - Reorder struct for clarity
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18470
diff changeset
236 gchar *name;
2eb86930cfaf - Reorder struct for clarity
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18470
diff changeset
237
18461
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
238 /**
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
239 * Start the verification process
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
240 *
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
241 * To be called from purple_certificate_verify once it has
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
242 * constructed the request. This will use the information in the
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
243 * given VerificationRequest to check the certificate and callback
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
244 * the requester with the verification results.
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
245 *
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
246 * @param vrq Request to process
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
247 */
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
248 void (* start_verification)(PurpleCertificateVerificationRequest *vrq);
18467
6bd91f3acf84 - Add purple_certificate_verify_destroy and associated machinery
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18466
diff changeset
249
6bd91f3acf84 - Add purple_certificate_verify_destroy and associated machinery
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18466
diff changeset
250 /**
6bd91f3acf84 - Add purple_certificate_verify_destroy and associated machinery
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18466
diff changeset
251 * Destroy a completed Request under this Verifier
18472
c7b825e0f75b - libpurple is now responsible for some cleanup and final deletion of a
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18471
diff changeset
252 * The function pointed to here is only responsible for cleaning up
c7b825e0f75b - libpurple is now responsible for some cleanup and final deletion of a
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18471
diff changeset
253 * whatever PurpleCertificateVerificationRequest::data points to.
c7b825e0f75b - libpurple is now responsible for some cleanup and final deletion of a
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18471
diff changeset
254 * It should not call free(vrq)
18467
6bd91f3acf84 - Add purple_certificate_verify_destroy and associated machinery
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18466
diff changeset
255 *
6bd91f3acf84 - Add purple_certificate_verify_destroy and associated machinery
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18466
diff changeset
256 * @param vrq Request to destroy
6bd91f3acf84 - Add purple_certificate_verify_destroy and associated machinery
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18466
diff changeset
257 */
6bd91f3acf84 - Add purple_certificate_verify_destroy and associated machinery
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18466
diff changeset
258 void (* destroy_request)(PurpleCertificateVerificationRequest *vrq);
18448
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
259 };
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
260
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
261 /** Structure for a single certificate request
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
262 *
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
263 * Useful for keeping track of the state of a verification that involves
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
264 * several steps
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
265 */
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
266 struct _PurpleCertificateVerificationRequest
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
267 {
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
268 /** Reference to the verification logic used */
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
269 PurpleCertificateVerifier *verifier;
18461
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
270 /** Reference to the scheme used.
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
271 *
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
272 * This is looked up from the Verifier when the Request is generated
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
273 */
18462
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
274 PurpleCertificateScheme *scheme;
18448
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
275
18460
cceca1e961ad - Fill out CertVerifier struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18457
diff changeset
276 /**
cceca1e961ad - Fill out CertVerifier struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18457
diff changeset
277 * Name to check that the certificate is issued to
18451
304d2fa12f6a - purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18448
diff changeset
278 *
304d2fa12f6a - purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18448
diff changeset
279 * For X.509 certificates, this is the Common Name
304d2fa12f6a - purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18448
diff changeset
280 */
304d2fa12f6a - purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18448
diff changeset
281 gchar *subject_name;
304d2fa12f6a - purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18448
diff changeset
282
304d2fa12f6a - purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18448
diff changeset
283 /** List of certificates in the chain to be verified (such as that returned by purple_ssl_get_peer_certificates )
18448
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
284 *
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
285 * This is most relevant for X.509 certificates used in SSL sessions.
18451
304d2fa12f6a - purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18448
diff changeset
286 * The list order should be: certificate, issuer, issuer's issuer, etc.
18448
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
287 */
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
288 GList *cert_chain;
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
289
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
290 /** Internal data used by the Verifier code */
18460
cceca1e961ad - Fill out CertVerifier struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18457
diff changeset
291 gpointer data;
cceca1e961ad - Fill out CertVerifier struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18457
diff changeset
292
cceca1e961ad - Fill out CertVerifier struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18457
diff changeset
293 /** Function to call with the verification result */
cceca1e961ad - Fill out CertVerifier struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18457
diff changeset
294 PurpleCertificateVerifiedCallback cb;
cceca1e961ad - Fill out CertVerifier struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18457
diff changeset
295 /** Data to pass to the post-verification callback */
cceca1e961ad - Fill out CertVerifier struct
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18457
diff changeset
296 gpointer cb_data;
18448
961dae46f969 - More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18446
diff changeset
297 };
17506
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
298
18465
e3f061608f7b - Documentation segmentation
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18462
diff changeset
299 /*****************************************************************************/
e3f061608f7b - Documentation segmentation
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18462
diff changeset
300 /** @name PurpleCertificate API */
e3f061608f7b - Documentation segmentation
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18462
diff changeset
301 /*****************************************************************************/
e3f061608f7b - Documentation segmentation
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18462
diff changeset
302 /*@{*/
e3f061608f7b - Documentation segmentation
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18462
diff changeset
303
18462
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
304 /**
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
305 * Constructs a verification request and passed control to the specified Verifier
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
306 *
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
307 * It is possible that the callback will be called immediately upon calling
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
308 * this function. Plan accordingly.
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
309 *
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
310 * @param verifier Verification logic to use.
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
311 * @see purple_certificate_find_verifier()
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
312 *
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
313 * @param subject_name Name that should match the first certificate in the
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
314 * chain for the certificate to be valid. Will be strdup'd
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
315 * into the Request struct
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
316 *
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
317 * @param cert_chain Certificate chain to check. If there is more than one
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
318 * certificate in the chain (X.509), the peer's
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
319 * certificate comes first, then the issuer/signer's
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
320 * certificate, etc.
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
321 *
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
322 * @param cb Callback function to be called with whether the
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
323 * certificate was approved or not.
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
324 * @param cb_data User-defined data for the above.
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
325 */
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
326 void
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
327 purple_certificate_verify (PurpleCertificateVerifier *verifier,
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
328 const gchar *subject_name, GList *cert_chain,
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
329 PurpleCertificateVerifiedCallback cb,
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
330 gpointer cb_data);
2c6d71addbdb - purple_certificate_verify now takes a Verifier argument, creates its
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18461
diff changeset
331
18466
881319eb171d - Add certificate_destroy and certificate_destroy_list
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18465
diff changeset
332 /**
18467
6bd91f3acf84 - Add purple_certificate_verify_destroy and associated machinery
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18466
diff changeset
333 * Disposes of a VerificationRequest once it is complete
6bd91f3acf84 - Add purple_certificate_verify_destroy and associated machinery
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18466
diff changeset
334 *
6bd91f3acf84 - Add purple_certificate_verify_destroy and associated machinery
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18466
diff changeset
335 * @param vrq Request to destroy. Will be free()'d.
6bd91f3acf84 - Add purple_certificate_verify_destroy and associated machinery
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18466
diff changeset
336 * The certificate chain involved will also be destroyed.
6bd91f3acf84 - Add purple_certificate_verify_destroy and associated machinery
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18466
diff changeset
337 */
6bd91f3acf84 - Add purple_certificate_verify_destroy and associated machinery
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18466
diff changeset
338 void
6bd91f3acf84 - Add purple_certificate_verify_destroy and associated machinery
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18466
diff changeset
339 purple_certificate_verify_destroy (PurpleCertificateVerificationRequest *vrq);
6bd91f3acf84 - Add purple_certificate_verify_destroy and associated machinery
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18466
diff changeset
340
6bd91f3acf84 - Add purple_certificate_verify_destroy and associated machinery
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18466
diff changeset
341 /**
18466
881319eb171d - Add certificate_destroy and certificate_destroy_list
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18465
diff changeset
342 * Destroys and free()'s a Certificate
881319eb171d - Add certificate_destroy and certificate_destroy_list
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18465
diff changeset
343 *
881319eb171d - Add certificate_destroy and certificate_destroy_list
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18465
diff changeset
344 * @param crt Instance to destroy. May be NULL.
881319eb171d - Add certificate_destroy and certificate_destroy_list
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18465
diff changeset
345 */
881319eb171d - Add certificate_destroy and certificate_destroy_list
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18465
diff changeset
346 void
881319eb171d - Add certificate_destroy and certificate_destroy_list
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18465
diff changeset
347 purple_certificate_destroy (PurpleCertificate *crt);
881319eb171d - Add certificate_destroy and certificate_destroy_list
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18465
diff changeset
348
881319eb171d - Add certificate_destroy and certificate_destroy_list
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18465
diff changeset
349 /**
881319eb171d - Add certificate_destroy and certificate_destroy_list
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18465
diff changeset
350 * Destroy an entire list of Certificate instances and the containing list
881319eb171d - Add certificate_destroy and certificate_destroy_list
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18465
diff changeset
351 *
881319eb171d - Add certificate_destroy and certificate_destroy_list
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18465
diff changeset
352 * @param crt_list List of certificates to destroy. May be NULL.
881319eb171d - Add certificate_destroy and certificate_destroy_list
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18465
diff changeset
353 */
881319eb171d - Add certificate_destroy and certificate_destroy_list
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18465
diff changeset
354 void
881319eb171d - Add certificate_destroy and certificate_destroy_list
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18465
diff changeset
355 purple_certificate_destroy_list (GList * crt_list);
881319eb171d - Add certificate_destroy and certificate_destroy_list
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18465
diff changeset
356
18473
a7251d502f6a - Add purple_certificate_get_fingerprint_sha1
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18472
diff changeset
357 /**
a7251d502f6a - Add purple_certificate_get_fingerprint_sha1
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18472
diff changeset
358 * Retrieves the certificate public key fingerprint using SHA1.
a7251d502f6a - Add purple_certificate_get_fingerprint_sha1
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18472
diff changeset
359 *
a7251d502f6a - Add purple_certificate_get_fingerprint_sha1
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18472
diff changeset
360 * @param crt Certificate instance
a7251d502f6a - Add purple_certificate_get_fingerprint_sha1
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18472
diff changeset
361 * @return Binary representation of the hash. You are responsible for free()ing
a7251d502f6a - Add purple_certificate_get_fingerprint_sha1
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18472
diff changeset
362 * this.
a7251d502f6a - Add purple_certificate_get_fingerprint_sha1
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18472
diff changeset
363 * @see purple_base16_encode_chunked()
a7251d502f6a - Add purple_certificate_get_fingerprint_sha1
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18472
diff changeset
364 */
a7251d502f6a - Add purple_certificate_get_fingerprint_sha1
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18472
diff changeset
365 GByteArray *
a7251d502f6a - Add purple_certificate_get_fingerprint_sha1
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18472
diff changeset
366 purple_certificate_get_fingerprint_sha1(PurpleCertificate *crt);
a7251d502f6a - Add purple_certificate_get_fingerprint_sha1
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18472
diff changeset
367
18481
d220d85caaf1 - Add purple_certificate_get_subject_name and associated libpurple
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18477
diff changeset
368
d220d85caaf1 - Add purple_certificate_get_subject_name and associated libpurple
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18477
diff changeset
369 /**
d220d85caaf1 - Add purple_certificate_get_subject_name and associated libpurple
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18477
diff changeset
370 * Gets the certificate subject's name
d220d85caaf1 - Add purple_certificate_get_subject_name and associated libpurple
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18477
diff changeset
371 *
d220d85caaf1 - Add purple_certificate_get_subject_name and associated libpurple
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18477
diff changeset
372 * For X.509, this is the "Common Name" field, as we're only using it
d220d85caaf1 - Add purple_certificate_get_subject_name and associated libpurple
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18477
diff changeset
373 * for hostname verification at the moment
d220d85caaf1 - Add purple_certificate_get_subject_name and associated libpurple
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18477
diff changeset
374 *
d220d85caaf1 - Add purple_certificate_get_subject_name and associated libpurple
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18477
diff changeset
375 * @param crt Certificate instance
d220d85caaf1 - Add purple_certificate_get_subject_name and associated libpurple
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18477
diff changeset
376 * @return Newly allocated string with the certificate subject.
d220d85caaf1 - Add purple_certificate_get_subject_name and associated libpurple
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18477
diff changeset
377 */
d220d85caaf1 - Add purple_certificate_get_subject_name and associated libpurple
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18477
diff changeset
378 gchar *
d220d85caaf1 - Add purple_certificate_get_subject_name and associated libpurple
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18477
diff changeset
379 purple_certificate_get_subject_name(PurpleCertificate *crt);
d220d85caaf1 - Add purple_certificate_get_subject_name and associated libpurple
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18477
diff changeset
380
18465
e3f061608f7b - Documentation segmentation
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18462
diff changeset
381 /*@}*/
e3f061608f7b - Documentation segmentation
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18462
diff changeset
382
17506
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
383 /*****************************************************************************/
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
384 /** @name PurpleCertificate Subsystem API */
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
385 /*****************************************************************************/
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
386 /*@{*/
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
387
18470
6a1deea19882 - Add purple_certificate_register_builtins
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18467
diff changeset
388 /**
18477
47243c0d52c6 - Certificate system now has init and uninit like other systems
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18473
diff changeset
389 * Initialize the certificate system
18470
6a1deea19882 - Add purple_certificate_register_builtins
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18467
diff changeset
390 */
6a1deea19882 - Add purple_certificate_register_builtins
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18467
diff changeset
391 void
18477
47243c0d52c6 - Certificate system now has init and uninit like other systems
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18473
diff changeset
392 purple_certificate_init(void);
47243c0d52c6 - Certificate system now has init and uninit like other systems
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18473
diff changeset
393
47243c0d52c6 - Certificate system now has init and uninit like other systems
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18473
diff changeset
394 /**
47243c0d52c6 - Certificate system now has init and uninit like other systems
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18473
diff changeset
395 * Un-initialize the certificate system
47243c0d52c6 - Certificate system now has init and uninit like other systems
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18473
diff changeset
396 */
47243c0d52c6 - Certificate system now has init and uninit like other systems
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18473
diff changeset
397 void
47243c0d52c6 - Certificate system now has init and uninit like other systems
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18473
diff changeset
398 purple_certificate_uninit(void);
18470
6a1deea19882 - Add purple_certificate_register_builtins
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18467
diff changeset
399
18251
41e00264c49d - Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18249
diff changeset
400 /** Look up a registered CertificateScheme by name
41e00264c49d - Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18249
diff changeset
401 * @param name The scheme name. Case insensitive.
41e00264c49d - Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18249
diff changeset
402 * @return Pointer to the located Scheme, or NULL if it isn't found.
41e00264c49d - Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18249
diff changeset
403 */
41e00264c49d - Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18249
diff changeset
404 PurpleCertificateScheme *
41e00264c49d - Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18249
diff changeset
405 purple_certificate_find_scheme(const gchar *name);
41e00264c49d - Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18249
diff changeset
406
41e00264c49d - Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18249
diff changeset
407 /** Register a CertificateScheme with libpurple
41e00264c49d - Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18249
diff changeset
408 *
41e00264c49d - Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18249
diff changeset
409 * No two schemes can be registered with the same name; this function enforces
41e00264c49d - Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18249
diff changeset
410 * that.
41e00264c49d - Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18249
diff changeset
411 *
41e00264c49d - Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18249
diff changeset
412 * @param scheme Pointer to the scheme to register.
41e00264c49d - Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18249
diff changeset
413 * @return TRUE if the scheme was successfully added, otherwise FALSE
41e00264c49d - Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18249
diff changeset
414 */
41e00264c49d - Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18249
diff changeset
415 gboolean
41e00264c49d - Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18249
diff changeset
416 purple_certificate_register_scheme(PurpleCertificateScheme *scheme);
41e00264c49d - Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18249
diff changeset
417
18446
3e79caab7088 - Add unregister_scheme
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18251
diff changeset
418 /** Unregister a CertificateScheme from libpurple
3e79caab7088 - Add unregister_scheme
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18251
diff changeset
419 *
3e79caab7088 - Add unregister_scheme
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18251
diff changeset
420 * @param scheme Scheme to unregister.
3e79caab7088 - Add unregister_scheme
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18251
diff changeset
421 * If the scheme is not registered, this is a no-op.
3e79caab7088 - Add unregister_scheme
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18251
diff changeset
422 *
3e79caab7088 - Add unregister_scheme
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18251
diff changeset
423 * @return TRUE if the unregister completed successfully
3e79caab7088 - Add unregister_scheme
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18251
diff changeset
424 */
3e79caab7088 - Add unregister_scheme
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18251
diff changeset
425 gboolean
3e79caab7088 - Add unregister_scheme
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18251
diff changeset
426 purple_certificate_unregister_scheme(PurpleCertificateScheme *scheme);
3e79caab7088 - Add unregister_scheme
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18251
diff changeset
427
18461
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
428 /** Look up a registered PurpleCertificateVerifier by scheme and name
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
429 * @param scheme_name Scheme name. Case insensitive.
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
430 * @param ver_name The verifier name. Case insensitive.
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
431 * @return Pointer to the located Verifier, or NULL if it isn't found.
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
432 */
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
433 PurpleCertificateVerifier *
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
434 purple_certificate_find_verifier(const gchar *scheme_name, const gchar *ver_name);
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
435
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
436
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
437 /**
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
438 * Register a CertificateVerifier with libpurple
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
439 *
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
440 * @param vr Verifier to register.
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
441 * @return TRUE if register succeeded, otherwise FALSE
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
442 */
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
443 gboolean
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
444 purple_certificate_register_verifier(PurpleCertificateVerifier *vr);
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
445
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
446 /**
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
447 * Unregister a CertificateVerifier with libpurple
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
448 *
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
449 * @param vr Verifier to unregister.
18490
691b0b16f8be - Add find, register, and unregister for CertificatePools
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18489
diff changeset
450 * @return TRUE if unregister succeeded, otherwise FALSE
18461
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
451 */
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
452 gboolean
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
453 purple_certificate_unregister_verifier(PurpleCertificateVerifier *vr);
8ae1cd456532 - CertificateVerifier register/unregister/find
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18460
diff changeset
454
18490
691b0b16f8be - Add find, register, and unregister for CertificatePools
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18489
diff changeset
455 /** Look up a registered PurpleCertificatePool by scheme and name
691b0b16f8be - Add find, register, and unregister for CertificatePools
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18489
diff changeset
456 * @param scheme_name Scheme name. Case insensitive.
691b0b16f8be - Add find, register, and unregister for CertificatePools
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18489
diff changeset
457 * @param pool_name Pool name. Case insensitive.
691b0b16f8be - Add find, register, and unregister for CertificatePools
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18489
diff changeset
458 * @return Pointer to the located Pool, or NULL if it isn't found.
691b0b16f8be - Add find, register, and unregister for CertificatePools
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18489
diff changeset
459 */
691b0b16f8be - Add find, register, and unregister for CertificatePools
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18489
diff changeset
460 PurpleCertificatePool *
691b0b16f8be - Add find, register, and unregister for CertificatePools
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18489
diff changeset
461 purple_certificate_find_pool(const gchar *scheme_name, const gchar *pool_name);
691b0b16f8be - Add find, register, and unregister for CertificatePools
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18489
diff changeset
462
691b0b16f8be - Add find, register, and unregister for CertificatePools
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18489
diff changeset
463 /**
691b0b16f8be - Add find, register, and unregister for CertificatePools
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18489
diff changeset
464 * Register a CertificatePool with libpurple and call its init function
691b0b16f8be - Add find, register, and unregister for CertificatePools
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18489
diff changeset
465 *
691b0b16f8be - Add find, register, and unregister for CertificatePools
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18489
diff changeset
466 * @param pool Pool to register.
691b0b16f8be - Add find, register, and unregister for CertificatePools
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18489
diff changeset
467 * @return TRUE if the register succeeded, otherwise FALSE
691b0b16f8be - Add find, register, and unregister for CertificatePools
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18489
diff changeset
468 */
691b0b16f8be - Add find, register, and unregister for CertificatePools
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18489
diff changeset
469 gboolean
691b0b16f8be - Add find, register, and unregister for CertificatePools
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18489
diff changeset
470 purple_certificate_register_pool(PurpleCertificatePool *pool);
691b0b16f8be - Add find, register, and unregister for CertificatePools
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18489
diff changeset
471
691b0b16f8be - Add find, register, and unregister for CertificatePools
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18489
diff changeset
472 /**
691b0b16f8be - Add find, register, and unregister for CertificatePools
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18489
diff changeset
473 * Unregister a CertificatePool with libpurple and call its uninit function
691b0b16f8be - Add find, register, and unregister for CertificatePools
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18489
diff changeset
474 *
691b0b16f8be - Add find, register, and unregister for CertificatePools
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18489
diff changeset
475 * @param pool Pool to unregister.
691b0b16f8be - Add find, register, and unregister for CertificatePools
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18489
diff changeset
476 * @return TRUE if the unregister succeeded, otherwise FALSE
691b0b16f8be - Add find, register, and unregister for CertificatePools
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18489
diff changeset
477 */
691b0b16f8be - Add find, register, and unregister for CertificatePools
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18489
diff changeset
478 gboolean
691b0b16f8be - Add find, register, and unregister for CertificatePools
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18489
diff changeset
479 purple_certificate_unregister_pool(PurpleCertificatePool *pool);
17506
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
480
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
481 /*@}*/
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
482
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
483
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
484 #ifdef __cplusplus
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
485 }
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
486 #endif /* __cplusplus */
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
487
eff6bdd382f3 - Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff changeset
488 #endif /* _PURPLE_CERTIFICATE_H */

mercurial