gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-anastasis] branch master updated: ERD decryption


From: gnunet
Subject: [taler-anastasis] branch master updated: ERD decryption
Date: Tue, 24 Mar 2020 12:51:55 +0100

This is an automated email from the git hooks/post-receive script.

dennis-neufeld pushed a commit to branch master
in repository anastasis.

The following commit(s) were added to refs/heads/master by this push:
     new 60865a8  ERD decryption
60865a8 is described below

commit 60865a8842f6d21c916741923cdf71f52ca460bf
Author: Dennis Neufeld <address@hidden>
AuthorDate: Tue Mar 24 11:51:49 2020 +0000

    ERD decryption
---
 src/util/anastasis_crypto.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/src/util/anastasis_crypto.c b/src/util/anastasis_crypto.c
index fb7ed20..5ab0e1b 100644
--- a/src/util/anastasis_crypto.c
+++ b/src/util/anastasis_crypto.c
@@ -213,7 +213,34 @@ ANASTASIS_CRYPTO_recovery_document_decrypt (
   void **res,
   size_t *res_size)
 {
+  struct ANASTASIS_CRYPTO_Nonce nonce;
+  gcry_cipher_hd_t cipher;
+  char ciphertext[data_size];
+  char sym_key[AES_KEY_SIZE];
+  char iv[AES_IV_SIZE];
+  char gcm_tag[GCM_TAG_SIZE];
+
+  memcpy (&nonce, data + 0, sizeof (struct ANASTASIS_CRYPTO_Nonce));
+  memcpy (&gcm_tag, data + sizeof (struct ANASTASIS_CRYPTO_Nonce),
+          GCM_TAG_SIZE);
+  memcpy (&ciphertext,
+          data + sizeof (struct ANASTASIS_CRYPTO_Nonce) + GCM_TAG_SIZE,
+          data_size - sizeof (struct ANASTASIS_CRYPTO_Nonce) - GCM_TAG_SIZE);
 
+  get_iv_key (id, &nonce, "erd", sym_key, iv);
+
+  gcry_cipher_open (&cipher,
+                    GCRY_CIPHER_AES256,
+                    GCRY_CIPHER_MODE_GCM,
+                    0);
+  gcry_cipher_setkey (cipher,
+                      sym_key,
+                      sizeof (sym_key));
+  gcry_cipher_setiv (cipher,
+                     &iv,
+                     sizeof (iv));
+  gcry_cipher_decrypt (cipher, res, *res_size, ciphertext, sizeof 
(ciphertext));
+  gcry_cipher_close (cipher);
 }
 
 /**

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]