#include <tchar.h>
#include <iostream>
#include <ctime>
#include <cstdlib>

#include "PKG.h"
#include "User.h"

using namespace std;

int _tmain(int argc, _TCHAR* argv[]) {

	User alice("Alice");
	User beto("Beto", "beto@iq.usp.br");
	PKG *pkg = PKG::getInstance();
	uint32 publicId;

	srand((unsigned)time(NULL));

	pkg->setP(1019);
	pkg->setQ(991);

	cout << "Generating keys...";
	alice.createKey();
	beto.createKey();
	cout << " done." << endl << endl;
		
	publicId = Util::hash(beto.getEmail(), pkg->getM());
	
	cout << beto.decrypt(alice.encrypt("Mac499 - Trabalho de Formatura supervisionado", publicId, beto.isRootOfA(), alice.getKey()));
	
	return 0;
}