1 /* GIO - GLib Input, Output and Streaming Library
3 * Copyright (C) 2010 Collabora, Ltd.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
18 * Author: Stef Walter <stefw@collabora.co.uk>
21 #ifndef __G_TLS_DATABASE_H__
22 #define __G_TLS_DATABASE_H__
24 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
25 #error "Only <gio/gio.h> can be included directly."
28 #include <gio/giotypes.h>
32 #define G_TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVER "1.3.6.1.5.5.7.3.1"
33 #define G_TLS_DATABASE_PURPOSE_AUTHENTICATE_CLIENT "1.3.6.1.5.5.7.3.2"
35 #define G_TYPE_TLS_DATABASE (g_tls_database_get_type ())
36 #define G_TLS_DATABASE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_TLS_DATABASE, GTlsDatabase))
37 #define G_TLS_DATABASE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_TLS_DATABASE, GTlsDatabaseClass))
38 #define G_IS_TLS_DATABASE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_TLS_DATABASE))
39 #define G_IS_TLS_DATABASE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_TLS_DATABASE))
40 #define G_TLS_DATABASE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), G_TYPE_TLS_DATABASE, GTlsDatabaseClass))
42 typedef struct _GTlsDatabaseClass GTlsDatabaseClass
;
43 typedef struct _GTlsDatabasePrivate GTlsDatabasePrivate
;
47 GObject parent_instance
;
49 GTlsDatabasePrivate
*priv
;
52 struct _GTlsDatabaseClass
54 GObjectClass parent_class
;
58 GTlsCertificateFlags (*verify_chain
) (GTlsDatabase
*self
,
59 GTlsCertificate
*chain
,
61 GSocketConnectable
*identity
,
62 GTlsInteraction
*interaction
,
63 GTlsDatabaseVerifyFlags flags
,
64 GCancellable
*cancellable
,
67 void (*verify_chain_async
) (GTlsDatabase
*self
,
68 GTlsCertificate
*chain
,
70 GSocketConnectable
*identity
,
71 GTlsInteraction
*interaction
,
72 GTlsDatabaseVerifyFlags flags
,
73 GCancellable
*cancellable
,
74 GAsyncReadyCallback callback
,
77 GTlsCertificateFlags (*verify_chain_finish
) (GTlsDatabase
*self
,
81 gchar
* (*create_certificate_handle
) (GTlsDatabase
*self
,
82 GTlsCertificate
*certificate
);
84 GTlsCertificate
* (*lookup_certificate_for_handle
) (GTlsDatabase
*self
,
86 GTlsInteraction
*interaction
,
87 GTlsDatabaseLookupFlags flags
,
88 GCancellable
*cancellable
,
91 void (*lookup_certificate_for_handle_async
) (GTlsDatabase
*self
,
93 GTlsInteraction
*interaction
,
94 GTlsDatabaseLookupFlags flags
,
95 GCancellable
*cancellable
,
96 GAsyncReadyCallback callback
,
99 GTlsCertificate
* (*lookup_certificate_for_handle_finish
) (GTlsDatabase
*self
,
100 GAsyncResult
*result
,
103 GTlsCertificate
* (*lookup_certificate_issuer
) (GTlsDatabase
*self
,
104 GTlsCertificate
*certificate
,
105 GTlsInteraction
*interaction
,
106 GTlsDatabaseLookupFlags flags
,
107 GCancellable
*cancellable
,
110 void (*lookup_certificate_issuer_async
) (GTlsDatabase
*self
,
111 GTlsCertificate
*certificate
,
112 GTlsInteraction
*interaction
,
113 GTlsDatabaseLookupFlags flags
,
114 GCancellable
*cancellable
,
115 GAsyncReadyCallback callback
,
118 GTlsCertificate
* (*lookup_certificate_issuer_finish
) (GTlsDatabase
*self
,
119 GAsyncResult
*result
,
122 GList
* (*lookup_certificates_issued_by
) (GTlsDatabase
*self
,
123 GByteArray
*issuer_raw_dn
,
124 GTlsInteraction
*interaction
,
125 GTlsDatabaseLookupFlags flags
,
126 GCancellable
*cancellable
,
129 void (*lookup_certificates_issued_by_async
) (GTlsDatabase
*self
,
130 GByteArray
*issuer_raw_dn
,
131 GTlsInteraction
*interaction
,
132 GTlsDatabaseLookupFlags flags
,
133 GCancellable
*cancellable
,
134 GAsyncReadyCallback callback
,
137 GList
* (*lookup_certificates_issued_by_finish
) (GTlsDatabase
*self
,
138 GAsyncResult
*result
,
142 /* Padding for future expansion */
143 gpointer padding
[16];
146 GLIB_AVAILABLE_IN_ALL
147 GType
g_tls_database_get_type (void) G_GNUC_CONST
;
149 GLIB_AVAILABLE_IN_ALL
150 GTlsCertificateFlags
g_tls_database_verify_chain (GTlsDatabase
*self
,
151 GTlsCertificate
*chain
,
152 const gchar
*purpose
,
153 GSocketConnectable
*identity
,
154 GTlsInteraction
*interaction
,
155 GTlsDatabaseVerifyFlags flags
,
156 GCancellable
*cancellable
,
159 GLIB_AVAILABLE_IN_ALL
160 void g_tls_database_verify_chain_async (GTlsDatabase
*self
,
161 GTlsCertificate
*chain
,
162 const gchar
*purpose
,
163 GSocketConnectable
*identity
,
164 GTlsInteraction
*interaction
,
165 GTlsDatabaseVerifyFlags flags
,
166 GCancellable
*cancellable
,
167 GAsyncReadyCallback callback
,
170 GLIB_AVAILABLE_IN_ALL
171 GTlsCertificateFlags
g_tls_database_verify_chain_finish (GTlsDatabase
*self
,
172 GAsyncResult
*result
,
175 GLIB_AVAILABLE_IN_ALL
176 gchar
* g_tls_database_create_certificate_handle (GTlsDatabase
*self
,
177 GTlsCertificate
*certificate
);
179 GLIB_AVAILABLE_IN_ALL
180 GTlsCertificate
* g_tls_database_lookup_certificate_for_handle (GTlsDatabase
*self
,
182 GTlsInteraction
*interaction
,
183 GTlsDatabaseLookupFlags flags
,
184 GCancellable
*cancellable
,
187 GLIB_AVAILABLE_IN_ALL
188 void g_tls_database_lookup_certificate_for_handle_async (GTlsDatabase
*self
,
190 GTlsInteraction
*interaction
,
191 GTlsDatabaseLookupFlags flags
,
192 GCancellable
*cancellable
,
193 GAsyncReadyCallback callback
,
196 GLIB_AVAILABLE_IN_ALL
197 GTlsCertificate
* g_tls_database_lookup_certificate_for_handle_finish (GTlsDatabase
*self
,
198 GAsyncResult
*result
,
201 GLIB_AVAILABLE_IN_ALL
202 GTlsCertificate
* g_tls_database_lookup_certificate_issuer (GTlsDatabase
*self
,
203 GTlsCertificate
*certificate
,
204 GTlsInteraction
*interaction
,
205 GTlsDatabaseLookupFlags flags
,
206 GCancellable
*cancellable
,
209 GLIB_AVAILABLE_IN_ALL
210 void g_tls_database_lookup_certificate_issuer_async (GTlsDatabase
*self
,
211 GTlsCertificate
*certificate
,
212 GTlsInteraction
*interaction
,
213 GTlsDatabaseLookupFlags flags
,
214 GCancellable
*cancellable
,
215 GAsyncReadyCallback callback
,
218 GLIB_AVAILABLE_IN_ALL
219 GTlsCertificate
* g_tls_database_lookup_certificate_issuer_finish (GTlsDatabase
*self
,
220 GAsyncResult
*result
,
223 GLIB_AVAILABLE_IN_ALL
224 GList
* g_tls_database_lookup_certificates_issued_by (GTlsDatabase
*self
,
225 GByteArray
*issuer_raw_dn
,
226 GTlsInteraction
*interaction
,
227 GTlsDatabaseLookupFlags flags
,
228 GCancellable
*cancellable
,
231 GLIB_AVAILABLE_IN_ALL
232 void g_tls_database_lookup_certificates_issued_by_async (GTlsDatabase
*self
,
233 GByteArray
*issuer_raw_dn
,
234 GTlsInteraction
*interaction
,
235 GTlsDatabaseLookupFlags flags
,
236 GCancellable
*cancellable
,
237 GAsyncReadyCallback callback
,
240 GLIB_AVAILABLE_IN_ALL
241 GList
* g_tls_database_lookup_certificates_issued_by_finish (GTlsDatabase
*self
,
242 GAsyncResult
*result
,
247 #endif /* __G_TLS_DATABASE_H__ */