gtlscertificate.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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. #ifndef __G_TLS_CERTIFICATE_H__
  21. #define __G_TLS_CERTIFICATE_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_TYPE_TLS_CERTIFICATE (g_tls_certificate_get_type ())
  28. #define G_TLS_CERTIFICATE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_TLS_CERTIFICATE, GTlsCertificate))
  29. #define G_TLS_CERTIFICATE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_TLS_CERTIFICATE, GTlsCertificateClass))
  30. #define G_IS_TLS_CERTIFICATE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_TLS_CERTIFICATE))
  31. #define G_IS_TLS_CERTIFICATE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_TLS_CERTIFICATE))
  32. #define G_TLS_CERTIFICATE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), G_TYPE_TLS_CERTIFICATE, GTlsCertificateClass))
  33. typedef struct _GTlsCertificateClass GTlsCertificateClass;
  34. typedef struct _GTlsCertificatePrivate GTlsCertificatePrivate;
  35. struct _GTlsCertificate {
  36. GObject parent_instance;
  37. GTlsCertificatePrivate *priv;
  38. };
  39. struct _GTlsCertificateClass
  40. {
  41. GObjectClass parent_class;
  42. GTlsCertificateFlags (* verify) (GTlsCertificate *cert,
  43. GSocketConnectable *identity,
  44. GTlsCertificate *trusted_ca);
  45. /*< private >*/
  46. /* Padding for future expansion */
  47. gpointer padding[8];
  48. };
  49. GIO_AVAILABLE_IN_ALL
  50. GType g_tls_certificate_get_type (void) G_GNUC_CONST;
  51. GIO_AVAILABLE_IN_ALL
  52. GTlsCertificate *g_tls_certificate_new_from_pem (const gchar *data,
  53. gssize length,
  54. GError **error);
  55. GIO_AVAILABLE_IN_2_72
  56. GTlsCertificate *g_tls_certificate_new_from_pkcs12 (const guint8 *data,
  57. gsize length,
  58. const gchar *password,
  59. GError **error);
  60. GIO_AVAILABLE_IN_2_72
  61. GTlsCertificate *g_tls_certificate_new_from_file_with_password (const gchar *file,
  62. const gchar *password,
  63. GError **error);
  64. GIO_AVAILABLE_IN_ALL
  65. GTlsCertificate *g_tls_certificate_new_from_file (const gchar *file,
  66. GError **error);
  67. GIO_AVAILABLE_IN_ALL
  68. GTlsCertificate *g_tls_certificate_new_from_files (const gchar *cert_file,
  69. const gchar *key_file,
  70. GError **error);
  71. GIO_AVAILABLE_IN_2_68
  72. GTlsCertificate *g_tls_certificate_new_from_pkcs11_uris (const gchar *pkcs11_uri,
  73. const gchar *private_key_pkcs11_uri,
  74. GError **error);
  75. GIO_AVAILABLE_IN_ALL
  76. GList *g_tls_certificate_list_new_from_file (const gchar *file,
  77. GError **error);
  78. GIO_AVAILABLE_IN_ALL
  79. GTlsCertificate *g_tls_certificate_get_issuer (GTlsCertificate *cert);
  80. GIO_AVAILABLE_IN_ALL
  81. GTlsCertificateFlags g_tls_certificate_verify (GTlsCertificate *cert,
  82. GSocketConnectable *identity,
  83. GTlsCertificate *trusted_ca);
  84. GIO_AVAILABLE_IN_2_34
  85. gboolean g_tls_certificate_is_same (GTlsCertificate *cert_one,
  86. GTlsCertificate *cert_two);
  87. GIO_AVAILABLE_IN_2_70
  88. GDateTime *g_tls_certificate_get_not_valid_before (GTlsCertificate *cert);
  89. GIO_AVAILABLE_IN_2_70
  90. GDateTime *g_tls_certificate_get_not_valid_after (GTlsCertificate *cert);
  91. GIO_AVAILABLE_IN_2_70
  92. gchar *g_tls_certificate_get_subject_name (GTlsCertificate *cert);
  93. GIO_AVAILABLE_IN_2_70
  94. gchar *g_tls_certificate_get_issuer_name (GTlsCertificate *cert);
  95. GIO_AVAILABLE_IN_2_70
  96. GPtrArray *g_tls_certificate_get_dns_names (GTlsCertificate *cert);
  97. GIO_AVAILABLE_IN_2_70
  98. GPtrArray *g_tls_certificate_get_ip_addresses (GTlsCertificate *cert);
  99. G_END_DECLS
  100. #endif /* __G_TLS_CERTIFICATE_H__ */