From 97e403bb665ccf736a840c28c717fa7b3dc8de30 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 15 Apr 2015 18:12:21 +0200 Subject: moving core refresh crypto logic to util -- towards fixing #3777 --- src/include/taler_crypto_lib.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src/include/taler_crypto_lib.h') diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h index c3cbdcbab..dedeef5b0 100644 --- a/src/include/taler_crypto_lib.h +++ b/src/include/taler_crypto_lib.h @@ -423,6 +423,43 @@ struct TALER_RefreshLinkEncrypted }; +/** + * Decrypt the shared @a secret from the information in the + * encrypted link secret @e secret_enc using the transfer + * private key and the coin's public key. + * + * @param secret_enc encrypted link secret + * @param transfer_priv transfer private key + * @param coin_pub coin public key + * @param[out] secret set to the shared secret + * @return #GNUNET_OK on success, #GNUNET_SYSERR on error + */ +int +TALER_link_decrypt_secret (const struct TALER_EncryptedLinkSecretP *secret_enc, + const struct TALER_TransferPrivateKeyP *trans_priv, + const union TALER_CoinSpendPublicKeyP *coin_pub, + struct TALER_LinkSecretP *secret); + + +/** + * Encrypt the shared @a secret to generate the encrypted link secret. + * Also creates the transfer key. + * + * @param secret link secret to encrypt + * @param coin_pub coin public key + * @param transfer_priv[out] set to transfer private key + * @param transfer_pub[out] set to transfer public key + * @param[out] secret_enc set to the encryptd @a secret + * @return #GNUNET_OK on success, #GNUNET_SYSERR on error + */ +int +TALER_link_encrypt_secret (const struct TALER_LinkSecretP *secret, + const union TALER_CoinSpendPublicKeyP *coin_pub, + struct TALER_TransferPrivateKeyP *trans_priv, + struct TALER_TransferPublicKeyP *trans_pub, + struct TALER_EncryptedLinkSecretP *secret_enc); + + /** * Use the @a trans_sec (from ECDHE) to decrypt the @a secret_enc * to obtain the @a secret to decrypt the linkage data. -- cgit v1.2.3