Merge branch 'abe' into identity_abe
[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
6       it under the terms of the GNU General Public License as published
7       by the Free Software Foundation; either version 3, or (at your
8       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       General Public License for more details.
14
15       You should have received a copy of the GNU General Public License
16       along with GNUnet; see the file COPYING.  If not, write to the
17       Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18       Boston, MA 02110-1301, USA.
19  */
20 /**
21  * @file credential/credential.h
22  * @brief IPC messages between CREDENTIAL API and CREDENTIAL service
23  * @author Adnan Husain 
24  */
25 #ifndef CREDENTIAL_H
26 #define CREDENTIAL_H
27
28 #include "gnunet_credential_service.h"
29
30 GNUNET_NETWORK_STRUCT_BEGIN
31
32 /**
33  * Message from client to Credential service to collect credentials.
34  */
35 struct CollectMessage
36 {
37   /**
38    * Header of type #GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY
39    */
40   struct GNUNET_MessageHeader header;
41
42   /**
43    * Subject public key
44    */
45   struct GNUNET_CRYPTO_EcdsaPrivateKey subject_key;
46
47   /**
48    * Trust anchor
49    */
50   struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
51
52   /**
53    * Length of the issuer attribute
54    */
55   uint16_t issuer_attribute_len;
56
57   /**
58    * Unique identifier for this request (for key collisions).
59    */
60   uint32_t id GNUNET_PACKED;
61
62   /* Followed by the zero-terminated attribute */
63
64 };
65
66
67 /**
68  * Message from client to Credential service to verify attributes.
69  */
70 struct VerifyMessage
71 {
72   /**
73    * Header of type #GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY
74    */
75   struct GNUNET_MessageHeader header;
76
77   /**
78    * Subject public key
79    */
80   struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
81
82   /**
83    * Trust anchor
84    */
85   struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
86
87   /**
88    * Number of credentials
89    */
90   uint32_t c_count;
91
92   /**
93    * Length of the issuer attribute
94    */
95   uint16_t issuer_attribute_len;
96
97   /**
98    * Unique identifier for this request (for key collisions).
99    */
100   uint32_t id GNUNET_PACKED;
101
102   /* Followed by the zero-terminated attribute and credentials to look up */
103
104 };
105
106
107 /**
108  * Message from CREDENTIAL service to client: new results.
109  */
110 struct DelegationChainResultMessage
111 {
112   /**
113     * Header of type #GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY_RESULT
114    */
115   struct GNUNET_MessageHeader header;
116
117   /**
118    * Unique identifier for this request (for key collisions).
119    */
120   uint32_t id GNUNET_PACKED;
121   
122   /**
123    * Indicates if credential has been found at all
124    */
125   uint32_t cred_found GNUNET_PACKED;
126
127   /**
128    * The number of delegations in the response
129    */
130   uint32_t d_count GNUNET_PACKED;
131
132   /**
133    * The number of credentials in the response
134    */
135   uint32_t c_count GNUNET_PACKED;
136
137   /* followed by ad_count GNUNET_CREDENTIAL_RecordData structs*/
138
139 };
140
141 struct DelegationRecordData
142 {
143   /**
144    * Subject key
145    */
146   struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
147   
148   /**
149    * Subject attributes
150    */
151   uint32_t subject_attribute_len GNUNET_PACKED;
152 };
153
154
155 struct ChainEntry
156 {
157   /**
158    * Issuer key
159    */
160   struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
161   
162   /**
163    * Subject key
164    */
165   struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
166   
167   /**
168    * Issuer attributes
169    */
170   uint32_t issuer_attribute_len GNUNET_PACKED;
171   
172   /**
173    * Subject attributes
174    */
175   uint32_t subject_attribute_len GNUNET_PACKED;
176 };
177
178
179 struct CredentialEntry
180 {
181
182   /**
183    * The signature for this credential by the issuer
184    */
185   struct GNUNET_CRYPTO_EcdsaSignature signature;
186
187   /**
188    * Signature meta
189    */
190   struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
191
192   /**
193    * Public key of the issuer
194    */
195   struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
196
197   /**
198    * Public key of the subject this credential was issued to
199    */
200   struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
201
202   /**
203    * Expiration time of this credential
204    */
205   uint64_t expiration GNUNET_PACKED;
206    
207   /**
208    * Issuer attribute length
209    */
210   uint32_t issuer_attribute_len;
211
212   /**
213    * Followed by the attribute string
214    */
215 };
216
217
218 GNUNET_NETWORK_STRUCT_END
219
220 #endif
221