aboutsummaryrefslogtreecommitdiff
path: root/src/escrow/plugin_escrow_plaintext.c
diff options
context:
space:
mode:
authorjospaeth <spaethj@in.tum.de>2020-07-05 13:06:14 +0200
committerjospaeth <spaethj@in.tum.de>2020-07-09 14:56:09 +0200
commiteeb3610df1d4f102e60abf20d22a3febc0f9b273 (patch)
tree566a1cc8d4d14e43c6001265185f6118f0af5bfd /src/escrow/plugin_escrow_plaintext.c
parentc9ea27bc037eeae5ee39b05cd11b06e48399fb43 (diff)
downloadgnunet-eeb3610df1d4f102e60abf20d22a3febc0f9b273.tar.gz
gnunet-eeb3610df1d4f102e60abf20d22a3febc0f9b273.zip
create escrow component
Diffstat (limited to 'src/escrow/plugin_escrow_plaintext.c')
-rw-r--r--src/escrow/plugin_escrow_plaintext.c105
1 files changed, 105 insertions, 0 deletions
diff --git a/src/escrow/plugin_escrow_plaintext.c b/src/escrow/plugin_escrow_plaintext.c
new file mode 100644
index 000000000..f8ac8234c
--- /dev/null
+++ b/src/escrow/plugin_escrow_plaintext.c
@@ -0,0 +1,105 @@
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 escrow/plugin_escrow_plaintext.c
23 * @brief escrow-plugin-plaintext escrow plugin for plaintext escrow of the key
24 *
25 * @author Johannes Späth
26 */
27#include "platform.h"
28#include "gnunet_util_lib.h"
29#include "gnunet_escrow_plugin.h"
30#include <inttypes.h>
31
32
33/**
34 * Start the plaintext escrow of the key, i.e. simply hand out the key
35 *
36 * @param ego the identity ego containing the private key
37 * @param escrowAnchor the anchor needed to restore the key
38 * @return GNUNET_OK if successful
39 */
40int
41start_plaintext_key_escrow (const struct GNUNET_IDENTITY_Ego *ego,
42 void *escrowAnchor)
43{
44 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk;
45
46 if (NULL == ego)
47 {
48 return GNUNET_NO;
49 }
50 pk = GNUNET_IDENTITY_ego_get_private_key (ego);
51 escrowAnchor = GNUNET_CRYPTO_ecdsa_private_key_to_string (pk);
52 return GNUNET_OK;
53}
54
55
56/**
57 * Renew the plaintext escrow of the key, i.e. simply hand out the key
58 *
59 * @param ego the identity ego containing the private key
60 * @param escrowAnchor the anchor needed to restore the key
61 * @return GNUNET_OK if successful
62 */
63int
64renew_plaintext_key_escrow (const struct GNUNET_IDENTITY_Ego *ego,
65 void *escrowAnchor)
66{
67 return start_plaintext_key_escrow (ego, escrowAnchor);
68}
69
70
71/**
72 * Entry point for the plugin.
73 *
74 * @param cls NULL
75 * @return the exported block API
76 */
77void *
78libgnunet_plugin_escrow_plaintext_init (void *cls)
79{
80 struct GNUNET_ESCROW_KeyPluginFunctions *api;
81
82 api = GNUNET_new (struct GNUNET_ESCROW_KeyPluginFunctions);
83 api->start_key_escrow = &start_plaintext_key_escrow;
84 api->renew_key_escrow = &renew_plaintext_key_escrow;
85 return api;
86}
87
88
89/**
90 * Exit point from the plugin.
91 *
92 * @param cls the return value from #libgnunet_plugin_block_test_init()
93 * @return NULL
94 */
95void *
96libgnunet_plugin_escrow_plaintext_done (void *cls)
97{
98 struct GNUNET_RECLAIM_EscrowKeyPluginFunctions *api = cls;
99
100 GNUNET_free (api);
101 return NULL;
102}
103
104
105/* end of plugin_escrow_plaintext.c */