c5aff4394bf4eddd2728c25c358f97087f9ddb88
[platform/upstream/glib-networking.git] / tls / gnutls / gtlscertificate-gnutls.h
1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3  * GIO - GLib Input, Output and Streaming Library
4  *
5  * Copyright 2009 Red Hat, Inc.
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
19  * <http://www.gnu.org/licenses/>.
20  *
21  * In addition, when the library is used with OpenSSL, a special
22  * exception applies. Refer to the LICENSE_EXCEPTION file for details.
23  */
24
25 #ifndef __G_TLS_CERTIFICATE_GNUTLS_H__
26 #define __G_TLS_CERTIFICATE_GNUTLS_H__
27
28 #include <gio/gio.h>
29 #include <gnutls/abstract.h>
30 #include <gnutls/gnutls.h>
31
32 G_BEGIN_DECLS
33
34 #define G_TYPE_TLS_CERTIFICATE_GNUTLS            (g_tls_certificate_gnutls_get_type ())
35
36 G_DECLARE_FINAL_TYPE (GTlsCertificateGnutls, g_tls_certificate_gnutls, G, TLS_CERTIFICATE_GNUTLS, GTlsCertificate)
37
38 GTlsCertificate *            g_tls_certificate_gnutls_new             (const gnutls_datum_t  *datum,
39                                                                        GTlsCertificate       *issuer);
40
41 GBytes *                     g_tls_certificate_gnutls_get_bytes       (GTlsCertificateGnutls *gnutls);
42
43 void                         g_tls_certificate_gnutls_set_data        (GTlsCertificateGnutls *gnutls,
44                                                                        const gnutls_datum_t  *datum);
45
46 const gnutls_x509_crt_t      g_tls_certificate_gnutls_get_cert        (GTlsCertificateGnutls *gnutls);
47 gboolean                     g_tls_certificate_gnutls_has_key         (GTlsCertificateGnutls *gnutls);
48
49 void                         g_tls_certificate_gnutls_copy            (GTlsCertificateGnutls  *gnutls,
50                                                                        const gchar            *interaction_id,
51                                                                        gnutls_pcert_st       **pcert,
52                                                                        unsigned int           *pcert_length,
53                                                                        gnutls_privkey_t       *pkey);
54
55 void                         g_tls_certificate_gnutls_copy_free       (gnutls_pcert_st        *pcert,
56                                                                        unsigned int            pcert_length,
57                                                                        gnutls_privkey_t        pkey);
58
59 GTlsCertificateFlags         g_tls_certificate_gnutls_verify_identity (GTlsCertificateGnutls *gnutls,
60                                                                        GSocketConnectable    *identity);
61
62 GTlsCertificateFlags         g_tls_certificate_gnutls_convert_flags   (guint                  gnutls_flags);
63
64 void                         g_tls_certificate_gnutls_set_issuer      (GTlsCertificateGnutls *gnutls,
65                                                                        GTlsCertificateGnutls *issuer);
66
67 GTlsCertificateGnutls*       g_tls_certificate_gnutls_steal_issuer    (GTlsCertificateGnutls *gnutls);
68
69 GTlsCertificateGnutls*       g_tls_certificate_gnutls_build_chain     (const gnutls_datum_t  *certs,
70                                                                        guint                  num_certs,
71                                                                        gnutls_x509_crt_fmt_t  format);
72
73 G_END_DECLS
74
75 #endif /* __G_TLS_CERTIFICATE_GNUTLS_H___ */