From 9cf062565a9a4802c45f790a5c11cff882367fdc Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Sat, 13 Apr 2024 13:40:26 +0200 Subject: [PATCH] created why2_chat_rsa_pri_decrypt --- include/chat/crypto.h | 1 + src/chat/crypto.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/include/chat/crypto.h b/include/chat/crypto.h index bd6f9db..0fefa7b 100644 --- a/include/chat/crypto.h +++ b/include/chat/crypto.h @@ -42,6 +42,7 @@ char *why2_get_chat_modulus(void); //GET THE RSA MODULUS char *why2_get_chat_d(void); //GET THE RSA d char *why2_chat_rsa_pub_encrypt(long to_encrypt); //RSA ENCRYPT USING PUBLIC KEY +char *why2_chat_rsa_pri_decrypt(long to_decrypt); //RSA DECRYPT USING PRIVATE KEY #ifdef __cplusplus } diff --git a/src/chat/crypto.c b/src/chat/crypto.c index 34e8e5c..947a4e3 100644 --- a/src/chat/crypto.c +++ b/src/chat/crypto.c @@ -197,4 +197,9 @@ char *why2_get_chat_d(void) char *why2_chat_rsa_pub_encrypt(long to_encrypt) { return exp_mod(to_encrypt, WHY2_CHAT_RSA_EXPONENT); +} + +char *why2_chat_rsa_pri_decrypt(long to_decrypt) +{ + return exp_mod(to_decrypt, why2_get_chat_d()); } \ No newline at end of file