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, write to the
17 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18 * Boston, MA 02111-1307, USA.
20 * Author: Stef Walter <stefw@collabora.co.uk>
23 #ifndef __G_TLS_DATABASE_H__
24 #define __G_TLS_DATABASE_H__
26 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
27 #error "Only <gio/gio.h> can be included directly."
30 #include <gio/giotypes.h>
34 #define G_TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVER "1.3.6.1.5.5.7.3.1"
35 #define G_TLS_DATABASE_PURPOSE_AUTHENTICATE_CLIENT "1.3.6.1.5.5.7.3.2"
37 #define G_TYPE_TLS_DATABASE (g_tls_database_get_type ())
38 #define G_TLS_DATABASE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_TLS_DATABASE, GTlsDatabase))
39 #define G_TLS_DATABASE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_TLS_DATABASE, GTlsDatabaseClass))
40 #define G_IS_TLS_DATABASE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_TLS_DATABASE))
41 #define G_IS_TLS_DATABASE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_TLS_DATABASE))
42 #define G_TLS_DATABASE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), G_TYPE_TLS_DATABASE, GTlsDatabaseClass))
44 typedef struct _GTlsDatabaseClass GTlsDatabaseClass;
45 typedef struct _GTlsDatabasePrivate GTlsDatabasePrivate;
49 GObject parent_instance;
51 GTlsDatabasePrivate *priv;
54 struct _GTlsDatabaseClass
56 GObjectClass parent_class;
60 GTlsCertificateFlags (*verify_chain) (GTlsDatabase *self,
61 GTlsCertificate *chain,
63 GSocketConnectable *identity,
64 GTlsInteraction *interaction,
65 GTlsDatabaseVerifyFlags flags,
66 GCancellable *cancellable,
69 void (*verify_chain_async) (GTlsDatabase *self,
70 GTlsCertificate *chain,
72 GSocketConnectable *identity,
73 GTlsInteraction *interaction,
74 GTlsDatabaseVerifyFlags flags,
75 GCancellable *cancellable,
76 GAsyncReadyCallback callback,
79 GTlsCertificateFlags (*verify_chain_finish) (GTlsDatabase *self,
83 gchar* (*create_certificate_handle) (GTlsDatabase *self,
84 GTlsCertificate *certificate);
86 GTlsCertificate* (*lookup_certificate_for_handle) (GTlsDatabase *self,
88 GTlsInteraction *interaction,
89 GTlsDatabaseLookupFlags flags,
90 GCancellable *cancellable,
93 void (*lookup_certificate_for_handle_async) (GTlsDatabase *self,
95 GTlsInteraction *interaction,
96 GTlsDatabaseLookupFlags flags,
97 GCancellable *cancellable,
98 GAsyncReadyCallback callback,
101 GTlsCertificate* (*lookup_certificate_for_handle_finish) (GTlsDatabase *self,
102 GAsyncResult *result,
105 GTlsCertificate* (*lookup_certificate_issuer) (GTlsDatabase *self,
106 GTlsCertificate *certificate,
107 GTlsInteraction *interaction,
108 GTlsDatabaseLookupFlags flags,
109 GCancellable *cancellable,
112 void (*lookup_certificate_issuer_async) (GTlsDatabase *self,
113 GTlsCertificate *certificate,
114 GTlsInteraction *interaction,
115 GTlsDatabaseLookupFlags flags,
116 GCancellable *cancellable,
117 GAsyncReadyCallback callback,
120 GTlsCertificate* (*lookup_certificate_issuer_finish) (GTlsDatabase *self,
121 GAsyncResult *result,
124 GList* (*lookup_certificates_issued_by) (GTlsDatabase *self,
125 GByteArray *issuer_raw_dn,
126 GTlsInteraction *interaction,
127 GTlsDatabaseLookupFlags flags,
128 GCancellable *cancellable,
131 void (*lookup_certificates_issued_by_async) (GTlsDatabase *self,
132 GByteArray *issuer_raw_dn,
133 GTlsInteraction *interaction,
134 GTlsDatabaseLookupFlags flags,
135 GCancellable *cancellable,
136 GAsyncReadyCallback callback,
139 GList* (*lookup_certificates_issued_by_finish) (GTlsDatabase *self,
140 GAsyncResult *result,
144 /* Padding for future expansion */
145 gpointer padding[16];
148 GLIB_AVAILABLE_IN_ALL
149 GType g_tls_database_get_type (void) G_GNUC_CONST;
151 GLIB_AVAILABLE_IN_ALL
152 GTlsCertificateFlags g_tls_database_verify_chain (GTlsDatabase *self,
153 GTlsCertificate *chain,
154 const gchar *purpose,
155 GSocketConnectable *identity,
156 GTlsInteraction *interaction,
157 GTlsDatabaseVerifyFlags flags,
158 GCancellable *cancellable,
161 GLIB_AVAILABLE_IN_ALL
162 void g_tls_database_verify_chain_async (GTlsDatabase *self,
163 GTlsCertificate *chain,
164 const gchar *purpose,
165 GSocketConnectable *identity,
166 GTlsInteraction *interaction,
167 GTlsDatabaseVerifyFlags flags,
168 GCancellable *cancellable,
169 GAsyncReadyCallback callback,
172 GLIB_AVAILABLE_IN_ALL
173 GTlsCertificateFlags g_tls_database_verify_chain_finish (GTlsDatabase *self,
174 GAsyncResult *result,
177 GLIB_AVAILABLE_IN_ALL
178 gchar* g_tls_database_create_certificate_handle (GTlsDatabase *self,
179 GTlsCertificate *certificate);
181 GLIB_AVAILABLE_IN_ALL
182 GTlsCertificate* g_tls_database_lookup_certificate_for_handle (GTlsDatabase *self,
184 GTlsInteraction *interaction,
185 GTlsDatabaseLookupFlags flags,
186 GCancellable *cancellable,
189 GLIB_AVAILABLE_IN_ALL
190 void g_tls_database_lookup_certificate_for_handle_async (GTlsDatabase *self,
192 GTlsInteraction *interaction,
193 GTlsDatabaseLookupFlags flags,
194 GCancellable *cancellable,
195 GAsyncReadyCallback callback,
198 GLIB_AVAILABLE_IN_ALL
199 GTlsCertificate* g_tls_database_lookup_certificate_for_handle_finish (GTlsDatabase *self,
200 GAsyncResult *result,
203 GLIB_AVAILABLE_IN_ALL
204 GTlsCertificate* g_tls_database_lookup_certificate_issuer (GTlsDatabase *self,
205 GTlsCertificate *certificate,
206 GTlsInteraction *interaction,
207 GTlsDatabaseLookupFlags flags,
208 GCancellable *cancellable,
211 GLIB_AVAILABLE_IN_ALL
212 void g_tls_database_lookup_certificate_issuer_async (GTlsDatabase *self,
213 GTlsCertificate *certificate,
214 GTlsInteraction *interaction,
215 GTlsDatabaseLookupFlags flags,
216 GCancellable *cancellable,
217 GAsyncReadyCallback callback,
220 GLIB_AVAILABLE_IN_ALL
221 GTlsCertificate* g_tls_database_lookup_certificate_issuer_finish (GTlsDatabase *self,
222 GAsyncResult *result,
225 GLIB_AVAILABLE_IN_ALL
226 GList* g_tls_database_lookup_certificates_issued_by (GTlsDatabase *self,
227 GByteArray *issuer_raw_dn,
228 GTlsInteraction *interaction,
229 GTlsDatabaseLookupFlags flags,
230 GCancellable *cancellable,
233 GLIB_AVAILABLE_IN_ALL
234 void g_tls_database_lookup_certificates_issued_by_async (GTlsDatabase *self,
235 GByteArray *issuer_raw_dn,
236 GTlsInteraction *interaction,
237 GTlsDatabaseLookupFlags flags,
238 GCancellable *cancellable,
239 GAsyncReadyCallback callback,
242 GLIB_AVAILABLE_IN_ALL
243 GList* g_tls_database_lookup_certificates_issued_by_finish (GTlsDatabase *self,
244 GAsyncResult *result,
249 #endif /* __G_TLS_DATABASE_H__ */