aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_credential_service.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_credential_service.h')
-rw-r--r--src/include/gnunet_credential_service.h111
1 files changed, 50 insertions, 61 deletions
diff --git a/src/include/gnunet_credential_service.h b/src/include/gnunet_credential_service.h
index 7419407d3..906163c14 100644
--- a/src/include/gnunet_credential_service.h
+++ b/src/include/gnunet_credential_service.h
@@ -74,65 +74,49 @@ enum GNUNET_CREDENTIAL_CredentialFlags {
74 74
75GNUNET_NETWORK_STRUCT_BEGIN 75GNUNET_NETWORK_STRUCT_BEGIN
76/** 76/**
77 * The credential record 77 * The attribute delegation record
78 */ 78 */
79struct GNUNET_CREDENTIAL_CredentialRecordData { 79struct GNUNET_CREDENTIAL_DelegationRecord {
80
81 /**
82 * The signature for this credential by the issuer
83 */
84 struct GNUNET_CRYPTO_EcdsaSignature signature;
85
86 /**
87 * Signature meta
88 */
89 struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
90 80
91 /** 81 /**
92 * Public key of the issuer 82 * Number of delegation sets in this record
93 */ 83 */
94 struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key; 84 uint32_t set_count;
95 85
96 /** 86 /**
97 * Public key of the subject this credential was issued to 87 * Length of delegation sets
98 */ 88 */
99 struct GNUNET_CRYPTO_EcdsaPublicKey subject_key; 89 uint64_t data_size;
100
101 /** 90 /**
102 * Expiration time of this credential 91 * Followed by set_count DelegationSetRecords
103 */ 92 *
104 uint64_t expiration GNUNET_PACKED;
105
106 /**
107 * Followed by the attribute string
108 */ 93 */
109}; 94};
110 95
111
112/** 96/**
113 * The attribute delegation record 97 * The attribute delegation record
114*/ 98 */
115struct GNUNET_CREDENTIAL_DelegationRecordData { 99struct GNUNET_CREDENTIAL_DelegationRecordSet {
116
117 uint32_t set_count;
118 100
119 uint64_t data_size; 101 /**
102 * Public key of the subject this attribute was delegated to
103 */
104 struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
120 105
121 char *data;
122
123 /** 106 /**
124 * Followed by the attribute that was delegated to as string 107 * Length of attribute, may be 0
125 * May be empty
126 */ 108 */
109 uint32_t subject_attribute_len;
127}; 110};
128 111
129 112
113GNUNET_NETWORK_STRUCT_END
130 114
131/** 115/**
132 * The attribute delegation record 116 * The attribute delegation record
133*/ 117 */
134struct GNUNET_CREDENTIAL_DelegationSetRecord { 118struct GNUNET_CREDENTIAL_DelegationSet {
135 119
136 /** 120 /**
137 * Public key of the subject this attribute was delegated to 121 * Public key of the subject this attribute was delegated to
138 */ 122 */
@@ -140,20 +124,18 @@ struct GNUNET_CREDENTIAL_DelegationSetRecord {
140 124
141 uint32_t subject_attribute_len; 125 uint32_t subject_attribute_len;
142 126
143 const char *subject_attribute;
144
145 /** 127 /**
146 * Followed by the attribute that was delegated to as string 128 * The subject attribute
147 * May be empty
148 */ 129 */
130 const char *subject_attribute;
149}; 131};
150 132
151 133
152/** 134/**
153 * A delegation 135 * A delegation
154*/ 136 */
155struct GNUNET_CREDENTIAL_Delegation { 137struct GNUNET_CREDENTIAL_Delegation {
156 138
157 /** 139 /**
158 * The issuer of the delegation 140 * The issuer of the delegation
159 */ 141 */
@@ -188,9 +170,9 @@ struct GNUNET_CREDENTIAL_Delegation {
188 170
189/** 171/**
190 * A credential 172 * A credential
191*/ 173 */
192struct GNUNET_CREDENTIAL_Credential { 174struct GNUNET_CREDENTIAL_Credential {
193 175
194 /** 176 /**
195 * The issuer of the credential 177 * The issuer of the credential
196 */ 178 */
@@ -202,6 +184,16 @@ struct GNUNET_CREDENTIAL_Credential {
202 struct GNUNET_CRYPTO_EcdsaPublicKey subject_key; 184 struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
203 185
204 /** 186 /**
187 * Signature of this credential
188 */
189 struct GNUNET_CRYPTO_EcdsaSignature signature;
190
191 /**
192 * Expiration of this credential
193 */
194 struct GNUNET_TIME_Absolute expiration;
195
196 /**
205 * Length of the attribute 197 * Length of the attribute
206 */ 198 */
207 uint32_t issuer_attribute_len; 199 uint32_t issuer_attribute_len;
@@ -210,11 +202,8 @@ struct GNUNET_CREDENTIAL_Credential {
210 * The attribute 202 * The attribute
211 */ 203 */
212 const char *issuer_attribute; 204 const char *issuer_attribute;
213
214};
215 205
216 206};
217GNUNET_NETWORK_STRUCT_END
218 207
219 208
220 209
@@ -260,7 +249,7 @@ typedef void (*GNUNET_CREDENTIAL_VerifyResultProcessor) (void *cls,
260 * @param result the record data that can be handed to the subject 249 * @param result the record data that can be handed to the subject
261 */ 250 */
262typedef void (*GNUNET_CREDENTIAL_DelegateResultProcessor) (void *cls, 251typedef void (*GNUNET_CREDENTIAL_DelegateResultProcessor) (void *cls,
263 uint32_t success); 252 uint32_t success);
264 253
265/** 254/**
266 * Iterator called on obtained result for an attribute delegation removal. 255 * Iterator called on obtained result for an attribute delegation removal.
@@ -270,7 +259,7 @@ typedef void (*GNUNET_CREDENTIAL_DelegateResultProcessor) (void *cls,
270 * @param result the record data that can be handed to the subject 259 * @param result the record data that can be handed to the subject
271 */ 260 */
272typedef void (*GNUNET_CREDENTIAL_RemoveDelegateResultProcessor) (void *cls, 261typedef void (*GNUNET_CREDENTIAL_RemoveDelegateResultProcessor) (void *cls,
273 uint32_t success); 262 uint32_t success);
274 263
275 264
276 265
@@ -330,10 +319,10 @@ GNUNET_CREDENTIAL_add_delegation (struct GNUNET_CREDENTIAL_Handle *handle,
330 */ 319 */
331struct GNUNET_CREDENTIAL_Request * 320struct GNUNET_CREDENTIAL_Request *
332GNUNET_CREDENTIAL_remove_delegation (struct GNUNET_CREDENTIAL_Handle *handle, 321GNUNET_CREDENTIAL_remove_delegation (struct GNUNET_CREDENTIAL_Handle *handle,
333 struct GNUNET_IDENTITY_Ego *issuer, 322 struct GNUNET_IDENTITY_Ego *issuer,
334 const char *attribute, 323 const char *attribute,
335 GNUNET_CREDENTIAL_RemoveDelegateResultProcessor proc, 324 GNUNET_CREDENTIAL_RemoveDelegateResultProcessor proc,
336 void *proc_cls); 325 void *proc_cls);
337 326
338 327
339 328
@@ -347,12 +336,12 @@ GNUNET_CREDENTIAL_remove_delegation (struct GNUNET_CREDENTIAL_Handle *handle,
347 * @param expiration the TTL of the credential 336 * @param expiration the TTL of the credential
348 * @return handle to the queued request 337 * @return handle to the queued request
349 */ 338 */
350struct GNUNET_CREDENTIAL_CredentialRecordData * 339struct GNUNET_CREDENTIAL_Credential*
351GNUNET_CREDENTIAL_issue (struct GNUNET_CREDENTIAL_Handle *handle, 340GNUNET_CREDENTIAL_credential_issue (
352 const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, 341 const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer,
353 struct GNUNET_CRYPTO_EcdsaPublicKey *subject, 342 struct GNUNET_CRYPTO_EcdsaPublicKey *subject,
354 const char *attribute, 343 const char *attribute,
355 struct GNUNET_TIME_Absolute *expiration); 344 struct GNUNET_TIME_Absolute *expiration);
356 345
357 346
358/** 347/**