/src/qpdf/libqpdf/qpdf/QPDFCrypto_native.hh
Line | Count | Source |
1 | | #ifndef QPDFCRYPTO_NATIVE_HH |
2 | | #define QPDFCRYPTO_NATIVE_HH |
3 | | |
4 | | #include <qpdf/AES_PDF_native.hh> |
5 | | #include <qpdf/MD5_native.hh> |
6 | | #include <qpdf/QPDFCryptoImpl.hh> |
7 | | #include <qpdf/RC4_native.hh> |
8 | | #include <qpdf/SHA2_native.hh> |
9 | | |
10 | | #include <memory> |
11 | | |
12 | | class QPDFCrypto_native final: public QPDFCryptoImpl |
13 | | { |
14 | | public: |
15 | 18.1M | QPDFCrypto_native() = default; |
16 | | |
17 | 18.1M | ~QPDFCrypto_native() final = default; |
18 | | |
19 | | void provideRandomData(unsigned char* data, size_t len) final; |
20 | | |
21 | | void MD5_init() final; |
22 | | void MD5_update(unsigned char const* data, size_t len) final; |
23 | | void MD5_finalize() final; |
24 | | void MD5_digest(MD5_Digest) final; |
25 | | |
26 | | void RC4_init(unsigned char const* key_data, int key_len = -1) final; |
27 | | void |
28 | | RC4_process(unsigned char const* in_data, size_t len, unsigned char* out_data = nullptr) final; |
29 | | void RC4_finalize() final; |
30 | | |
31 | | void SHA2_init(int bits) final; |
32 | | void SHA2_update(unsigned char const* data, size_t len) final; |
33 | | void SHA2_finalize() final; |
34 | | std::string SHA2_digest() final; |
35 | | |
36 | | void rijndael_init( |
37 | | bool encrypt, |
38 | | unsigned char const* key_data, |
39 | | size_t key_len, |
40 | | bool cbc_mode, |
41 | | unsigned char* cbc_block) final; |
42 | | void rijndael_process(unsigned char* in_data, unsigned char* out_data) final; |
43 | | void rijndael_finalize() final; |
44 | | |
45 | | private: |
46 | | std::shared_ptr<MD5_native> md5; |
47 | | std::shared_ptr<RC4_native> rc4; |
48 | | std::shared_ptr<SHA2_native> sha2; |
49 | | std::shared_ptr<AES_PDF_native> aes_pdf; |
50 | | }; |
51 | | |
52 | | #endif // QPDFCRYPTO_NATIVE_HH |