#ifndef INCLUDED_BOBCAT_ENCRYPTBUF_
#define INCLUDED_BOBCAT_ENCRYPTBUF_

#include <openssl/evp.h>

#include <iosfwd>
#include <bobcat/exception>
#include <bobcat/eoibuf>

// class EVP_CIPHER_CTX;

namespace FBB
{

class EncryptBuf: public EoiBuf
{
    public:
        EncryptBuf(std::ostream &outStream, char const *type,
                   std::string key, std::string const &iv,
                   size_t bufSize = 1024);
        ~EncryptBuf() override;

        size_t keyLength() const;
        size_t blockLength() const;
        size_t ivLength() const;

        bool setRounds(size_t nRounds);
        size_t rounds() const;

        std::string const &iv() const;

        void eoi();                                 // .f

    protected:
        EVP_CIPHER_CTX *cipherCtx();
};

#include "iv.f"
#include "eoi.f"

}   // FBB


#endif
