summaryrefslogtreecommitdiffstats
path: root/libqpdf/qpdf/Pl_RC4.hh
blob: 01b651a5c2ad58e20f519bd89ae6a204bd71209f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

#ifndef __PL_RC4_HH__
#define __PL_RC4_HH__

#include <qpdf/Pipeline.hh>

#include <qpdf/RC4.hh>

class Pl_RC4: public Pipeline
{
  public:
    class Exception: public Pipeline::Exception
    {
      public:
	DLL_EXPORT
	Exception(std::string const& message) :
	    Pipeline::Exception(message)
	{
	}

	DLL_EXPORT
	virtual ~Exception() throw()
	{
	}
    };

    static int const def_bufsize = 65536;

    // key_len of -1 means treat key_data as a null-terminated string
    DLL_EXPORT
    Pl_RC4(char const* identifier, Pipeline* next,
	   unsigned char const* key_data, int key_len = -1,
	   int out_bufsize = def_bufsize);
    DLL_EXPORT
    virtual ~Pl_RC4();

    DLL_EXPORT
    virtual void write(unsigned char* data, int len);
    DLL_EXPORT
    virtual void finish();

  private:
    unsigned char* outbuf;
    int out_bufsize;
    RC4 rc4;
};

#endif // __PL_RC4_HH__