aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjospaeth <spaethj@in.tum.de>2020-06-28 13:34:13 +0200
committerjospaeth <spaethj@in.tum.de>2020-07-09 14:56:09 +0200
commitc9ea27bc037eeae5ee39b05cd11b06e48399fb43 (patch)
treed3deb1b47d472561f454799be08d4c0aa349c5c1
parentae8cb76dead0403f4258c762d8d330cc5aca938d (diff)
downloadgnunet-c9ea27bc037eeae5ee39b05cd11b06e48399fb43.tar.gz
gnunet-c9ea27bc037eeae5ee39b05cd11b06e48399fb43.zip
add plugins for key and attributes escrow
-rw-r--r--.gitignore2
-rw-r--r--src/include/gnunet_reclaim_lib.h16
-rw-r--r--src/include/gnunet_reclaim_plugin.h88
-rw-r--r--src/reclaim/plugin_reclaim_escrow_attributes_plaintext.c99
-rw-r--r--src/reclaim/plugin_reclaim_escrow_key_anastasis.c100
-rw-r--r--src/reclaim/plugin_reclaim_escrow_key_gns.c100
-rw-r--r--src/reclaim/plugin_reclaim_escrow_key_plaintext.c107
7 files changed, 512 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index b337cc058..e65a8cfdb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -72,3 +72,5 @@ cmake/
72build 72build
73CMakeLists.txt 73CMakeLists.txt
74CMakeFiles.txt 74CMakeFiles.txt
75
76.vscode/settings.json
diff --git a/src/include/gnunet_reclaim_lib.h b/src/include/gnunet_reclaim_lib.h
index 54d284f3c..d7d1eb938 100644
--- a/src/include/gnunet_reclaim_lib.h
+++ b/src/include/gnunet_reclaim_lib.h
@@ -66,6 +66,22 @@ extern "C" {
66#define GNUNET_RECLAIM_ID_LENGTH (256 / 8) 66#define GNUNET_RECLAIM_ID_LENGTH (256 / 8)
67 67
68/** 68/**
69 * Enum for the different key escrow methods
70 */
71enum GNUNET_RECLAIM_Key_Escrow_Method {
72 GNUNET_RECLAIM_KE_PLAINTEXT,
73 GNUNET_RECLAIM_KE_GNS,
74 GNUNET_RECLAIM_KE_ANASTASIS
75};
76
77/**
78 * Enum for the different attribute escrow methods
79 */
80enum GNUNET_RECLAIM_Attribute_Escrow_Method {
81 GNUNET_RECLAIM_AE_PLAINTEXT
82};
83
84/**
69 * A reclaim identifier 85 * A reclaim identifier
70 * FIXME maybe put this in a different namespace 86 * FIXME maybe put this in a different namespace
71 */ 87 */
diff --git a/src/include/gnunet_reclaim_plugin.h b/src/include/gnunet_reclaim_plugin.h
index 992ad0cc3..c9875e87c 100644
--- a/src/include/gnunet_reclaim_plugin.h
+++ b/src/include/gnunet_reclaim_plugin.h
@@ -32,6 +32,7 @@
32 32
33#include "gnunet_util_lib.h" 33#include "gnunet_util_lib.h"
34#include "gnunet_reclaim_lib.h" 34#include "gnunet_reclaim_lib.h"
35#include "gnunet_identity_service.h"
35 36
36#ifdef __cplusplus 37#ifdef __cplusplus
37extern "C" { 38extern "C" {
@@ -200,6 +201,50 @@ typedef int (*GNUNET_RECLAIM_AttestationGetExpirationFunction) (
200 const struct GNUNET_RECLAIM_Attestation *attest, 201 const struct GNUNET_RECLAIM_Attestation *attest,
201 struct GNUNET_TIME_Absolute *expiration); 202 struct GNUNET_TIME_Absolute *expiration);
202 203
204/**
205 * Function called to start the escrow of the key
206 *
207 * @param ego the identity ego containing the private key
208 * @param escrowAnchor the anchor needed to restore the key
209 * @return GNUNET_OK if successful
210 */
211typedef int (*GNUNET_RECLAIM_EscrowStartKeyEscrowFunction) (
212 struct GNUNET_IDENTITY_Ego *ego,
213 void *escrowAnchor);
214
215/**
216 * Function called to renew the escrow of the key
217 *
218 * @param ego the identity ego containing the private key
219 * @param escrowAnchor the anchor needed to restore the key
220 * @return GNUNET_OK if successful
221 */
222typedef int (*GNUNET_RECLAIM_EscrowRenewKeyEscrowFunction) (
223 struct GNUNET_IDENTITY_Ego *ego,
224 void *escrowAnchor);
225
226/**
227 * Function called to start the escrow of the attributes
228 *
229 * @param identity the private key of the identity
230 * @param escrowAnchor the anchor needed to restore the attributes
231 * @return GNUNET_OK if successful
232 */
233typedef int (*GNUNET_RECLAIM_EscrowStartAttributesEscrowFunction) (
234 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
235 void *escrowAnchor);
236
237/**
238 * Function called to renew the escrow of the attributes
239 *
240 * @param identity the private key of the identity
241 * @param escrowAnchor the anchor needed to restore the attributes
242 * @return GNUNET_OK if successful
243 */
244typedef int (*GNUNET_RECLAIM_EscrowRenewAttributesEscrowFunction) (
245 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
246 void *escrowAnchor);
247
203 248
204 249
205/** 250/**
@@ -282,6 +327,49 @@ struct GNUNET_RECLAIM_AttestationPluginFunctions
282 GNUNET_RECLAIM_AttestationGetExpirationFunction get_expiration; 327 GNUNET_RECLAIM_AttestationGetExpirationFunction get_expiration;
283}; 328};
284 329
330/**
331 * Each plugin is required to return a pointer to a struct of this
332 * type as the return value from its entry point.
333 */
334struct GNUNET_RECLAIM_EscrowKeyPluginFunctions
335{
336 /**
337 * Closure for all of the callbacks.
338 */
339 void *cls;
340
341 /**
342 * Start key escrow
343 */
344 GNUNET_RECLAIM_EscrowStartKeyEscrowFunction start_key_escrow;
345
346 /**
347 * Renew key escrow
348 */
349 GNUNET_RECLAIM_EscrowRenewKeyEscrowFunction renew_key_escrow;
350};
351
352/**
353 * Each plugin is required to return a pointer to a struct of this
354 * type as the return value from its entry point.
355 */
356struct GNUNET_RECLAIM_EscrowAttributesPluginFunctions
357{
358 /**
359 * Closure for all of the callbacks.
360 */
361 void *cls;
362
363 /**
364 * Start attributes escrow
365 */
366 GNUNET_RECLAIM_EscrowStartAttributesEscrowFunction start_attributes_escrow;
367
368 /**
369 * Renew attributes escrow
370 */
371 GNUNET_RECLAIM_EscrowRenewAttributesEscrowFunction renew_attributes_escrow;
372};
285 373
286 374
287#if 0 /* keep Emacsens' auto-indent happy */ 375#if 0 /* keep Emacsens' auto-indent happy */
diff --git a/src/reclaim/plugin_reclaim_escrow_attributes_plaintext.c b/src/reclaim/plugin_reclaim_escrow_attributes_plaintext.c
new file mode 100644
index 000000000..3000bae13
--- /dev/null
+++ b/src/reclaim/plugin_reclaim_escrow_attributes_plaintext.c
@@ -0,0 +1,99 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2013, 2014, 2016 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 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file reclaim-escrow/plugin_reclaim_escrow_attributes_plaintext.c
23 * @brief reclaim-escrow-plugin-attributes-plaintext escrow plugin for
24 * plaintext escrow of the attributes
25 *
26 * @author Johannes Späth
27 */
28#include "platform.h"
29#include "gnunet_util_lib.h"
30#include "gnunet_reclaim_plugin.h"
31#include <inttypes.h>
32
33
34/**
35 * Start the plaintext escrow of the attributes, i.e. simply hand them out
36 *
37 * @param identity the private key of the identity
38 * @param escrowAnchor the anchor needed to restore the attributes
39 * @return GNUNET_OK if successful
40 */
41int
42start_plaintext_attributes_escrow (const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
43 void *escrowAnchor)
44{
45 // TODO: implement
46 return GNUNET_NO;
47}
48
49
50/**
51 * Renew the plaintext escrow of the attributes, i.e. simply hand them out
52 *
53 * @param identity the private key of the identity
54 * @param escrowAnchor the anchor needed to restore the attributes
55 * @return GNUNET_OK if successful
56 */
57int
58renew_plaintext_attributes_escrow (const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
59 void *escrowAnchor)
60{
61 return start_plaintext_attributes_escrow(identity, escrowAnchor);
62}
63
64
65/**
66 * Entry point for the plugin.
67 *
68 * @param cls NULL
69 * @return the exported block API
70 */
71void *
72libgnunet_plugin_reclaim_escrow_plaintext_init (void *cls)
73{
74 struct GNUNET_RECLAIM_EscrowAttributesPluginFunctions *api;
75
76 api = GNUNET_new (struct GNUNET_RECLAIM_EscrowAttributesPluginFunctions);
77 api->start_attributes_escrow = &start_plaintext_attributes_escrow;
78 api->renew_attributes_escrow = &renew_plaintext_attributes_escrow;
79 return api;
80}
81
82
83/**
84 * Exit point from the plugin.
85 *
86 * @param cls the return value from #libgnunet_plugin_block_test_init()
87 * @return NULL
88 */
89void *
90libgnunet_plugin_reclaim_escrow_plaintext_done (void *cls)
91{
92 struct GNUNET_RECLAIM_EscrowAttributesPluginFunctions *api = cls;
93
94 GNUNET_free (api);
95 return NULL;
96}
97
98
99/* end of plugin_reclaim_escrow_attributes_plaintext.c */
diff --git a/src/reclaim/plugin_reclaim_escrow_key_anastasis.c b/src/reclaim/plugin_reclaim_escrow_key_anastasis.c
new file mode 100644
index 000000000..5de07761e
--- /dev/null
+++ b/src/reclaim/plugin_reclaim_escrow_key_anastasis.c
@@ -0,0 +1,100 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2013, 2014, 2016 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 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file reclaim-escrow/plugin_reclaim_escrow_key_anastasis.c
23 * @brief reclaim-escrow-plugin-key-anastasis escrow plugin for
24 * escrow of the key using Anastasis
25 *
26 * @author Johannes Späth
27 */
28#include "platform.h"
29#include "gnunet_util_lib.h"
30#include "gnunet_reclaim_plugin.h"
31#include <inttypes.h>
32
33
34/**
35 * Start the Anastasis escrow of the key
36 *
37 * @param ego the identity ego containing the private key
38 * @param escrowAnchor the anchor needed to restore the key
39 * @return GNUNET_OK if successful
40 */
41int
42start_anastasis_key_escrow (struct GNUNET_IDENTITY_Ego *ego,
43 void *escrowAnchor)
44{
45 // TODO: implement
46 return GNUNET_NO;
47}
48
49
50/**
51 * Renew the Anastasis escrow of the key
52 *
53 * @param ego the identity ego containing the private key
54 * @param escrowAnchor the anchor needed to restore the key
55 * @return GNUNET_OK if successful
56 */
57int
58renew_anastasis_key_escrow (struct GNUNET_IDENTITY_Ego *ego,
59 void *escrowAnchor)
60{
61 // TODO: implement
62 return GNUNET_NO;
63}
64
65
66/**
67 * Entry point for the plugin.
68 *
69 * @param cls NULL
70 * @return the exported block API
71 */
72void *
73libgnunet_plugin_reclaim_escrow_anastasis_init (void *cls)
74{
75 struct GNUNET_RECLAIM_EscrowKeyPluginFunctions *api;
76
77 api = GNUNET_new (struct GNUNET_RECLAIM_EscrowKeyPluginFunctions);
78 api->start_key_escrow = &start_anastasis_key_escrow;
79 api->renew_key_escrow = &renew_anastasis_key_escrow;
80 return api;
81}
82
83
84/**
85 * Exit point from the plugin.
86 *
87 * @param cls the return value from #libgnunet_plugin_block_test_init()
88 * @return NULL
89 */
90void *
91libgnunet_plugin_reclaim_escrow_anastasis_done (void *cls)
92{
93 struct GNUNET_RECLAIM_EscrowKeyPluginFunctions *api = cls;
94
95 GNUNET_free (api);
96 return NULL;
97}
98
99
100/* end of plugin_reclaim_escrow_key_anastasis.c */
diff --git a/src/reclaim/plugin_reclaim_escrow_key_gns.c b/src/reclaim/plugin_reclaim_escrow_key_gns.c
new file mode 100644
index 000000000..75784b121
--- /dev/null
+++ b/src/reclaim/plugin_reclaim_escrow_key_gns.c
@@ -0,0 +1,100 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2013, 2014, 2016 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 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file reclaim-escrow/plugin_reclaim_escrow_key_gns.c
23 * @brief reclaim-escrow-plugin-key-gns escrow plugin for
24 * the escrow of the key using GNS and escrow identities
25 *
26 * @author Johannes Späth
27 */
28#include "platform.h"
29#include "gnunet_util_lib.h"
30#include "gnunet_reclaim_plugin.h"
31#include <inttypes.h>
32
33
34/**
35 * Start the GNS escrow of the key
36 *
37 * @param ego the identity ego containing the private key
38 * @param escrowAnchor the anchor needed to restore the key
39 * @return GNUNET_OK if successful
40 */
41int
42start_gns_key_escrow (struct GNUNET_IDENTITY_Ego *ego,
43 void *escrowAnchor)
44{
45 // TODO: implement
46 return GNUNET_NO;
47}
48
49
50/**
51 * Renew the GNS escrow of the key
52 *
53 * @param ego the identity ego containing the private key
54 * @param escrowAnchor the anchor needed to restore the key
55 * @return GNUNET_OK if successful
56 */
57int
58renew_gns_key_escrow (struct GNUNET_IDENTITY_Ego *ego,
59 void *escrowAnchor)
60{
61 // TODO: implement
62 return GNUNET_NO;
63}
64
65
66/**
67 * Entry point for the plugin.
68 *
69 * @param cls NULL
70 * @return the exported block API
71 */
72void *
73libgnunet_plugin_reclaim_escrow_gns_init (void *cls)
74{
75 struct GNUNET_RECLAIM_EscrowKeyPluginFunctions *api;
76
77 api = GNUNET_new (struct GNUNET_RECLAIM_EscrowKeyPluginFunctions);
78 api->start_key_escrow = &start_gns_key_escrow;
79 api->renew_key_escrow = &renew_gns_key_escrow;
80 return api;
81}
82
83
84/**
85 * Exit point from the plugin.
86 *
87 * @param cls the return value from #libgnunet_plugin_block_test_init()
88 * @return NULL
89 */
90void *
91libgnunet_plugin_reclaim_escrow_gns_done (void *cls)
92{
93 struct GNUNET_RECLAIM_EscrowKeyPluginFunctions *api = cls;
94
95 GNUNET_free (api);
96 return NULL;
97}
98
99
100/* end of plugin_reclaim_escrow_key_gns.c */
diff --git a/src/reclaim/plugin_reclaim_escrow_key_plaintext.c b/src/reclaim/plugin_reclaim_escrow_key_plaintext.c
new file mode 100644
index 000000000..3971136d7
--- /dev/null
+++ b/src/reclaim/plugin_reclaim_escrow_key_plaintext.c
@@ -0,0 +1,107 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2013, 2014, 2016 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 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file reclaim-escrow/plugin_reclaim_escrow_key_plaintext.c
23 * @brief reclaim-escrow-plugin-key-plaintext escrow plugin for
24 * plaintext escrow of the key
25 *
26 * @author Johannes Späth
27 */
28#include "platform.h"
29#include "gnunet_util_lib.h"
30#include "gnunet_identity_service.h"
31#include "gnunet_reclaim_plugin.h"
32#include <inttypes.h>
33
34
35/**
36 * Start the plaintext escrow of the key, i.e. simply hand out the key
37 *
38 * @param ego the identity ego containing the private key
39 * @param escrowAnchor the anchor needed to restore the key
40 * @return GNUNET_OK if successful
41 */
42int
43start_plaintext_key_escrow (struct GNUNET_IDENTITY_Ego *ego,
44 void *escrowAnchor)
45{
46 struct GNUNET_CRYPTO_EcdsaPrivateKey *pk;
47
48 if (NULL == ego)
49 {
50 return GNUNET_NO;
51 }
52 pk = GNUNET_IDENTITY_ego_get_private_key (ego);
53 escrowAnchor = GNUNET_CRYPTO_ecdsa_private_key_to_string (pk);
54 return GNUNET_OK;
55}
56
57
58/**
59 * Renew the plaintext escrow of the key, i.e. simply hand out the key
60 *
61 * @param ego the identity ego containing the private key
62 * @param escrowAnchor the anchor needed to restore the key
63 * @return GNUNET_OK if successful
64 */
65int
66renew_plaintext_key_escrow (struct GNUNET_IDENTITY_Ego *ego,
67 void *escrowAnchor)
68{
69 return start_plaintext_key_escrow (ego, escrowAnchor);
70}
71
72
73/**
74 * Entry point for the plugin.
75 *
76 * @param cls NULL
77 * @return the exported block API
78 */
79void *
80libgnunet_plugin_reclaim_escrow_plaintext_init (void *cls)
81{
82 struct GNUNET_RECLAIM_EscrowKeyPluginFunctions *api;
83
84 api = GNUNET_new (struct GNUNET_RECLAIM_EscrowKeyPluginFunctions);
85 api->start_key_escrow = &start_plaintext_key_escrow;
86 api->renew_key_escrow = &renew_plaintext_key_escrow;
87 return api;
88}
89
90
91/**
92 * Exit point from the plugin.
93 *
94 * @param cls the return value from #libgnunet_plugin_block_test_init()
95 * @return NULL
96 */
97void *
98libgnunet_plugin_reclaim_escrow_plaintext_done (void *cls)
99{
100 struct GNUNET_RECLAIM_EscrowKeyPluginFunctions *api = cls;
101
102 GNUNET_free (api);
103 return NULL;
104}
105
106
107/* end of plugin_reclaim_escrow_key_plaintext.c */