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 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
24 #error "Only <gio/gio.h> can be included directly."
27 #ifndef __G_TLS_DATABASE_H__
28 #define __G_TLS_DATABASE_H__
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 GType g_tls_database_get_type (void) G_GNUC_CONST;
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 void g_tls_database_verify_chain_async (GTlsDatabase *self,
160 GTlsCertificate *chain,
161 const gchar *purpose,
162 GSocketConnectable *identity,
163 GTlsInteraction *interaction,
164 GTlsDatabaseVerifyFlags flags,
165 GCancellable *cancellable,
166 GAsyncReadyCallback callback,
169 GTlsCertificateFlags g_tls_database_verify_chain_finish (GTlsDatabase *self,
170 GAsyncResult *result,
173 gchar* g_tls_database_create_certificate_handle (GTlsDatabase *self,
174 GTlsCertificate *certificate);
176 GTlsCertificate* g_tls_database_lookup_certificate_for_handle (GTlsDatabase *self,
178 GTlsInteraction *interaction,
179 GTlsDatabaseLookupFlags flags,
180 GCancellable *cancellable,
183 void g_tls_database_lookup_certificate_for_handle_async (GTlsDatabase *self,
185 GTlsInteraction *interaction,
186 GTlsDatabaseLookupFlags flags,
187 GCancellable *cancellable,
188 GAsyncReadyCallback callback,
191 GTlsCertificate* g_tls_database_lookup_certificate_for_handle_finish (GTlsDatabase *self,
192 GAsyncResult *result,
195 GTlsCertificate* g_tls_database_lookup_certificate_issuer (GTlsDatabase *self,
196 GTlsCertificate *certificate,
197 GTlsInteraction *interaction,
198 GTlsDatabaseLookupFlags flags,
199 GCancellable *cancellable,
202 void g_tls_database_lookup_certificate_issuer_async (GTlsDatabase *self,
203 GTlsCertificate *certificate,
204 GTlsInteraction *interaction,
205 GTlsDatabaseLookupFlags flags,
206 GCancellable *cancellable,
207 GAsyncReadyCallback callback,
210 GTlsCertificate* g_tls_database_lookup_certificate_issuer_finish (GTlsDatabase *self,
211 GAsyncResult *result,
214 GList* g_tls_database_lookup_certificates_issued_by (GTlsDatabase *self,
215 GByteArray *issuer_raw_dn,
216 GTlsInteraction *interaction,
217 GTlsDatabaseLookupFlags flags,
218 GCancellable *cancellable,
221 void g_tls_database_lookup_certificates_issued_by_async (GTlsDatabase *self,
222 GByteArray *issuer_raw_dn,
223 GTlsInteraction *interaction,
224 GTlsDatabaseLookupFlags flags,
225 GCancellable *cancellable,
226 GAsyncReadyCallback callback,
229 GList* g_tls_database_lookup_certificates_issued_by_finish (GTlsDatabase *self,
230 GAsyncResult *result,
235 #endif /* __G_TLS_DATABASE_H__ */