aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_credential_service.h
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2016-11-20 17:49:04 +0100
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2016-11-20 17:49:04 +0100
commitfad73f2435336733ae585c7a018df860bec3bdf1 (patch)
tree912becfd30ae7d6a4d1fcc53095eef5205daf5ec /src/include/gnunet_credential_service.h
parent18f106166cf64cc72206cd35301276aa21ca100a (diff)
downloadgnunet-fad73f2435336733ae585c7a018df860bec3bdf1.tar.gz
gnunet-fad73f2435336733ae585c7a018df860bec3bdf1.zip
- add missing API; no impl
Diffstat (limited to 'src/include/gnunet_credential_service.h')
-rw-r--r--src/include/gnunet_credential_service.h191
1 files changed, 149 insertions, 42 deletions
diff --git a/src/include/gnunet_credential_service.h b/src/include/gnunet_credential_service.h
index 739e6fe95..84cc68146 100644
--- a/src/include/gnunet_credential_service.h
+++ b/src/include/gnunet_credential_service.h
@@ -53,7 +53,7 @@ struct GNUNET_CREDENTIAL_Handle;
53/** 53/**
54 * Handle to control a lookup operation. 54 * Handle to control a lookup operation.
55 */ 55 */
56struct GNUNET_CREDENTIAL_LookupRequest; 56struct GNUNET_CREDENTIAL_Request;
57 57
58/* 58/*
59* Enum used for checking whether the issuer has the authority to issue credentials or is just a subject 59* Enum used for checking whether the issuer has the authority to issue credentials or is just a subject
@@ -72,23 +72,59 @@ enum GNUNET_CREDENTIAL_CredentialFlags {
72}; 72};
73 73
74GNUNET_NETWORK_STRUCT_BEGIN 74GNUNET_NETWORK_STRUCT_BEGIN
75/* 75/**
76* Data stored in the credential record 76 * The attribute record
77*/ 77 */
78struct GNUNET_CREDENTIAL_RecordData { 78struct GNUNET_CREDENTIAL_AttributeRecordData {
79 79
80 /* 80 /**
81 * Key of the 81 * Public key of the subject this credential was issued to
82 */ 82 */
83 struct GNUNET_CRYPTO_EcdsaPublicKey subject_key; 83 struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
84 84
85 /**
86 * Public key of the issuer
87 */
85 struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key; 88 struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
86 89
87 90 /**
91 * Flags for this credential
92 */
88 uint32_t credential_flags GNUNET_PACKED; 93 uint32_t credential_flags GNUNET_PACKED;
89 94
95 /**
96 * Expiration time of this credential
97 */
98 uint64_t expiration GNUNET_PACKED;
99
100 /**
101 * The signature for this credential by the issuer
102 */
103 struct GNUNET_CRYPTO_EcdsaSignature sig;
104
105 /**
106 * Followed by the attribute string
107 */
108};
109
110
111/**
112 * The attribute delegation record
113*/
114struct GNUNET_CREDENTIAL_AttributeDelegationRecordData {
115
116 /**
117 * Public key of the subject this attribute was delegated to
118 */
119 struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
120
121 /**
122 * Followed by the attribute that was delegated to as string
123 */
90}; 124};
91 125
126
127
92GNUNET_NETWORK_STRUCT_END 128GNUNET_NETWORK_STRUCT_END
93 129
94 130
@@ -113,58 +149,129 @@ GNUNET_CREDENTIAL_disconnect (struct GNUNET_CREDENTIAL_Handle *handle);
113 149
114 150
115/** 151/**
116 * Iterator called on obtained result for a Credential lookup. 152 * Iterator called on obtained result for an attribute verification.
117 * 153 *
118 * @param cls closure 154 * @param cls closure
119 * @param issuer the issuer chain 155 * @param issuer the issuer of the attribute NULL if verification failed
120 * @param issuer_len length of issuer chain 156 * @param result the result of the verification
121 * @param rd the records in reply 157 * @param rd the records in reply
122 */ 158 */
123typedef void (*GNUNET_CREDENTIAL_VerifyResultProcessor) (void *cls, 159typedef void (*GNUNET_CREDENTIAL_VerifyResultProcessor) (void *cls,
124 struct GNUNET_IDENTITY_Ego *issuer, 160 struct GNUNET_CRYPTO_EcdsaPublicKey *issuer,
125 uint16_t issuer_len, 161 uint32_t result);
126 const struct GNUNET_CREDENTIAL_RecordData *data); 162
163/**
164 * Iterator called on obtained result for an attribute issuance.
165 *
166 * @param cls closure
167 * @param result the record data that can be handed to the subject
168 */
169typedef void (*GNUNET_CREDENTIAL_IssueResultProcessor) (void *cls,
170 struct GNUNET_CREDENTIAL_AttributeRecordData *data);
171
172/**
173 * Iterator called on obtained result for an attribute delegation.
174 *
175 * @param cls closure
176 * @param success GNUNET_YES if successful
177 * @param result the record data that can be handed to the subject
178 */
179typedef void (*GNUNET_CREDENTIAL_DelegateResultProcessor) (void *cls,
180 uint32_t success);
181
182/**
183 * Iterator called on obtained result for an attribute delegation removal.
184 *
185 * @param cls closure
186 * @param success GNUNET_YES if successful
187 * @param result the record data that can be handed to the subject
188 */
189typedef void (*GNUNET_CREDENTIAL_RemoveDelegateResultProcessor) (void *cls,
190 uint32_t success);
191
192
127 193
128 194
129/** 195/**
130 * Perform an asynchronous lookup operation for a credential. 196 * Performs attribute verification.
197 * Checks if there is a delegation chain from
198 * attribute ``issuer_attribute'' issued by the issuer
199 * with public key ``issuer_key'' maps to the attribute
200 * ``subject_attribute'' claimed by the subject with key
201 * ``subject_key''
131 * 202 *
132 * @param handle handle to the Credential service 203 * @param handle handle to the Credential service
133 * @param credential the credential to look up 204 * @param issuer_key the issuer public key
134 * @param subject Ego to check the credential for 205 * @param issuer_attribute the issuer attribute
206 * @param subject_key the subject public key
207 * @param subject_attribute the attribute claimed by the subject
135 * @param proc function to call on result 208 * @param proc function to call on result
136 * @param proc_cls closure for processor 209 * @param proc_cls closure for processor
137 * @return handle to the queued request 210 * @return handle to the queued request
138 */ 211 */
139struct GNUNET_CREDENTIAL_VerifyRequest* 212struct GNUNET_CREDENTIAL_Request*
140GNUNET_CREDENTIAL_verify (struct GNUNET_CREDENTIAL_Handle *handle, 213GNUNET_CREDENTIAL_verify (struct GNUNET_CREDENTIAL_Handle *handle,
214 const struct GNUNET_CRYPTO_EcdsaPublicKey *issuer_key,
141 const char *issuer_attribute, 215 const char *issuer_attribute,
142 const char *subject_attribute,
143 const struct GNUNET_CRYPTO_EcdsaPublicKey *subject_key, 216 const struct GNUNET_CRYPTO_EcdsaPublicKey *subject_key,
144 const struct GNUNET_CRYPTO_EcdsaPublicKey *issuer_key, 217 const char *subject_attribute,
145 uint32_t credential_flags,
146 GNUNET_CREDENTIAL_VerifyResultProcessor proc, 218 GNUNET_CREDENTIAL_VerifyResultProcessor proc,
147 void *proc_cls); 219 void *proc_cls);
148 220
149/** 221/**
150 * Issue a credential to an identity 222 * Delegate an attribute
151 * 223 *
152 * @param handle handle to the Credential service 224 * @param handle handle to the Credential service
153 * @param issuer the identity that issues the credential 225 * @param issuer the ego that should be used to delegate the attribute
154 * @param subject the subject of the credential 226 * @param attribute the name of the attribute to delegate
155 * @param credential the name of the credential 227 * @param subject the subject of the delegation
156 * @param data the data of the credential 228 * @param delegated_attribute the name of the attribute that is delegated to
229 * @return handle to the queued request
230 */
231struct GNUNET_CREDENTIAL_Request *
232GNUNET_CREDENTIAL_add_delegation (struct GNUNET_CREDENTIAL_Handle *handle,
233 struct GNUNET_IDENTITY_Ego *issuer,
234 const char *attribute,
235 struct GNUNET_CRYPTO_EcdsaPublicKey *subject,
236 const char *delegated_attribute,
237 GNUNET_CREDENTIAL_DelegateResultProcessor proc,
238 void *proc_cls);
239
240/**
241 * Remove a delegation
242 *
243 * @param handle handle to the Credential service
244 * @param issuer the ego that was used to delegate the attribute
245 * @param attribute the name of the attribute that is delegated
157 * @return handle to the queued request 246 * @return handle to the queued request
158 */ 247 */
159/**struct GNUNET_CREDENTIAL_IssueRequest * 248struct GNUNET_CREDENTIAL_Request *
249GNUNET_CREDENTIAL_remove_delegation (struct GNUNET_CREDENTIAL_Handle *handle,
250 struct GNUNET_IDENTITY_Ego *issuer,
251 const char *attribute,
252 GNUNET_CREDENTIAL_RemoveDelegateResultProcessor proc,
253 void *proc_cls);
254
255
256
257/**
258 * Issue an attribute to a subject
259 *
260 * @param handle handle to the Credential service
261 * @param issuer the ego that should be used to issue the attribute
262 * @param subject the subject of the attribute
263 * @param attribute the name of the attribute
264 * @return handle to the queued request
265 */
266struct GNUNET_CREDENTIAL_Request *
160GNUNET_CREDENTIAL_issue (struct GNUNET_CREDENTIAL_Handle *handle, 267GNUNET_CREDENTIAL_issue (struct GNUNET_CREDENTIAL_Handle *handle,
161 struct GNUNET_IDENTITY_Ego *issuer, 268 struct GNUNET_IDENTITY_Ego *issuer,
162 struct GNUNET_IDENTITY_Ego *subject, 269 struct GNUNET_CRYPTO_EcdsaPublicKey *subject,
163 const char *credential, 270 const char *attribute,
164 struct GNUNET_CREDENTIAL_Data *data,
165 GNUNET_CREDENTIAL_IssueResultProcessor proc, 271 GNUNET_CREDENTIAL_IssueResultProcessor proc,
166 void *proc_cls); 272 void *proc_cls);
167*/ 273
274
168/** 275/**
169 * Remove a credential 276 * Remove a credential
170 * 277 *
@@ -174,15 +281,15 @@ GNUNET_CREDENTIAL_issue (struct GNUNET_CREDENTIAL_Handle *handle,
174 * @param credential the name of the credential 281 * @param credential the name of the credential
175 * @return handle to the queued request 282 * @return handle to the queued request
176 */ 283 */
177 /** 284/**
178struct GNUNET_CREDENTIAL_IssueRequest * 285 struct GNUNET_CREDENTIAL_IssueRequest *
179GNUNET_CREDENTIAL_remove (struct GNUNET_CREDENTIAL_Handle *handle, 286 GNUNET_CREDENTIAL_remove (struct GNUNET_CREDENTIAL_Handle *handle,
180 struct GNUNET_IDENTITY_Ego *issuer, 287 struct GNUNET_IDENTITY_Ego *issuer,
181 struct GNUNET_IDENTITY_Ego *subject, 288 struct GNUNET_IDENTITY_Ego *subject,
182 const char *credential, 289 const char *credential,
183 GNUNET_CREDENTIAL_IssueResultProcessor proc, 290 GNUNET_CREDENTIAL_IssueResultProcessor proc,
184 void *proc_cls); 291 void *proc_cls);
185*/ 292 */
186 293
187 294
188/** 295/**
@@ -191,7 +298,7 @@ GNUNET_CREDENTIAL_remove (struct GNUNET_CREDENTIAL_Handle *handle,
191 * @param lr the lookup request to cancel 298 * @param lr the lookup request to cancel
192 */ 299 */
193void 300void
194GNUNET_CREDENTIAL_verify_cancel (struct GNUNET_CREDENTIAL_VerifyRequest *vr); 301GNUNET_CREDENTIAL_verify_cancel (struct GNUNET_CREDENTIAL_Request *vr);
195 302
196 303
197#if 0 /* keep Emacsens' auto-indent happy */ 304#if 0 /* keep Emacsens' auto-indent happy */