#ifndef CRYPTPHELPER_H_ #define CRYPTPHELPER_H_ #include #include namespace license { using namespace std; /** * Helper class definition to generate and export Public/Private keys * for Asymmetric encryption. * *

Since this part relies heavily on operating system libraries this class * provides a common facade to the cryptographic functions. The two implementing * subclasses are chosen in the factory method #getInstance(). This is to avoid * to clutter the code with many "ifdef". (extreme performance is not an issue here)

*

*it is shared by bootstrap and license-generator projects.

*/ class CryptoHelper { protected: CryptoHelper(); public: virtual void generateKeyPair() = 0; virtual const string exportPrivateKey() const = 0; virtual const string exportPublicKey() const = 0; virtual const string signString(const unsigned char* privateKey, size_t pklen, const string& license) const = 0; static unique_ptr getInstance(); virtual ~CryptoHelper(); }; } #endif