2018-08-12 18:07:22 +00:00
|
|
|
#ifndef PL_RC4_HH
|
|
|
|
#define PL_RC4_HH
|
2008-04-29 12:55:25 +00:00
|
|
|
|
|
|
|
#include <qpdf/Pipeline.hh>
|
|
|
|
|
|
|
|
#include <qpdf/RC4.hh>
|
|
|
|
|
2009-10-21 00:27:24 +00:00
|
|
|
class Pl_RC4: public Pipeline
|
2008-04-29 12:55:25 +00:00
|
|
|
{
|
|
|
|
public:
|
2019-06-21 03:35:23 +00:00
|
|
|
static size_t const def_bufsize = 65536;
|
2008-04-29 12:55:25 +00:00
|
|
|
|
|
|
|
// key_len of -1 means treat key_data as a null-terminated string
|
|
|
|
Pl_RC4(
|
|
|
|
char const* identifier,
|
|
|
|
Pipeline* next,
|
2022-02-08 14:18:08 +00:00
|
|
|
unsigned char const* key_data,
|
|
|
|
int key_len = -1,
|
|
|
|
size_t out_bufsize = def_bufsize);
|
2023-05-20 13:25:46 +00:00
|
|
|
~Pl_RC4() override = default;
|
2008-04-29 12:55:25 +00:00
|
|
|
|
2023-05-20 13:25:46 +00:00
|
|
|
void write(unsigned char const* data, size_t len) override;
|
|
|
|
void finish() override;
|
2008-04-29 12:55:25 +00:00
|
|
|
|
|
|
|
private:
|
2022-04-09 18:35:56 +00:00
|
|
|
std::shared_ptr<unsigned char> outbuf;
|
2012-06-20 15:20:57 +00:00
|
|
|
size_t out_bufsize;
|
2008-04-29 12:55:25 +00:00
|
|
|
RC4 rc4;
|
|
|
|
};
|
|
|
|
|
2018-08-12 18:07:22 +00:00
|
|
|
#endif // PL_RC4_HH
|