You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
461 B
25 lines
461 B
#ifndef RSA_H
|
|
#define RSA_H
|
|
|
|
#include <global.h>
|
|
#include <gmp.h>
|
|
|
|
class Rsa
|
|
{
|
|
public:
|
|
Rsa();
|
|
~Rsa();
|
|
void setKey(const char* p, const char* q, const char* d);
|
|
bool setKey(const std::string& file);
|
|
bool decrypt(char* msg, int32_t size);
|
|
static bool encrypt(char* msg, int32_t size, const char* key);
|
|
|
|
protected:
|
|
bool m_keySet;
|
|
|
|
mpz_t m_p, m_q, m_u, m_d, m_dp, m_dq, m_mod;
|
|
};
|
|
|
|
typedef std::shared_ptr<Rsa> RsaPtr;
|
|
|
|
#endif //RSA_H
|