aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/qpdf/AES_PDF_native.hh
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2019-11-04 19:59:19 +0100
committerJay Berkenbilt <ejb@ql.org>2019-11-09 14:18:02 +0100
commitc8cda4f965064a9c4621d8d9f889eb7037fe72bb (patch)
tree333110d755d88709c4b196f834c6f0fa1e7b68ba /libqpdf/qpdf/AES_PDF_native.hh
parentbb427bd11774f47f553257cdc0693f77b559654d (diff)
downloadqpdf-c8cda4f965064a9c4621d8d9f889eb7037fe72bb.tar.zst
AES_PDF: switch to pluggable crypto
Diffstat (limited to 'libqpdf/qpdf/AES_PDF_native.hh')
-rw-r--r--libqpdf/qpdf/AES_PDF_native.hh25
1 files changed, 25 insertions, 0 deletions
diff --git a/libqpdf/qpdf/AES_PDF_native.hh b/libqpdf/qpdf/AES_PDF_native.hh
new file mode 100644
index 00000000..f663533b
--- /dev/null
+++ b/libqpdf/qpdf/AES_PDF_native.hh
@@ -0,0 +1,25 @@
+#ifndef AES_PDF_NATIVE_HH
+#define AES_PDF_NATIVE_HH
+
+#include <cstdint>
+#include <cstring>
+#include <memory>
+
+class AES_PDF_native
+{
+ public:
+ // key should be a pointer to key_bytes bytes of data
+ AES_PDF_native(bool encrypt, unsigned char const* key,
+ size_t key_bytes);
+ ~AES_PDF_native();
+
+ void update(unsigned char* in_data, unsigned char* out_data);
+
+ private:
+ bool encrypt;
+ std::unique_ptr<unsigned char[]> key;
+ std::unique_ptr<uint32_t[]> rk;
+ unsigned int nrounds;
+};
+
+#endif // AES_PDF_NATIVE_HH