From bb427bd11774f47f553257cdc0693f77b559654d Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Mon, 4 Nov 2019 09:55:43 -0500 Subject: SHA2: switch to pluggable crypto --- include/qpdf/QPDFCryptoImpl.hh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/qpdf/QPDFCryptoImpl.hh b/include/qpdf/QPDFCryptoImpl.hh index b19f0112..09803a79 100644 --- a/include/qpdf/QPDFCryptoImpl.hh +++ b/include/qpdf/QPDFCryptoImpl.hh @@ -23,7 +23,7 @@ #define QPDFCRYPTOIMPL_HH #include -#include +#include // This class is part of qpdf's pluggable crypto provider support. // Most users won't need to know or care about this class, but you can @@ -41,6 +41,8 @@ class QPDF_DLL_CLASS QPDFCryptoImpl QPDF_DLL virtual ~QPDFCryptoImpl() = default; + // Hashing + typedef unsigned char MD5_Digest[16]; QPDF_DLL virtual void MD5_init() = 0; @@ -51,6 +53,17 @@ class QPDF_DLL_CLASS QPDFCryptoImpl QPDF_DLL virtual void MD5_digest(MD5_Digest) = 0; + QPDF_DLL + virtual void SHA2_init(int bits) = 0; + QPDF_DLL + virtual void SHA2_update(unsigned char const* data, size_t len) = 0; + QPDF_DLL + virtual void SHA2_finalize() = 0; + QPDF_DLL + virtual std::string SHA2_digest() = 0; + + // Encryption/Decryption + // key_len of -1 means treat key_data as a null-terminated string QPDF_DLL virtual void RC4_init(unsigned char const* key_data, int key_len = -1) = 0; -- cgit v1.2.3-70-g09d2