Cryptography Reference
In-Depth Information
// the structure with the public key components
typedef struct
{
LINT pubexp, mod;
USHORT bitlen_mod;// binary length of the modulus
USHORT bytelen_mod; // length of modulus in bytes
} PKEYSTRUCT;
class RSAkey
{
public:
inline RSAkey (void) {};
RSAkey (int);
RSAkey (int, const LINT&);
PKEYSTRUCT export_public (void) const;
UCHAR* decrypt (const LINT&, int*);
LINT sign (const UCHAR*, int);
private:
KEYSTRUCT key;
// auxiliary functions
int makekey (int, const LINT& = 1);
int testkey (void);
LINT fastdecrypt (const LINT&);
};
class RSApub
{
public:
inline RSApub (void) {};
RSApub (const RSAkey&);
LINT crypt (const UCHAR*, int);
int verify (const UCHAR*,ΕΎ int, const LINT&);
private:
PKEYSTRUCT pkey;
};
// selection from module rsakey.cpp
...
#include "rsakey.h"
////////////////////////////////////////////////////////////////////////
// member functions of the class RSAkey
// constructor generates RSA keys of specified binary length
RSAkey::RSAkey (int bitlen)
{
Search WWH ::




Custom Search