diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-10-21 16:00:58 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-10-21 16:19:49 +0000 |
commit | 5819448023377b81ac785dc31ccf8333562ee51f (patch) | |
tree | 84b9b5af386e13cb9c092a45f0e5f550aa4c84c2 /xmlsecurity/inc | |
parent | 98d9bb5eb266ff4f897adbe4d0c0a49ff9b4c7bb (diff) |
xmlsecurity: implement removal of a signature in pdfverify
It's not exactly clear how one should guess what was file end before
signing, for now assume the followings:
- the file ended with a %%EOF, an optional \r, and a \n
- the number of incremental updates is the same as the number of
signatures
When the later is not the case, don't attempt to remove the signature.
Change-Id: I203a7b0605fc061ec6aacfde3a8eedc4736379f2
Reviewed-on: https://gerrit.libreoffice.org/30140
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'xmlsecurity/inc')
-rw-r--r-- | xmlsecurity/inc/pdfio/pdfdocument.hxx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/xmlsecurity/inc/pdfio/pdfdocument.hxx b/xmlsecurity/inc/pdfio/pdfdocument.hxx index 816904f9f61f..b02bf9322088 100644 --- a/xmlsecurity/inc/pdfio/pdfdocument.hxx +++ b/xmlsecurity/inc/pdfio/pdfdocument.hxx @@ -46,6 +46,8 @@ class XMLSECURITY_DLLPUBLIC PDFDocument std::vector<size_t> m_aXRef; /// List of xref offsets we know. std::vector<size_t> m_aStartXRefs; + /// List of EOF offsets we know. + std::vector<size_t> m_aEOFs; PDFTrailerElement* m_pTrailer; /// All editing takes place in this buffer, if it happens. SvMemoryStream m_aEditBuffer; @@ -65,6 +67,8 @@ public: size_t GetObjectOffset(size_t nIndex) const; const std::vector< std::unique_ptr<PDFElement> >& GetElements(); std::vector<PDFObjectElement*> GetPages(); + /// Remember the end location of an EOF token. + void PushBackEOF(size_t nOffset); bool Read(SvStream& rStream); /// Sign the read document with xCertificate in the edit buffer. @@ -74,6 +78,8 @@ public: std::vector<PDFObjectElement*> GetSignatureWidgets(); /// Return value is about if we can determine a result, rInformation is about the actual result. static bool ValidateSignature(SvStream& rStream, PDFObjectElement* pSignature, SignatureInformation& rInformation); + /// Remove the nth signature from read document in the edit buffer. + bool RemoveSignature(size_t nPosition); }; } // namespace pdfio |