Debian Codegraph @

pkcs11/gkm/gkm-attributes.h

raw
1 /*
2 * gnome-keyring
3 *
4 * Copyright (C) 2008 Stefan Walter
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation; either version 2.1 of
9 * the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this program; if not, see
18 * <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef GKM_ATTRIBUTE_H_
22 #define GKM_ATTRIBUTE_H_
23
24 #include <glib.h>
25
26 #include <gcrypt.h>
27
28 #include "pkcs11/pkcs11.h"
29
30 CK_RV gkm_attribute_get_bool (CK_ATTRIBUTE_PTR attr,
31 gboolean *value);
32
33 CK_RV gkm_attribute_get_ulong (CK_ATTRIBUTE_PTR attr,
34 CK_ULONG *value);
35
36 CK_RV gkm_attribute_get_time (CK_ATTRIBUTE_PTR attr,
37 glong *value);
38
39 CK_RV gkm_attribute_get_string (CK_ATTRIBUTE_PTR attr,
40 gchar **value);
41
42 CK_RV gkm_attribute_get_bytes (CK_ATTRIBUTE_PTR attr,
43 GBytes **value);
44
45 CK_RV gkm_attribute_get_mpi (CK_ATTRIBUTE_PTR attr,
46 gcry_mpi_t *value);
47
48 CK_RV gkm_attribute_get_template (CK_ATTRIBUTE_PTR attr,
49 GArray **template);
50
51 CK_RV gkm_attribute_set_empty (CK_ATTRIBUTE_PTR attr);
52
53 CK_RV gkm_attribute_set_bool (CK_ATTRIBUTE_PTR attr,
54 CK_BBOOL value);
55
56 CK_RV gkm_attribute_set_ulong (CK_ATTRIBUTE_PTR attr,
57 CK_ULONG value);
58
59 CK_RV gkm_attribute_set_string (CK_ATTRIBUTE_PTR attr,
60 const gchar* string);
61
62 CK_RV gkm_attribute_set_date (CK_ATTRIBUTE_PTR attr,
63 time_t when);
64
65 CK_RV gkm_attribute_set_time (CK_ATTRIBUTE_PTR attr,
66 glong when);
67
68 CK_RV gkm_attribute_set_data (CK_ATTRIBUTE_PTR attr,
69 gconstpointer value,
70 gsize n_value);
71
72 CK_RV gkm_attribute_set_bytes (CK_ATTRIBUTE_PTR attr,
73 GBytes *value);
74
75 CK_RV gkm_attribute_set_mpi (CK_ATTRIBUTE_PTR attr,
76 gcry_mpi_t mpi);
77
78 CK_RV gkm_attribute_set_template (CK_ATTRIBUTE_PTR attr,
79 GArray *template);
80
81 CK_RV gkm_attribute_set_checksum (CK_ATTRIBUTE_PTR attr,
82 GChecksumType ctype,
83 gconstpointer data,
84 gsize n_data);
85
86 guint gkm_attribute_hash (gconstpointer v);
87
88 gboolean gkm_attribute_equal (gconstpointer a,
89 gconstpointer b);
90
91 void gkm_attribute_consume (CK_ATTRIBUTE_PTR attr);
92
93 gboolean gkm_attribute_consumed (CK_ATTRIBUTE_PTR attr);
94
95
96
97 gboolean gkm_attributes_contains (CK_ATTRIBUTE_PTR attrs,
98 CK_ULONG n_attrs,
99 CK_ATTRIBUTE_PTR attr);
100
101 void gkm_attributes_consume (CK_ATTRIBUTE_PTR attrs,
102 CK_ULONG n_attrs, ...);
103
104 CK_ATTRIBUTE_PTR gkm_attributes_find (CK_ATTRIBUTE_PTR attrs,
105 CK_ULONG n_attrs,
106 CK_ATTRIBUTE_TYPE type);
107
108 gboolean gkm_attributes_find_boolean (CK_ATTRIBUTE_PTR attrs,
109 CK_ULONG n_attrs,
110 CK_ATTRIBUTE_TYPE type,
111 gboolean *value);
112
113 gboolean gkm_attributes_find_ulong (CK_ATTRIBUTE_PTR attrs,
114 CK_ULONG n_attrs,
115 CK_ATTRIBUTE_TYPE type,
116 gulong *value);
117
118 gboolean gkm_attributes_find_mpi (CK_ATTRIBUTE_PTR attrs,
119 CK_ULONG n_attrs,
120 CK_ATTRIBUTE_TYPE type,
121 gcry_mpi_t *mpi);
122
123 gboolean gkm_attributes_find_string (CK_ATTRIBUTE_PTR attrs,
124 CK_ULONG n_attrs,
125 CK_ATTRIBUTE_TYPE type,
126 gchar **value);
127
128 gboolean gkm_attributes_find_bytes (CK_ATTRIBUTE_PTR attrs,
129 CK_ULONG n_attrs,
130 CK_ATTRIBUTE_TYPE type,
131 GBytes **value);
132
133 GArray* gkm_template_new (CK_ATTRIBUTE_PTR attrs,
134 CK_ULONG n_attrs);
135
136 void gkm_template_set (GArray *template,
137 CK_ATTRIBUTE_PTR attr);
138
139 void gkm_template_set_value (GArray *template,
140 CK_ATTRIBUTE_TYPE type,
141 CK_VOID_PTR value,
142 CK_ULONG length);
143
144 void gkm_template_set_string (GArray *template,
145 CK_ATTRIBUTE_TYPE type,
146 const gchar *value);
147
148 void gkm_template_set_ulong (GArray *template,
149 CK_ATTRIBUTE_TYPE type,
150 CK_ULONG value);
151
152 void gkm_template_set_boolean (GArray *template,
153 CK_ATTRIBUTE_TYPE type,
154 CK_BBOOL value);
155
156 void gkm_template_free (GArray *template);
157
158 CK_ATTRIBUTE_PTR gkm_template_find (GArray *template,
159 CK_ATTRIBUTE_TYPE type);
160
161 gboolean gkm_template_find_boolean (GArray *template,
162 CK_ATTRIBUTE_TYPE type,
163 gboolean *value);
164
165 gboolean gkm_template_find_ulong (GArray *template,
166 CK_ATTRIBUTE_TYPE type,
167 gulong *value);
168
169 #endif /* GKM_ATTRIBUTE_H_ */