Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:00:00

0001 /* GIO - GLib Input, Output and Streaming Library
0002  *
0003  * Copyright (C) 2010 Collabora, Ltd.
0004  *
0005  * SPDX-License-Identifier: LGPL-2.1-or-later
0006  *
0007  * This library is free software; you can redistribute it and/or
0008  * modify it under the terms of the GNU Lesser General Public
0009  * License as published by the Free Software Foundation; either
0010  * version 2.1 of the License, or (at your option) any later version.
0011  *
0012  * This library is distributed in the hope that it will be useful,
0013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015  * Lesser General Public License for more details.
0016  *
0017  * You should have received a copy of the GNU Lesser General
0018  * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
0019  *
0020  * Author: Stef Walter <stefw@collabora.co.uk>
0021  */
0022 
0023 #ifndef __G_TLS_DATABASE_H__
0024 #define __G_TLS_DATABASE_H__
0025 
0026 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
0027 #error "Only <gio/gio.h> can be included directly."
0028 #endif
0029 
0030 #include <gio/giotypes.h>
0031 
0032 G_BEGIN_DECLS
0033 
0034 #define G_TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVER "1.3.6.1.5.5.7.3.1"
0035 #define G_TLS_DATABASE_PURPOSE_AUTHENTICATE_CLIENT "1.3.6.1.5.5.7.3.2"
0036 
0037 #define G_TYPE_TLS_DATABASE            (g_tls_database_get_type ())
0038 #define G_TLS_DATABASE(inst)           (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_TLS_DATABASE, GTlsDatabase))
0039 #define G_TLS_DATABASE_CLASS(class)    (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_TLS_DATABASE, GTlsDatabaseClass))
0040 #define G_IS_TLS_DATABASE(inst)        (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_TLS_DATABASE))
0041 #define G_IS_TLS_DATABASE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_TLS_DATABASE))
0042 #define G_TLS_DATABASE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), G_TYPE_TLS_DATABASE, GTlsDatabaseClass))
0043 
0044 typedef struct _GTlsDatabaseClass   GTlsDatabaseClass;
0045 typedef struct _GTlsDatabasePrivate GTlsDatabasePrivate;
0046 
0047 struct _GTlsDatabase
0048 {
0049   GObject parent_instance;
0050 
0051   GTlsDatabasePrivate *priv;
0052 };
0053 
0054 struct _GTlsDatabaseClass
0055 {
0056   GObjectClass parent_class;
0057 
0058   /* virtual methods */
0059 
0060   GTlsCertificateFlags  (*verify_chain)                         (GTlsDatabase            *self,
0061                                                                  GTlsCertificate         *chain,
0062                                                                  const gchar             *purpose,
0063                                                                  GSocketConnectable      *identity,
0064                                                                  GTlsInteraction         *interaction,
0065                                                                  GTlsDatabaseVerifyFlags  flags,
0066                                                                  GCancellable            *cancellable,
0067                                                                  GError                 **error);
0068 
0069   void                  (*verify_chain_async)                   (GTlsDatabase            *self,
0070                                                                  GTlsCertificate         *chain,
0071                                                                  const gchar             *purpose,
0072                                                                  GSocketConnectable      *identity,
0073                                                                  GTlsInteraction         *interaction,
0074                                                                  GTlsDatabaseVerifyFlags  flags,
0075                                                                  GCancellable            *cancellable,
0076                                                                  GAsyncReadyCallback      callback,
0077                                                                  gpointer                 user_data);
0078 
0079   GTlsCertificateFlags  (*verify_chain_finish)                  (GTlsDatabase            *self,
0080                                                                  GAsyncResult            *result,
0081                                                                  GError                 **error);
0082 
0083   gchar*                (*create_certificate_handle)            (GTlsDatabase            *self,
0084                                                                  GTlsCertificate         *certificate);
0085 
0086   GTlsCertificate*      (*lookup_certificate_for_handle)        (GTlsDatabase            *self,
0087                                                                  const gchar             *handle,
0088                                                                  GTlsInteraction         *interaction,
0089                                                                  GTlsDatabaseLookupFlags  flags,
0090                                                                  GCancellable            *cancellable,
0091                                                                  GError                 **error);
0092 
0093   void                  (*lookup_certificate_for_handle_async)  (GTlsDatabase            *self,
0094                                                                  const gchar             *handle,
0095                                                                  GTlsInteraction         *interaction,
0096                                                                  GTlsDatabaseLookupFlags  flags,
0097                                                                  GCancellable            *cancellable,
0098                                                                  GAsyncReadyCallback      callback,
0099                                                                  gpointer                 user_data);
0100 
0101   GTlsCertificate*      (*lookup_certificate_for_handle_finish) (GTlsDatabase            *self,
0102                                                                  GAsyncResult            *result,
0103                                                                  GError                 **error);
0104 
0105   GTlsCertificate*      (*lookup_certificate_issuer)            (GTlsDatabase            *self,
0106                                                                  GTlsCertificate         *certificate,
0107                                                                  GTlsInteraction         *interaction,
0108                                                                  GTlsDatabaseLookupFlags  flags,
0109                                                                  GCancellable            *cancellable,
0110                                                                  GError                 **error);
0111 
0112   void                  (*lookup_certificate_issuer_async)      (GTlsDatabase            *self,
0113                                                                  GTlsCertificate         *certificate,
0114                                                                  GTlsInteraction         *interaction,
0115                                                                  GTlsDatabaseLookupFlags  flags,
0116                                                                  GCancellable            *cancellable,
0117                                                                  GAsyncReadyCallback      callback,
0118                                                                  gpointer                 user_data);
0119 
0120   GTlsCertificate*      (*lookup_certificate_issuer_finish)     (GTlsDatabase            *self,
0121                                                                  GAsyncResult            *result,
0122                                                                  GError                 **error);
0123 
0124   GList*                (*lookup_certificates_issued_by)        (GTlsDatabase            *self,
0125                                                                  GByteArray              *issuer_raw_dn,
0126                                                                  GTlsInteraction         *interaction,
0127                                                                  GTlsDatabaseLookupFlags  flags,
0128                                                                  GCancellable            *cancellable,
0129                                                                  GError                 **error);
0130 
0131   void                  (*lookup_certificates_issued_by_async)  (GTlsDatabase            *self,
0132                                                                  GByteArray              *issuer_raw_dn,
0133                                                                  GTlsInteraction         *interaction,
0134                                                                  GTlsDatabaseLookupFlags  flags,
0135                                                                  GCancellable            *cancellable,
0136                                                                  GAsyncReadyCallback      callback,
0137                                                                  gpointer                 user_data);
0138 
0139   GList*                (*lookup_certificates_issued_by_finish) (GTlsDatabase            *self,
0140                                                                  GAsyncResult            *result,
0141                                                                  GError                 **error);
0142 
0143   /*< private >*/
0144   /* Padding for future expansion */
0145   gpointer padding[16];
0146 };
0147 
0148 GIO_AVAILABLE_IN_ALL
0149 GType                g_tls_database_get_type                              (void) G_GNUC_CONST;
0150 
0151 GIO_AVAILABLE_IN_ALL
0152 GTlsCertificateFlags g_tls_database_verify_chain                          (GTlsDatabase            *self,
0153                                                                            GTlsCertificate         *chain,
0154                                                                            const gchar             *purpose,
0155                                                                            GSocketConnectable      *identity,
0156                                                                            GTlsInteraction         *interaction,
0157                                                                            GTlsDatabaseVerifyFlags  flags,
0158                                                                            GCancellable            *cancellable,
0159                                                                            GError                 **error);
0160 
0161 GIO_AVAILABLE_IN_ALL
0162 void                 g_tls_database_verify_chain_async                    (GTlsDatabase            *self,
0163                                                                            GTlsCertificate         *chain,
0164                                                                            const gchar             *purpose,
0165                                                                            GSocketConnectable      *identity,
0166                                                                            GTlsInteraction         *interaction,
0167                                                                            GTlsDatabaseVerifyFlags  flags,
0168                                                                            GCancellable            *cancellable,
0169                                                                            GAsyncReadyCallback      callback,
0170                                                                            gpointer                 user_data);
0171 
0172 GIO_AVAILABLE_IN_ALL
0173 GTlsCertificateFlags g_tls_database_verify_chain_finish                   (GTlsDatabase            *self,
0174                                                                            GAsyncResult            *result,
0175                                                                            GError                 **error);
0176 
0177 GIO_AVAILABLE_IN_ALL
0178 gchar*               g_tls_database_create_certificate_handle             (GTlsDatabase            *self,
0179                                                                            GTlsCertificate         *certificate);
0180 
0181 GIO_AVAILABLE_IN_ALL
0182 GTlsCertificate*     g_tls_database_lookup_certificate_for_handle         (GTlsDatabase            *self,
0183                                                                            const gchar             *handle,
0184                                                                            GTlsInteraction         *interaction,
0185                                                                            GTlsDatabaseLookupFlags  flags,
0186                                                                            GCancellable            *cancellable,
0187                                                                            GError                 **error);
0188 
0189 GIO_AVAILABLE_IN_ALL
0190 void                 g_tls_database_lookup_certificate_for_handle_async   (GTlsDatabase            *self,
0191                                                                            const gchar             *handle,
0192                                                                            GTlsInteraction         *interaction,
0193                                                                            GTlsDatabaseLookupFlags  flags,
0194                                                                            GCancellable            *cancellable,
0195                                                                            GAsyncReadyCallback      callback,
0196                                                                            gpointer                 user_data);
0197 
0198 GIO_AVAILABLE_IN_ALL
0199 GTlsCertificate*     g_tls_database_lookup_certificate_for_handle_finish  (GTlsDatabase            *self,
0200                                                                            GAsyncResult            *result,
0201                                                                            GError                 **error);
0202 
0203 GIO_AVAILABLE_IN_ALL
0204 GTlsCertificate*     g_tls_database_lookup_certificate_issuer             (GTlsDatabase            *self,
0205                                                                            GTlsCertificate         *certificate,
0206                                                                            GTlsInteraction         *interaction,
0207                                                                            GTlsDatabaseLookupFlags  flags,
0208                                                                            GCancellable            *cancellable,
0209                                                                            GError                 **error);
0210 
0211 GIO_AVAILABLE_IN_ALL
0212 void                 g_tls_database_lookup_certificate_issuer_async       (GTlsDatabase            *self,
0213                                                                            GTlsCertificate         *certificate,
0214                                                                            GTlsInteraction         *interaction,
0215                                                                            GTlsDatabaseLookupFlags  flags,
0216                                                                            GCancellable            *cancellable,
0217                                                                            GAsyncReadyCallback      callback,
0218                                                                            gpointer                 user_data);
0219 
0220 GIO_AVAILABLE_IN_ALL
0221 GTlsCertificate*     g_tls_database_lookup_certificate_issuer_finish      (GTlsDatabase            *self,
0222                                                                            GAsyncResult            *result,
0223                                                                            GError                 **error);
0224 
0225 GIO_AVAILABLE_IN_ALL
0226 GList*               g_tls_database_lookup_certificates_issued_by         (GTlsDatabase            *self,
0227                                                                            GByteArray              *issuer_raw_dn,
0228                                                                            GTlsInteraction         *interaction,
0229                                                                            GTlsDatabaseLookupFlags  flags,
0230                                                                            GCancellable            *cancellable,
0231                                                                            GError                 **error);
0232 
0233 GIO_AVAILABLE_IN_ALL
0234 void                 g_tls_database_lookup_certificates_issued_by_async    (GTlsDatabase            *self,
0235                                                                             GByteArray              *issuer_raw_dn,
0236                                                                             GTlsInteraction         *interaction,
0237                                                                             GTlsDatabaseLookupFlags  flags,
0238                                                                             GCancellable            *cancellable,
0239                                                                             GAsyncReadyCallback      callback,
0240                                                                             gpointer                 user_data);
0241 
0242 GIO_AVAILABLE_IN_ALL
0243 GList*               g_tls_database_lookup_certificates_issued_by_finish   (GTlsDatabase            *self,
0244                                                                             GAsyncResult            *result,
0245                                                                             GError                 **error);
0246 
0247 G_END_DECLS
0248 
0249 #endif /* __G_TLS_DATABASE_H__ */