2019-11-04 14:04:25 +00:00
|
|
|
#ifndef RC4_HH
|
|
|
|
#define RC4_HH
|
|
|
|
|
|
|
|
#include <qpdf/QPDFCryptoImpl.hh>
|
|
|
|
#include <cstring>
|
2022-04-02 21:14:10 +00:00
|
|
|
#include <memory>
|
2019-11-04 14:04:25 +00:00
|
|
|
|
|
|
|
class RC4
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// key_len of -1 means treat key_data as a null-terminated string
|
|
|
|
RC4(unsigned char const* key_data, int key_len = -1);
|
|
|
|
|
2022-05-03 21:43:07 +00:00
|
|
|
// It is safe to pass the same pointer to in_data and out_data to
|
|
|
|
// encrypt/decrypt in place
|
2022-04-02 21:14:10 +00:00
|
|
|
void
|
2022-05-03 21:43:07 +00:00
|
|
|
process(unsigned char const* in_data, size_t len, unsigned char* out_data);
|
2019-11-04 14:04:25 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::shared_ptr<QPDFCryptoImpl> crypto;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // RC4_HH
|