summaryrefslogtreecommitdiffstats
path: root/libqpdf/qpdf/RC4_native.hh
diff options
context:
space:
mode:
Diffstat (limited to 'libqpdf/qpdf/RC4_native.hh')
-rw-r--r--libqpdf/qpdf/RC4_native.hh28
1 files changed, 28 insertions, 0 deletions
diff --git a/libqpdf/qpdf/RC4_native.hh b/libqpdf/qpdf/RC4_native.hh
new file mode 100644
index 00000000..a2aa5dce
--- /dev/null
+++ b/libqpdf/qpdf/RC4_native.hh
@@ -0,0 +1,28 @@
+#ifndef RC4_HH
+#define RC4_HH
+
+#include <stddef.h>
+
+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);
+
+ // out_data = 0 means to encrypt/decrypt in place
+ void process(unsigned char* in_data, size_t len,
+ unsigned char* out_data = 0);
+
+ private:
+ class RC4Key
+ {
+ public:
+ unsigned char state[256];
+ unsigned char x;
+ unsigned char y;
+ };
+
+ RC4Key key;
+};
+
+#endif // RC4_HH