#ifndef CRYPTCLASSEVP_H #define CRYPTCLASSEVP_H #include "cryptclassbase.h" #include #include #include /** * @author Walter Roth, 2015 * @brief The CryptClassEvp is a class for symmetric cryptography using OpenSSL's EVP API. * Subclasses must overwrite the algorithm function to specify the algorithm to be used. * The implementation of algorithm in this class returns a NULL-Cipher object (no encryption). * This is quite useful for debugging. * */ class CryptClassEvp : public CryptClassBase { public: CryptClassEvp(); virtual ~CryptClassEvp(); /** * @brief setAlgorithm Overwrite this function to specify the algorithm to be used. * @param cipher The cipher object e.g. EVP_bf_cbc() for Blowfish in CBC mode. */ virtual const EVP_CIPHER *algorithm() = 0; /** * @brief encrypt Setup context and key and encrypt m_clearText into m_cryptText. */ void encrypt(); /** * @brief encrypt Setup context and key and decrypt m_cryptText into m_clearText. */ void decrypt(); /** * @brief handleOpenSslError Calls ERR_get_error and sends debug output to stderr. * @param file The __FILE__ makro * @param line The __LINE__ makro * @return */ void handleOpenSslError(); }; #endif // CRYPTCLASSEVP_H