glitch in the license text detected by hyazinthe, thank you!
[oweals/gnunet.git] / src / credential / credential.h
1 /*
2       This file is part of GNUnet
3       Copyright (C) 2012-2013 GNUnet e.V.
4
5       GNUnet is free software: you can redistribute it and/or modify it
6       under the terms of the GNU Affero General Public License as published
7       by the Free Software Foundation, either version 3 of the License,
8       or (at your option) any later version.
9
10       GNUnet is distributed in the hope that it will be useful, but
11       WITHOUT ANY WARRANTY; without even the implied warranty of
12       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13       Affero General Public License for more details.
14  */
15 /**
16  * @file credential/credential.h
17  * @brief IPC messages between CREDENTIAL API and CREDENTIAL service
18  * @author Martin Schanzenbach
19  */
20 #ifndef CREDENTIAL_H
21 #define CREDENTIAL_H
22
23 #include "gnunet_credential_service.h"
24
25 GNUNET_NETWORK_STRUCT_BEGIN
26
27 /**
28  * Message from client to Credential service to collect credentials.
29  */
30 struct CollectMessage
31 {
32   /**
33    * Header of type #GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY
34    */
35   struct GNUNET_MessageHeader header;
36
37   /**
38    * Subject public key
39    */
40   struct GNUNET_CRYPTO_EcdsaPrivateKey subject_key;
41
42   /**
43    * Trust anchor
44    */
45   struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
46
47   /**
48    * Length of the issuer attribute
49    */
50   uint16_t issuer_attribute_len;
51
52   /**
53    * Unique identifier for this request (for key collisions).
54    */
55   uint32_t id GNUNET_PACKED;
56
57   /* Followed by the zero-terminated attribute */
58
59 };
60
61
62 /**
63  * Message from client to Credential service to verify attributes.
64  */
65 struct VerifyMessage
66 {
67   /**
68    * Header of type #GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY
69    */
70   struct GNUNET_MessageHeader header;
71
72   /**
73    * Subject public key
74    */
75   struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
76
77   /**
78    * Trust anchor
79    */
80   struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
81
82   /**
83    * Number of credentials
84    */
85   uint32_t c_count;
86
87   /**
88    * Length of the issuer attribute
89    */
90   uint16_t issuer_attribute_len;
91
92   /**
93    * Unique identifier for this request (for key collisions).
94    */
95   uint32_t id GNUNET_PACKED;
96
97   /* Followed by the zero-terminated attribute and credentials to look up */
98
99 };
100
101
102 /**
103  * Message from CREDENTIAL service to client: new results.
104  */
105 struct DelegationChainResultMessage
106 {
107   /**
108     * Header of type #GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY_RESULT
109    */
110   struct GNUNET_MessageHeader header;
111
112   /**
113    * Unique identifier for this request (for key collisions).
114    */
115   uint32_t id GNUNET_PACKED;
116   
117   /**
118    * Indicates if credential has been found at all
119    */
120   uint32_t cred_found GNUNET_PACKED;
121
122   /**
123    * The number of delegations in the response
124    */
125   uint32_t d_count GNUNET_PACKED;
126
127   /**
128    * The number of credentials in the response
129    */
130   uint32_t c_count GNUNET_PACKED;
131
132   /* followed by ad_count GNUNET_CREDENTIAL_RecordData structs*/
133
134 };
135
136 struct DelegationRecordData
137 {
138   /**
139    * Subject key
140    */
141   struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
142   
143   /**
144    * Subject attributes
145    */
146   uint32_t subject_attribute_len GNUNET_PACKED;
147 };
148
149
150 struct ChainEntry
151 {
152   /**
153    * Issuer key
154    */
155   struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
156   
157   /**
158    * Subject key
159    */
160   struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
161   
162   /**
163    * Issuer attributes
164    */
165   uint32_t issuer_attribute_len GNUNET_PACKED;
166   
167   /**
168    * Subject attributes
169    */
170   uint32_t subject_attribute_len GNUNET_PACKED;
171 };
172
173
174 struct CredentialEntry
175 {
176
177   /**
178    * The signature for this credential by the issuer
179    */
180   struct GNUNET_CRYPTO_EcdsaSignature signature;
181
182   /**
183    * Signature meta
184    */
185   struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
186
187   /**
188    * Public key of the issuer
189    */
190   struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
191
192   /**
193    * Public key of the subject this credential was issued to
194    */
195   struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
196
197   /**
198    * Expiration time of this credential
199    */
200   uint64_t expiration GNUNET_PACKED;
201    
202   /**
203    * Issuer attribute length
204    */
205   uint32_t issuer_attribute_len;
206
207   /**
208    * Followed by the attribute string
209    */
210 };
211
212
213 GNUNET_NETWORK_STRUCT_END
214
215 #endif
216