?? rsacryptosystem.h
字號:
#pragma once
#pragma comment (lib, "D:/+info+/Libraries/NTL/Debug/NTL.lib")
#include "NTL/ZZ.h"
#include <string>
#include <fstream>
class RSACryptoSystem
{
public:
typedef struct _publicKey
{
NTL::ZZ N; //N = p*q
NTL::ZZ E; // e*d congr 1 mod Phi(n) = (p-1)*(q-1); e is ususly small but wrt d
} PublicKey;
typedef struct _privateKey
{
NTL::ZZ P; //P = prime - >512 bits
NTL::ZZ Q; //Q = prime - >512 bits
NTL::ZZ D; // d > (1/3)*n^(1/4); d from Z*_Phi(N) = (p - 1)*(q - 1)
} PrivateKey;
private:
PublicKey m_publicKey;
PrivateKey m_privateKey;
private:
long m_lBitsNr; // > 512
private:
void GenerateKeys();
void LoadKeys(std::string publicKeyFile,std::string privateKeyFile);
public:
RSACryptoSystem(std::string privateKeyFile = "", std::string publicKeyFile = "",long bitsNr = 0);
~RSACryptoSystem(void);
public:
PublicKey GetPublicKey() const;
public:
// Encode number x with public key (n,e);
// The result will be put in y;
void Encode(const NTL::ZZ& x, NTL::ZZ& y, const PublicKey& key);
// Decode y with my private key (m_zzP, m_zzQ, m_zzD)
// The result will be put in x
void Decode(const NTL::ZZ&y, NTL::ZZ& x);
};
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -