#include <crypto/kem.h>

#define STR_AUX(a) #a
#define STR(a) STR_AUX(a)

NTL_CLIENT

int main()
{
	ostring txt;
	ostring x, y;
	int n;

#if !defined(Kdf)
#error "Error - Kdf not defined."
#endif

#if !defined(Hash)
#error "Error - Hash not defined."
#endif

#if (Hash == 1)
        SHA1 hash(20);
        Kdf kdf(hash);
#elif (Hash == 2)
        SHA256 hash(20);
        Kdf kdf(hash);
#elif (Hash == 3)
        MD5 hash(16);
        Kdf kdf(hash);
#else
#error "Error - Hash value not defined."
#endif

	//ifstream ofile("out.txt");
	//if (!ofile) cout << " cannot open output file " << endl;
	//RSAKEM rsakem(kdf, 512, ofile);

	RSAKEM rsakem(kdf, 128);

	ofstream io(STR(DESC));
        ofstream trace(STR(TRACE));

	rsakem.PrettyPrint(io);
	rsakem.logfile = &trace;

	//rsakem.writetofile(ofile);

	x = rsakem.encrypt(txt);

	y = rsakem.decrypt(txt, n);

	if (x != y)
		cout << " Rsa-kem failed " << endl;
	else
		cout << " Rsa-kem success " << endl;	
}

