summaryrefslogtreecommitdiff
path: root/src/util/crypto.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-01-29 17:34:37 +0100
committerChristian Grothoff <christian@grothoff.org>2015-01-29 17:34:37 +0100
commit41e1dd9738a58ffce765d5f837c32962907707df (patch)
treeb5504190c535578a53ef3b1f6768a74150e3dc33 /src/util/crypto.c
parent1e3e6fa5990eb2504a69279039ee776a19ff1ec2 (diff)
downloadexchange-41e1dd9738a58ffce765d5f837c32962907707df.tar.gz
exchange-41e1dd9738a58ffce765d5f837c32962907707df.tar.bz2
exchange-41e1dd9738a58ffce765d5f837c32962907707df.zip
finish cleanup of /refresh/commit parsing
Diffstat (limited to 'src/util/crypto.c')
-rw-r--r--src/util/crypto.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/util/crypto.c b/src/util/crypto.c
index 12f452085..25f951e86 100644
--- a/src/util/crypto.c
+++ b/src/util/crypto.c
@@ -269,6 +269,32 @@ TALER_refresh_encrypt (const struct TALER_RefreshLinkDecrypted *input,
/**
+ * Decode encrypted refresh link information from buffer.
+ *
+ * @param buf buffer with refresh link data
+ * @param buf_len number of bytes in @a buf
+ * @return NULL on error (@a buf_len too small)
+ */
+struct TALER_RefreshLinkEncrypted *
+TALER_refresh_link_encrypted_decode (const char *buf,
+ size_t buf_len)
+{
+ struct TALER_RefreshLinkEncrypted *rle;
+
+ if (buf_len < sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))
+ return NULL;
+ rle = GNUNET_malloc (sizeof (struct TALER_RefreshLinkEncrypted) +
+ buf_len - sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey));
+ rle->blinding_key_enc = (const char *) &rle[1];
+ rle->blinding_key_enc_size = buf_len - sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey);
+ memcpy (rle->coin_priv_enc,
+ buf,
+ buf_len);
+ return rle;
+}
+
+
+/**
* Check if a coin is valid; that is, whether the denomination key exists,
* is not expired, and the signature is correct.
*