summaryrefslogtreecommitdiff
path: root/gcr/gcr-trust.h
blob: 0f490d6a8f805696881d5eeb824c75e337b03c21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*
 * gnome-keyring
 *
 * Copyright (C) 2010 Stefan Walter
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, see <http://www.gnu.org/licenses/>.
 */

#ifndef __GCR_TRUST_H__
#define __GCR_TRUST_H__

#if !defined (__GCR_INSIDE_HEADER__) && !defined (GCR_COMPILATION)
#error "Only <gcr/gcr.h> can be included directly."
#endif

#include "gcr-certificate.h"
#include "gcr-types.h"

G_BEGIN_DECLS

#define GCR_PURPOSE_SERVER_AUTH "1.3.6.1.5.5.7.3.1"
#define GCR_PURPOSE_CLIENT_AUTH "1.3.6.1.5.5.7.3.2"
#define GCR_PURPOSE_CODE_SIGNING "1.3.6.1.5.5.7.3.3"
#define GCR_PURPOSE_EMAIL "1.3.6.1.5.5.7.3.4"

gboolean       gcr_trust_is_certificate_pinned                 (GcrCertificate *certificate,
                                                                const gchar *purpose,
                                                                const gchar *peer,
                                                                GCancellable *cancellable,
                                                                GError **error);

void           gcr_trust_is_certificate_pinned_async           (GcrCertificate *certificate,
                                                                const gchar *purpose,
                                                                const gchar *peer,
                                                                GCancellable *cancellable,
                                                                GAsyncReadyCallback callback,
                                                                gpointer user_data);

gboolean       gcr_trust_is_certificate_pinned_finish          (GAsyncResult *result,
                                                                GError **error);

gboolean       gcr_trust_add_pinned_certificate                (GcrCertificate *certificate,
                                                                const gchar *purpose,
                                                                const gchar *peer,
                                                                GCancellable *cancellable,
                                                                GError **error);

void           gcr_trust_add_pinned_certificate_async          (GcrCertificate *certificate,
                                                                const gchar *purpose,
                                                                const gchar *peer,
                                                                GCancellable *cancellable,
                                                                GAsyncReadyCallback callback,
                                                                gpointer user_data);

gboolean       gcr_trust_add_pinned_certificate_finish         (GAsyncResult *result,
                                                                GError **error);

gboolean       gcr_trust_remove_pinned_certificate             (GcrCertificate *certificate,
                                                                const gchar *purpose,
                                                                const gchar *peer,
                                                                GCancellable *cancellable,
                                                                GError **error);

void           gcr_trust_remove_pinned_certificate_async       (GcrCertificate *certificate,
                                                                const gchar *purpose,
                                                                const gchar *peer,
                                                                GCancellable *cancellable,
                                                                GAsyncReadyCallback callback,
                                                                gpointer user_data);

gboolean       gcr_trust_remove_pinned_certificate_finish      (GAsyncResult *result,
                                                                GError **error);

gboolean       gcr_trust_is_certificate_anchored               (GcrCertificate *certificate,
                                                                const gchar *purpose,
                                                                GCancellable *cancellable,
                                                                GError **error);

void           gcr_trust_is_certificate_anchored_async         (GcrCertificate *certificate,
                                                                const gchar *purpose,
                                                                GCancellable *cancellable,
                                                                GAsyncReadyCallback callback,
                                                                gpointer user_data);

gboolean       gcr_trust_is_certificate_anchored_finish        (GAsyncResult *result,
                                                                GError **error);

gboolean       gcr_trust_is_certificate_distrusted             (unsigned char *serial_nr,
                                                                size_t         serial_nr_len,
                                                                unsigned char *issuer,
                                                                size_t         issuer_len,
                                                                GCancellable  *cancellable,
                                                                GError       **error);

void           gcr_trust_is_certificate_distrusted_async      (unsigned char      *serial_nr,
                                                               size_t              serial_nr_len,
                                                               unsigned char      *issuer,
                                                               size_t              issuer_len,
                                                               GCancellable       *cancellable,
                                                               GAsyncReadyCallback callback,
                                                               void               *user_data);

gboolean       gcr_trust_is_certificate_distrusted_finish     (GAsyncResult *result,
                                                               GError      **error);

G_END_DECLS

#endif /* __GCR_TOKEN_MANAGER_H__ */