?? rsakey.h
字號(hào):
#ifndef __RSAKEYH__
#define __RSAKEYH__ // rsakey.h is #included
#include "flintpp.h"
#include "ripemd.h"
#define BLOCKTYPE_SIGN 01
#define BLOCKTYPE_ENCR 02
typedef struct
{
public:
LINT pubexp, prvexp, mod, p, q, ep, eq, r;
USHORT bitlen_mod; // Binary length of modulus
USHORT bytelen_mod; // Length of modulus in bytes
} KEYSTRUCT;
typedef struct
{
public:
LINT pubexp, mod;
USHORT bitlen_mod; // Binary length of modulus
USHORT bytelen_mod; // Length of modulus in bytes
}PKEYSTRUCT;
class RSAkey
{
public:
inline RSAkey (void) {};
RSAkey (const int);
RSAkey (const int, const LINT&, const LINT& = 1);
RSAKey ( const KEYSTRUCT&);
PKEYSTRUCT export_public (void) const;
UCHAR* decrypt (const LINT&, int*);
LINT sign (const UCHAR* const, const int);
void purge (void);
RSAkey& operator= (const RSAkey&);
KEYSTRUCT keyvalue() {return key;};
void copycreate(const KEYSTRUCT&);
friend int operator== (const RSAkey&, const RSAkey&);
friend int operator!= (const RSAkey&, const RSAkey&);
friend fstream& operator<< (fstream&, const RSAkey&);
friend fstream& operator>> (fstream&, RSAkey&);
// Auxiliary functions
int makekey (const int, const LINT& = 1);
int testkey (void);
LINT fastdecrypt (const LINT&);
// private:
KEYSTRUCT key;
};
class RSApub
{
public:
inline RSApub (void) {};
RSApub (const RSAkey&);
RSApub (const PKEYSTRUCT&);
LINT crypt (const UCHAR* const , const int);
UCHAR* verify ( int*, const LINT&);
void purge (void);
RSApub& operator= (const RSApub&);
friend int operator== (const RSApub&, const RSApub&);
friend int operator!= (const RSApub&, const RSApub&);
friend fstream& operator<< (fstream&, const RSApub&);
friend fstream& operator>> (fstream&, RSApub&);
PKEYSTRUCT keyvalue() {return pkey;};
private:
PKEYSTRUCT pkey;
};
///////////////////////////////////////////////////////////////////////////////
// Auxiliary functions external to RSA-classes
// Function for PKCS#1 formatting of encryption blocks
UCHAR* format_pkcs1 (const UCHAR*, const int, const UCHAR, const UCHAR*, const int);
// Parser for decrypted Encryption Block, PKCS#1-formatted
UCHAR* parse_pkcs1 (const UCHAR*, int*);
#endif // __RSAKEYH__
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -