Tue, 29 Mar 2016 22:51:43 -0500
Add TLS Certificate parsing API
This patch adds X.509 certificate parsing API. It takes the bytes
from a GTlsCertificate and parses information such as subject name,
SHA-1 hash, and similar. GTlsCertificate parses the certificates
internally, so these functions are only used for displaying to the
user.
UIs could conceivably use a library such as libgcr directly instead,
but this is here, at least for now, until such an alternative is
used, if at all.
|
37620
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
1 | /* |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
2 | * |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
3 | * purple |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
4 | * |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
5 | * Purple is the legal property of its developers, whose names are too numerous |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
7 | * source distribution. |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
8 | * |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
9 | * This program is free software; you can redistribute it and/or modify |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
10 | * it under the terms of the GNU General Public License as published by |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
11 | * the Free Software Foundation; either version 2 of the License, or |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
12 | * (at your option) any later version. |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
13 | * |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
14 | * This program is distributed in the hope that it will be useful, |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
17 | * GNU General Public License for more details. |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
18 | * |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
20 | * along with this program; if not, write to the Free Software |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
22 | */ |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
23 | |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
24 | #ifndef _PURPLE_TLS_CERTIFICATE_H |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
25 | #define _PURPLE_TLS_CERTIFICATE_H |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
26 | /** |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
27 | * SECTION:tls-certificate |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
28 | * @section_id: libpurple-tls-certificate |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
29 | * @short_description: <filename>tls-certificate.h</filename> |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
30 | * @title: TLS Certificate API |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
31 | */ |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
32 | |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
33 | #include <gio/gio.h> |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
34 | |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
35 | /** |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
36 | * purple_tls_certificate_list_ids: |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
37 | * |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
38 | * Returns a list of the IDs for certificates trusted with |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
39 | * purple_tls_certificate_trust() and friends. These IDs can then be passed |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
40 | * to purple_certificate_path() or used directly, if desired. |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
41 | * |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
42 | * Returns: The #GList of IDs described above |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
43 | * Free with purple_certificate_free_ids() |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
44 | */ |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
45 | GList * |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
46 | purple_tls_certificate_list_ids(void); |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
47 | |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
48 | /** |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
49 | * purple_tls_certificate_free_ids: |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
50 | * @ids: List of ids retrieved from purple_certificate_list_ids() |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
51 | * |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
52 | * Frees the list of IDs returned from purple_certificate_list_ids(). |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
53 | */ |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
54 | void |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
55 | purple_tls_certificate_free_ids(GList *ids); |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
56 | |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
57 | /** |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
58 | * purple_tls_certificate_new_from_id: |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
59 | * @id: ID of certificate to load |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
60 | * @error: A GError location to store the error occurring, or NULL to ignore |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
61 | * |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
62 | * Loads the certificate referenced by ID into a #GTlsCertificate object. |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
63 | */ |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
64 | GTlsCertificate * |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
65 | purple_tls_certificate_new_from_id(const gchar *id, GError **error); |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
66 | |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
67 | /** |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
68 | * purple_tls_certificate_trust: |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
69 | * @id: ID to associate with the certificate |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
70 | * @certificate: Certificate to trust for TLS operations |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
71 | * @error: A GError location to store the error occurring, or NULL to ignore |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
72 | * |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
73 | * Trusts the certificate to be allowed for TLS operations even if |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
74 | * it would otherwise fail. |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
75 | * |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
76 | * Returns: #TRUE on success, #FALSE otherwise |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
77 | */ |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
78 | gboolean |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
79 | purple_tls_certificate_trust(const gchar *id, GTlsCertificate *certificate, |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
80 | GError **error); |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
81 | |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
82 | /** |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
83 | * purple_tls_certificate_distrust: |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
84 | * @id: ID associated with the certificate to distrust |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
85 | * @error: A GError location to store the error occurring, or NULL to ignore |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
86 | * |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
87 | * Revokes full trust of certificate. The certificate will be accepted |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
88 | * in TLS operations only if it passes normal validation. |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
89 | * |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
90 | * Returns: #TRUE on success, #FALSE otherwise |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
91 | */ |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
92 | gboolean |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
93 | purple_tls_certificate_distrust(const gchar *id, GError **error); |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
94 | |
|
37621
2a2f1068e0f0
Add helper API for using Purple TLS subsystem with GTlsConnections
Mike Ruprecht <cmaiku@gmail.com>
parents:
37620
diff
changeset
|
95 | |
|
2a2f1068e0f0
Add helper API for using Purple TLS subsystem with GTlsConnections
Mike Ruprecht <cmaiku@gmail.com>
parents:
37620
diff
changeset
|
96 | /** |
|
2a2f1068e0f0
Add helper API for using Purple TLS subsystem with GTlsConnections
Mike Ruprecht <cmaiku@gmail.com>
parents:
37620
diff
changeset
|
97 | * purple_tls_certificate_attach_to_tls_connection: |
|
2a2f1068e0f0
Add helper API for using Purple TLS subsystem with GTlsConnections
Mike Ruprecht <cmaiku@gmail.com>
parents:
37620
diff
changeset
|
98 | * @conn: #GTlsConnection to connect to |
|
2a2f1068e0f0
Add helper API for using Purple TLS subsystem with GTlsConnections
Mike Ruprecht <cmaiku@gmail.com>
parents:
37620
diff
changeset
|
99 | * |
|
2a2f1068e0f0
Add helper API for using Purple TLS subsystem with GTlsConnections
Mike Ruprecht <cmaiku@gmail.com>
parents:
37620
diff
changeset
|
100 | * Connects the Purple TLS certificate subsystem to @conn so it will accept |
|
2a2f1068e0f0
Add helper API for using Purple TLS subsystem with GTlsConnections
Mike Ruprecht <cmaiku@gmail.com>
parents:
37620
diff
changeset
|
101 | * certificates trusted by purple_tls_certificate_trust() and friends. |
|
2a2f1068e0f0
Add helper API for using Purple TLS subsystem with GTlsConnections
Mike Ruprecht <cmaiku@gmail.com>
parents:
37620
diff
changeset
|
102 | * |
|
2a2f1068e0f0
Add helper API for using Purple TLS subsystem with GTlsConnections
Mike Ruprecht <cmaiku@gmail.com>
parents:
37620
diff
changeset
|
103 | * Returns: @conn, similar to g_object_connect() |
|
2a2f1068e0f0
Add helper API for using Purple TLS subsystem with GTlsConnections
Mike Ruprecht <cmaiku@gmail.com>
parents:
37620
diff
changeset
|
104 | */ |
|
2a2f1068e0f0
Add helper API for using Purple TLS subsystem with GTlsConnections
Mike Ruprecht <cmaiku@gmail.com>
parents:
37620
diff
changeset
|
105 | gpointer |
|
2a2f1068e0f0
Add helper API for using Purple TLS subsystem with GTlsConnections
Mike Ruprecht <cmaiku@gmail.com>
parents:
37620
diff
changeset
|
106 | purple_tls_certificate_attach_to_tls_connection(GTlsConnection *conn); |
|
2a2f1068e0f0
Add helper API for using Purple TLS subsystem with GTlsConnections
Mike Ruprecht <cmaiku@gmail.com>
parents:
37620
diff
changeset
|
107 | |
|
2a2f1068e0f0
Add helper API for using Purple TLS subsystem with GTlsConnections
Mike Ruprecht <cmaiku@gmail.com>
parents:
37620
diff
changeset
|
108 | /** |
|
2a2f1068e0f0
Add helper API for using Purple TLS subsystem with GTlsConnections
Mike Ruprecht <cmaiku@gmail.com>
parents:
37620
diff
changeset
|
109 | * purple_tls_certificate_attach_to_socket_client: |
|
2a2f1068e0f0
Add helper API for using Purple TLS subsystem with GTlsConnections
Mike Ruprecht <cmaiku@gmail.com>
parents:
37620
diff
changeset
|
110 | * @client: #GSocketClient to connect to |
|
2a2f1068e0f0
Add helper API for using Purple TLS subsystem with GTlsConnections
Mike Ruprecht <cmaiku@gmail.com>
parents:
37620
diff
changeset
|
111 | * |
|
2a2f1068e0f0
Add helper API for using Purple TLS subsystem with GTlsConnections
Mike Ruprecht <cmaiku@gmail.com>
parents:
37620
diff
changeset
|
112 | * Connects the Purple TLS certificate subsystem to @client so any TLS |
|
2a2f1068e0f0
Add helper API for using Purple TLS subsystem with GTlsConnections
Mike Ruprecht <cmaiku@gmail.com>
parents:
37620
diff
changeset
|
113 | * connections it creates will accept certificates trusted by |
|
2a2f1068e0f0
Add helper API for using Purple TLS subsystem with GTlsConnections
Mike Ruprecht <cmaiku@gmail.com>
parents:
37620
diff
changeset
|
114 | * purple_tls_certificate_trust() and friends. |
|
2a2f1068e0f0
Add helper API for using Purple TLS subsystem with GTlsConnections
Mike Ruprecht <cmaiku@gmail.com>
parents:
37620
diff
changeset
|
115 | * |
|
2a2f1068e0f0
Add helper API for using Purple TLS subsystem with GTlsConnections
Mike Ruprecht <cmaiku@gmail.com>
parents:
37620
diff
changeset
|
116 | * Returns: @client, similar to g_object_connect() |
|
2a2f1068e0f0
Add helper API for using Purple TLS subsystem with GTlsConnections
Mike Ruprecht <cmaiku@gmail.com>
parents:
37620
diff
changeset
|
117 | */ |
|
2a2f1068e0f0
Add helper API for using Purple TLS subsystem with GTlsConnections
Mike Ruprecht <cmaiku@gmail.com>
parents:
37620
diff
changeset
|
118 | gpointer |
|
2a2f1068e0f0
Add helper API for using Purple TLS subsystem with GTlsConnections
Mike Ruprecht <cmaiku@gmail.com>
parents:
37620
diff
changeset
|
119 | purple_tls_certificate_attach_to_socket_client(GSocketClient *client); |
|
2a2f1068e0f0
Add helper API for using Purple TLS subsystem with GTlsConnections
Mike Ruprecht <cmaiku@gmail.com>
parents:
37620
diff
changeset
|
120 | |
|
37622
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
121 | |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
122 | /** |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
123 | * PurpleTlsCertificateInfo |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
124 | * |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
125 | * An opaque structure to contain parsed certificate info, which |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
126 | * can subsequently be accessed by purple_tls_certificate_info_* |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
127 | * functions. |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
128 | */ |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
129 | typedef struct _PurpleTlsCertificateInfo PurpleTlsCertificateInfo; |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
130 | |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
131 | /** |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
132 | * purple_tls_certificate_get_info: |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
133 | * @certificate: Certificate from which to parse the info |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
134 | * |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
135 | * Returns a #PurpleTlsCertificateInfo containing parsed information |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
136 | * of the certificate. |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
137 | * |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
138 | * Returns: #PurpleTlsCertificateInfo parsed from the certificate |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
139 | */ |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
140 | PurpleTlsCertificateInfo * |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
141 | purple_tls_certificate_get_info(GTlsCertificate *certificate); |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
142 | |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
143 | /** |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
144 | * purple_tls_certificate_info_free: |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
145 | * @info: #PurpleTlsCertificateInfo object to free |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
146 | * |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
147 | * Frees @info. |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
148 | */ |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
149 | void |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
150 | purple_tls_certificate_info_free(PurpleTlsCertificateInfo *info); |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
151 | |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
152 | /** |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
153 | * purple_tls_certificate_info_get_display_string: |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
154 | * @info: #PurpleTlsCertificateInfo from which to generate a display string |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
155 | * |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
156 | * Generates a user readable string to display information from @info |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
157 | * |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
158 | * Returns: A user readable string suitable to display to the user |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
159 | */ |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
160 | gchar * |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
161 | purple_tls_certificate_info_get_display_string(PurpleTlsCertificateInfo *info); |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
162 | |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
163 | /** |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
164 | * purple_tls_certificate_get_subject_name: |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
165 | * @certificate: Certificate from which to get the subject name |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
166 | * |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
167 | * Returns the common subject name of the cert |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
168 | * |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
169 | * Returns: The subject name of the cert |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
170 | */ |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
171 | gchar * |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
172 | purple_tls_certificate_info_get_subject_name(PurpleTlsCertificateInfo *info); |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
173 | |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
174 | /** |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
175 | * purple_tls_certificate_get_fingerprint_sha1: |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
176 | * @certificate: Certificate from which to get the SHA1 fingerprint |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
177 | * |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
178 | * Returns the SHA1 fingerprint of the cert |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
179 | * |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
180 | * Returns: The SHA1 fingerprint of the cert |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
181 | */ |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
182 | GByteArray * |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
183 | purple_tls_certificate_get_fingerprint_sha1(GTlsCertificate *certificate); |
|
14d1273cae74
Add TLS Certificate parsing API
Mike Ruprecht <cmaiku@gmail.com>
parents:
37621
diff
changeset
|
184 | |
|
37620
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
185 | G_END_DECLS |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
186 | |
|
5467197bd084
Implement new, simplified TLS certificate API in libpurple
Mike Ruprecht <cmaiku@gmail.com>
parents:
diff
changeset
|
187 | #endif /* _PURPLE_TLS_CERTIFICATE_H */ |