gtlsdatabase.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. /* GIO - GLib Input, Output and Streaming Library
  2. *
  3. * Copyright (C) 2010 Collabora, Ltd.
  4. *
  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.
  9. *
  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.
  14. *
  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/>.
  17. *
  18. * Author: Stef Walter <stefw@collabora.co.uk>
  19. */
  20. #ifndef __G_TLS_DATABASE_H__
  21. #define __G_TLS_DATABASE_H__
  22. #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
  23. #error "Only <gio/gio.h> can be included directly."
  24. #endif
  25. #include <gio/giotypes.h>
  26. G_BEGIN_DECLS
  27. #define G_TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVER "1.3.6.1.5.5.7.3.1"
  28. #define G_TLS_DATABASE_PURPOSE_AUTHENTICATE_CLIENT "1.3.6.1.5.5.7.3.2"
  29. #define G_TYPE_TLS_DATABASE (g_tls_database_get_type ())
  30. #define G_TLS_DATABASE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_TLS_DATABASE, GTlsDatabase))
  31. #define G_TLS_DATABASE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_TLS_DATABASE, GTlsDatabaseClass))
  32. #define G_IS_TLS_DATABASE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_TLS_DATABASE))
  33. #define G_IS_TLS_DATABASE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_TLS_DATABASE))
  34. #define G_TLS_DATABASE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), G_TYPE_TLS_DATABASE, GTlsDatabaseClass))
  35. typedef struct _GTlsDatabaseClass GTlsDatabaseClass;
  36. typedef struct _GTlsDatabasePrivate GTlsDatabasePrivate;
  37. struct _GTlsDatabase
  38. {
  39. GObject parent_instance;
  40. GTlsDatabasePrivate *priv;
  41. };
  42. struct _GTlsDatabaseClass
  43. {
  44. GObjectClass parent_class;
  45. /* virtual methods */
  46. GTlsCertificateFlags (*verify_chain) (GTlsDatabase *self,
  47. GTlsCertificate *chain,
  48. const gchar *purpose,
  49. GSocketConnectable *identity,
  50. GTlsInteraction *interaction,
  51. GTlsDatabaseVerifyFlags flags,
  52. GCancellable *cancellable,
  53. GError **error);
  54. void (*verify_chain_async) (GTlsDatabase *self,
  55. GTlsCertificate *chain,
  56. const gchar *purpose,
  57. GSocketConnectable *identity,
  58. GTlsInteraction *interaction,
  59. GTlsDatabaseVerifyFlags flags,
  60. GCancellable *cancellable,
  61. GAsyncReadyCallback callback,
  62. gpointer user_data);
  63. GTlsCertificateFlags (*verify_chain_finish) (GTlsDatabase *self,
  64. GAsyncResult *result,
  65. GError **error);
  66. gchar* (*create_certificate_handle) (GTlsDatabase *self,
  67. GTlsCertificate *certificate);
  68. GTlsCertificate* (*lookup_certificate_for_handle) (GTlsDatabase *self,
  69. const gchar *handle,
  70. GTlsInteraction *interaction,
  71. GTlsDatabaseLookupFlags flags,
  72. GCancellable *cancellable,
  73. GError **error);
  74. void (*lookup_certificate_for_handle_async) (GTlsDatabase *self,
  75. const gchar *handle,
  76. GTlsInteraction *interaction,
  77. GTlsDatabaseLookupFlags flags,
  78. GCancellable *cancellable,
  79. GAsyncReadyCallback callback,
  80. gpointer user_data);
  81. GTlsCertificate* (*lookup_certificate_for_handle_finish) (GTlsDatabase *self,
  82. GAsyncResult *result,
  83. GError **error);
  84. GTlsCertificate* (*lookup_certificate_issuer) (GTlsDatabase *self,
  85. GTlsCertificate *certificate,
  86. GTlsInteraction *interaction,
  87. GTlsDatabaseLookupFlags flags,
  88. GCancellable *cancellable,
  89. GError **error);
  90. void (*lookup_certificate_issuer_async) (GTlsDatabase *self,
  91. GTlsCertificate *certificate,
  92. GTlsInteraction *interaction,
  93. GTlsDatabaseLookupFlags flags,
  94. GCancellable *cancellable,
  95. GAsyncReadyCallback callback,
  96. gpointer user_data);
  97. GTlsCertificate* (*lookup_certificate_issuer_finish) (GTlsDatabase *self,
  98. GAsyncResult *result,
  99. GError **error);
  100. GList* (*lookup_certificates_issued_by) (GTlsDatabase *self,
  101. GByteArray *issuer_raw_dn,
  102. GTlsInteraction *interaction,
  103. GTlsDatabaseLookupFlags flags,
  104. GCancellable *cancellable,
  105. GError **error);
  106. void (*lookup_certificates_issued_by_async) (GTlsDatabase *self,
  107. GByteArray *issuer_raw_dn,
  108. GTlsInteraction *interaction,
  109. GTlsDatabaseLookupFlags flags,
  110. GCancellable *cancellable,
  111. GAsyncReadyCallback callback,
  112. gpointer user_data);
  113. GList* (*lookup_certificates_issued_by_finish) (GTlsDatabase *self,
  114. GAsyncResult *result,
  115. GError **error);
  116. /*< private >*/
  117. /* Padding for future expansion */
  118. gpointer padding[16];
  119. };
  120. GLIB_AVAILABLE_IN_ALL
  121. GType g_tls_database_get_type (void) G_GNUC_CONST;
  122. GLIB_AVAILABLE_IN_ALL
  123. GTlsCertificateFlags g_tls_database_verify_chain (GTlsDatabase *self,
  124. GTlsCertificate *chain,
  125. const gchar *purpose,
  126. GSocketConnectable *identity,
  127. GTlsInteraction *interaction,
  128. GTlsDatabaseVerifyFlags flags,
  129. GCancellable *cancellable,
  130. GError **error);
  131. GLIB_AVAILABLE_IN_ALL
  132. void g_tls_database_verify_chain_async (GTlsDatabase *self,
  133. GTlsCertificate *chain,
  134. const gchar *purpose,
  135. GSocketConnectable *identity,
  136. GTlsInteraction *interaction,
  137. GTlsDatabaseVerifyFlags flags,
  138. GCancellable *cancellable,
  139. GAsyncReadyCallback callback,
  140. gpointer user_data);
  141. GLIB_AVAILABLE_IN_ALL
  142. GTlsCertificateFlags g_tls_database_verify_chain_finish (GTlsDatabase *self,
  143. GAsyncResult *result,
  144. GError **error);
  145. GLIB_AVAILABLE_IN_ALL
  146. gchar* g_tls_database_create_certificate_handle (GTlsDatabase *self,
  147. GTlsCertificate *certificate);
  148. GLIB_AVAILABLE_IN_ALL
  149. GTlsCertificate* g_tls_database_lookup_certificate_for_handle (GTlsDatabase *self,
  150. const gchar *handle,
  151. GTlsInteraction *interaction,
  152. GTlsDatabaseLookupFlags flags,
  153. GCancellable *cancellable,
  154. GError **error);
  155. GLIB_AVAILABLE_IN_ALL
  156. void g_tls_database_lookup_certificate_for_handle_async (GTlsDatabase *self,
  157. const gchar *handle,
  158. GTlsInteraction *interaction,
  159. GTlsDatabaseLookupFlags flags,
  160. GCancellable *cancellable,
  161. GAsyncReadyCallback callback,
  162. gpointer user_data);
  163. GLIB_AVAILABLE_IN_ALL
  164. GTlsCertificate* g_tls_database_lookup_certificate_for_handle_finish (GTlsDatabase *self,
  165. GAsyncResult *result,
  166. GError **error);
  167. GLIB_AVAILABLE_IN_ALL
  168. GTlsCertificate* g_tls_database_lookup_certificate_issuer (GTlsDatabase *self,
  169. GTlsCertificate *certificate,
  170. GTlsInteraction *interaction,
  171. GTlsDatabaseLookupFlags flags,
  172. GCancellable *cancellable,
  173. GError **error);
  174. GLIB_AVAILABLE_IN_ALL
  175. void g_tls_database_lookup_certificate_issuer_async (GTlsDatabase *self,
  176. GTlsCertificate *certificate,
  177. GTlsInteraction *interaction,
  178. GTlsDatabaseLookupFlags flags,
  179. GCancellable *cancellable,
  180. GAsyncReadyCallback callback,
  181. gpointer user_data);
  182. GLIB_AVAILABLE_IN_ALL
  183. GTlsCertificate* g_tls_database_lookup_certificate_issuer_finish (GTlsDatabase *self,
  184. GAsyncResult *result,
  185. GError **error);
  186. GLIB_AVAILABLE_IN_ALL
  187. GList* g_tls_database_lookup_certificates_issued_by (GTlsDatabase *self,
  188. GByteArray *issuer_raw_dn,
  189. GTlsInteraction *interaction,
  190. GTlsDatabaseLookupFlags flags,
  191. GCancellable *cancellable,
  192. GError **error);
  193. GLIB_AVAILABLE_IN_ALL
  194. void g_tls_database_lookup_certificates_issued_by_async (GTlsDatabase *self,
  195. GByteArray *issuer_raw_dn,
  196. GTlsInteraction *interaction,
  197. GTlsDatabaseLookupFlags flags,
  198. GCancellable *cancellable,
  199. GAsyncReadyCallback callback,
  200. gpointer user_data);
  201. GLIB_AVAILABLE_IN_ALL
  202. GList* g_tls_database_lookup_certificates_issued_by_finish (GTlsDatabase *self,
  203. GAsyncResult *result,
  204. GError **error);
  205. G_END_DECLS
  206. #endif /* __G_TLS_DATABASE_H__ */