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