(root)/
glib-2.79.0/
gio/
gtlscertificate.h
       1  /* GIO - GLib Input, Output and Streaming Library
       2   *
       3   * Copyright (C) 2010 Red Hat, Inc.
       4   *
       5   * SPDX-License-Identifier: LGPL-2.1-or-later
       6   *
       7   * This library is free software; you can redistribute it and/or
       8   * modify it under the terms of the GNU Lesser General Public
       9   * License as published by the Free Software Foundation; either
      10   * version 2.1 of the License, or (at your option) any later version.
      11   *
      12   * This library is distributed in the hope that it will be useful,
      13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
      14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      15   * Lesser General Public License for more details.
      16   *
      17   * You should have received a copy of the GNU Lesser General
      18   * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
      19   */
      20  
      21  #ifndef __G_TLS_CERTIFICATE_H__
      22  #define __G_TLS_CERTIFICATE_H__
      23  
      24  #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
      25  #error "Only <gio/gio.h> can be included directly."
      26  #endif
      27  
      28  #include <gio/giotypes.h>
      29  
      30  G_BEGIN_DECLS
      31  
      32  #define G_TYPE_TLS_CERTIFICATE            (g_tls_certificate_get_type ())
      33  #define G_TLS_CERTIFICATE(inst)           (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_TLS_CERTIFICATE, GTlsCertificate))
      34  #define G_TLS_CERTIFICATE_CLASS(class)    (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_TLS_CERTIFICATE, GTlsCertificateClass))
      35  #define G_IS_TLS_CERTIFICATE(inst)        (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_TLS_CERTIFICATE))
      36  #define G_IS_TLS_CERTIFICATE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_TLS_CERTIFICATE))
      37  #define G_TLS_CERTIFICATE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), G_TYPE_TLS_CERTIFICATE, GTlsCertificateClass))
      38  
      39  typedef struct _GTlsCertificateClass   GTlsCertificateClass;
      40  typedef struct _GTlsCertificatePrivate GTlsCertificatePrivate;
      41  
      42  struct _GTlsCertificate {
      43    GObject parent_instance;
      44  
      45    GTlsCertificatePrivate *priv;
      46  };
      47  
      48  struct _GTlsCertificateClass
      49  {
      50    GObjectClass parent_class;
      51  
      52    GTlsCertificateFlags  (* verify) (GTlsCertificate     *cert,
      53  				    GSocketConnectable  *identity,
      54  				    GTlsCertificate     *trusted_ca);
      55  
      56    /*< private >*/
      57    /* Padding for future expansion */
      58    gpointer padding[8];
      59  };
      60  
      61  GIO_AVAILABLE_IN_ALL
      62  GType                 g_tls_certificate_get_type           (void) G_GNUC_CONST;
      63  
      64  GIO_AVAILABLE_IN_ALL
      65  GTlsCertificate      *g_tls_certificate_new_from_pem       (const gchar         *data,
      66  							    gssize               length,
      67  							    GError             **error);
      68  GIO_AVAILABLE_IN_2_72
      69  GTlsCertificate      *g_tls_certificate_new_from_pkcs12      (const guint8      *data,
      70                                                                gsize              length,
      71                                                                const gchar       *password,
      72                                                                GError           **error);
      73  GIO_AVAILABLE_IN_2_72
      74  GTlsCertificate      *g_tls_certificate_new_from_file_with_password (const gchar  *file,
      75                                                                       const gchar  *password,
      76                                                                       GError      **error);
      77  GIO_AVAILABLE_IN_ALL
      78  GTlsCertificate      *g_tls_certificate_new_from_file      (const gchar         *file,
      79  							    GError             **error);
      80  GIO_AVAILABLE_IN_ALL
      81  GTlsCertificate      *g_tls_certificate_new_from_files     (const gchar         *cert_file,
      82  							    const gchar         *key_file,
      83  							    GError             **error);
      84  GIO_AVAILABLE_IN_2_68
      85  GTlsCertificate      *g_tls_certificate_new_from_pkcs11_uris (const gchar       *pkcs11_uri,
      86                                                                const gchar       *private_key_pkcs11_uri,
      87                                                                GError           **error);
      88  
      89  GIO_AVAILABLE_IN_ALL
      90  GList                *g_tls_certificate_list_new_from_file (const gchar         *file,
      91  							    GError             **error);
      92  
      93  GIO_AVAILABLE_IN_ALL
      94  GTlsCertificate      *g_tls_certificate_get_issuer         (GTlsCertificate     *cert);
      95  
      96  GIO_AVAILABLE_IN_ALL
      97  GTlsCertificateFlags  g_tls_certificate_verify             (GTlsCertificate     *cert,
      98  							    GSocketConnectable  *identity,
      99  							    GTlsCertificate     *trusted_ca);
     100  
     101  GIO_AVAILABLE_IN_2_34
     102  gboolean              g_tls_certificate_is_same            (GTlsCertificate     *cert_one,
     103                                                              GTlsCertificate     *cert_two);
     104  
     105  GIO_AVAILABLE_IN_2_70
     106  GDateTime            *g_tls_certificate_get_not_valid_before (GTlsCertificate     *cert);
     107  
     108  GIO_AVAILABLE_IN_2_70
     109  GDateTime            *g_tls_certificate_get_not_valid_after  (GTlsCertificate     *cert);
     110  
     111  GIO_AVAILABLE_IN_2_70
     112  gchar                *g_tls_certificate_get_subject_name     (GTlsCertificate     *cert);
     113  
     114  GIO_AVAILABLE_IN_2_70
     115  gchar                *g_tls_certificate_get_issuer_name      (GTlsCertificate     *cert);
     116  
     117  GIO_AVAILABLE_IN_2_70
     118  GPtrArray            *g_tls_certificate_get_dns_names        (GTlsCertificate     *cert);
     119  
     120  GIO_AVAILABLE_IN_2_70
     121  GPtrArray            *g_tls_certificate_get_ip_addresses     (GTlsCertificate     *cert);
     122  
     123  G_END_DECLS
     124  
     125  #endif /* __G_TLS_CERTIFICATE_H__ */