[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] 01/03: worked on eddsa priv/pub key derivation
From: |
gnunet |
Subject: |
[taler-anastasis] 01/03: worked on eddsa priv/pub key derivation |
Date: |
Mon, 30 Mar 2020 08:48:58 +0200 |
This is an automated email from the git hooks/post-receive script.
dennis-neufeld pushed a commit to branch master
in repository anastasis.
commit fc8f7362a2d7c75a8851b7bde6322cf83860e7ca
Author: Dennis Neufeld <address@hidden>
AuthorDate: Mon Mar 30 06:11:14 2020 +0000
worked on eddsa priv/pub key derivation
---
src/include/anastasis_crypto_lib.h | 4 ++--
src/util/anastasis_crypto.c | 37 +++++++++++++++++++++++++++++++++----
2 files changed, 35 insertions(+), 6 deletions(-)
diff --git a/src/include/anastasis_crypto_lib.h
b/src/include/anastasis_crypto_lib.h
index 18bde96..9baf96f 100644
--- a/src/include/anastasis_crypto_lib.h
+++ b/src/include/anastasis_crypto_lib.h
@@ -133,8 +133,8 @@ ANASTASIS_CRYPTO_user_identifier_derive (
*/
void
ANASTASIS_CRYPTO_account_public_key_derive (
- struct ANASTASIS_CRYPTO_AccountPublicKey *pub_key,
- const struct ANASTASIS_CRYPTO_UserIdentifier *id);
+ const struct ANASTASIS_CRYPTO_UserIdentifier *id,
+ struct ANASTASIS_CRYPTO_AccountPublicKey *pub_key);
/**
* Encrypt and signs the recovery document with AES256, the recovery document
is
diff --git a/src/util/anastasis_crypto.c b/src/util/anastasis_crypto.c
index 59a3861..7ea4a7d 100644
--- a/src/util/anastasis_crypto.c
+++ b/src/util/anastasis_crypto.c
@@ -226,6 +226,31 @@ ANASTASIS_CRYPTO_user_identifier_derive (
}
+/**
+ * Generates the eddsa private key used to authorize operations on policy
+ * @param id holds a hashed user secret which is used as entropy source for
the public key generation
+ * @param priv_key handle for the generated private key
+ */
+static void
+ANASTASIS_CRYPTO_account_private_key_derive (
+ const struct ANASTASIS_CRYPTO_UserIdentifier *id,
+ struct GNUNET_CRYPTO_EddsaPrivateKey *priv_key)
+{
+ void *ver_secret;
+ GNUNET_CRYPTO_hkdf (&ver_secret,
+ sizeof (ver_secret),
+ GCRY_MD_SHA512,
+ GCRY_MD_SHA256,
+ id,
+ sizeof (struct ANASTASIS_CRYPTO_UserIdentifier),
+ "ver",
+ strlen ("ver"),
+ NULL,
+ 0);
+ // *priv_key = eddsa_d_to_a (id);
+}
+
+
/**
* Generates the eddsa public Key used as the account identifier on the
providers
* @param id holds a hashed user secret which is used as entropy source for
the public key generation
@@ -233,10 +258,12 @@ ANASTASIS_CRYPTO_user_identifier_derive (
*/
void
ANASTASIS_CRYPTO_account_public_key_derive (
- struct ANASTASIS_CRYPTO_AccountPublicKey *pub_key,
- const struct ANASTASIS_CRYPTO_UserIdentifier *id)
+ const struct ANASTASIS_CRYPTO_UserIdentifier *id,
+ struct ANASTASIS_CRYPTO_AccountPublicKey *pub_key)
{
-
+ struct GNUNET_CRYPTO_EddsaPrivateKey *priv;
+ ANASTASIS_CRYPTO_account_private_key_derive (id, priv);
+ GNUNET_CRYPTO_eddsa_key_get_public (priv, &pub_key->pub);
}
@@ -415,7 +442,9 @@ void
ANASTASIS_CRYPTO_key_share_create (
struct ANASTASIS_CRYPTO_KeyShare *key_share)
{
-
+ GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_STRONG,
+ key_share,
+ sizeof (struct ANASTASIS_CRYPTO_KeyShare));
}
--
To stop receiving notification emails like this one, please contact
address@hidden.