diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-09-04 17:17:48 +0200 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2020-09-12 11:24:41 +0200 |
commit | c258db7bea59bd536d71fd91c960d3bd9e1b4bb4 (patch) | |
tree | fb5baa8fa2e5277edb2e3f95bc5e92d80d7905d8 /include | |
parent | 12025e528ef50af9e3176a19465f860723e30871 (diff) |
xmlsecurity: pdf incremental updates that are non-commenting are invalid
I.e. it's OK to add incremental updates for annotation/commenting
purposes and that doesn't invalite existing signatures. Everything else
does.
(cherry picked from commit 61834cd574568613f0b0a2ee099a60fa5a8d9804)
Conflicts:
include/vcl/filter/PDFiumLibrary.hxx
vcl/source/pdf/PDFiumLibrary.cxx
Change-Id: I4607c242b3c6f6b01517b02407e9e7a095e2e069
Conflicts:
xmlsecurity/qa/unit/signing/signing.cxx
Diffstat (limited to 'include')
-rw-r--r-- | include/vcl/filter/PDFiumLibrary.hxx | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/include/vcl/filter/PDFiumLibrary.hxx b/include/vcl/filter/PDFiumLibrary.hxx index b9bceabb8acf..ffc70874c19b 100644 --- a/include/vcl/filter/PDFiumLibrary.hxx +++ b/include/vcl/filter/PDFiumLibrary.hxx @@ -17,11 +17,16 @@ #include <memory> #include <rtl/instance.hxx> #include <vcl/dllapi.h> +#include <vcl/checksum.hxx> + +#include <fpdf_doc.h> namespace vcl { namespace pdf { +class PDFiumDocument; + class VCL_DLLPUBLIC PDFium final { private: @@ -33,6 +38,49 @@ public: ~PDFium(); }; +class VCL_DLLPUBLIC PDFiumPage final +{ +private: + FPDF_PAGE mpPage; + +private: + PDFiumPage(const PDFiumPage&) = delete; + PDFiumPage& operator=(const PDFiumPage&) = delete; + +public: + PDFiumPage(FPDF_PAGE pPage) + : mpPage(pPage) + { + } + + ~PDFiumPage() + { + if (mpPage) + FPDF_ClosePage(mpPage); + } + + /// Get bitmap checksum of the page, without annotations/commenting. + BitmapChecksum getChecksum(); +}; + +class VCL_DLLPUBLIC PDFiumDocument final +{ +private: + FPDF_DOCUMENT mpPdfDocument; + +private: + PDFiumDocument(const PDFiumDocument&) = delete; + PDFiumDocument& operator=(const PDFiumDocument&) = delete; + +public: + PDFiumDocument(FPDF_DOCUMENT pPdfDocument); + ~PDFiumDocument(); + + int getPageCount(); + + std::unique_ptr<PDFiumPage> openPage(int nIndex); +}; + struct PDFiumLibrary : public rtl::StaticWithInit<std::shared_ptr<PDFium>, PDFiumLibrary> { std::shared_ptr<PDFium> operator()() { return std::make_shared<PDFium>(); } |