使用RSA算法對數據進行加密的方法
具體方法如下:
#ifndef ENCRYPT_H
#define ENCRYPT_H
/*在一個安全實現中,Huge 最少要400位10進制數字*/
typedef unsigned long Huge;
/*為RSA公鑰定義一個數據結構*/
typedef struct RsaPubKey_
{
Huge e;
Huge n;
}RsaPubkey;
/*為RSA私鑰定義一個數據結構*/
typedef struct RsaPriKey_
{
Huge d;
Huge n;
}RsaPriKey;
/*函數聲明*/
void des_encipher(const unsigned char *plaintext, unsigned char *ciphertext, const unsigned char *key);
void des_decipher(const unsigned char *ciphertext, unsigned char *plaintext, const unsigned char *key);
void rsa_encipher(Huge plaintext, Huge *ciphertext, RsaPubKey pubkey);
void rsa_decipher(Huge ciphertext,Huge *plaintext, RsaPriKey prikey);
#endif