[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - include/vcl vcl/source xmlsecurity/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 29 07:08:26 UTC 2020


 include/vcl/filter/pdfdocument.hxx               |    4 ++++
 vcl/source/filter/ipdf/pdfdocument.cxx           |    7 +++++++
 xmlsecurity/source/helper/pdfsignaturehelper.cxx |    4 ++++
 3 files changed, 15 insertions(+)

New commits:
commit 0a3b7e5b878576daa61fbd5c075df1ede35773ed
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Jun 16 14:31:55 2020 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Jun 29 09:07:44 2020 +0200

    sd signature line: access the pdf shape from the appearance writer
    
    PDFDocument::WriteAppearanceObject() is where we can turn the pdf data
    (containing a single shape only) into a form XObject, later.
    
    (cherry picked from commit 058c21ac4a552ee6f6ca2f67c0d134a819228d53)
    
    Change-Id: Id042c95af4a867d3997d6f7742a18659b8925c12
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97243
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/include/vcl/filter/pdfdocument.hxx b/include/vcl/filter/pdfdocument.hxx
index 65e84880c789..e95fb25a7408 100644
--- a/include/vcl/filter/pdfdocument.hxx
+++ b/include/vcl/filter/pdfdocument.hxx
@@ -364,6 +364,9 @@ class VCL_DLLPUBLIC PDFDocument
     /// All editing takes place in this buffer, if it happens.
     SvMemoryStream m_aEditBuffer;
 
+    /// Signature line in PDF format, to be consumed by the next Sign() invocation.
+    std::vector<sal_Int8> m_aSignatureLine;
+
     /// Suggest a minimal, yet free signature ID to use for the next signature.
     sal_uInt32 GetNextSignature();
     /// Write the signature object as part of signing.
@@ -417,6 +420,7 @@ public:
     //@{
     /// Read elements from the start of the stream till its end.
     bool Read(SvStream& rStream);
+    void SetSignatureLine(const std::vector<sal_Int8>& rSignatureLine);
     /// Sign the read document with xCertificate in the edit buffer.
     bool Sign(const css::uno::Reference<css::security::XCertificate>& xCertificate,
               const OUString& rDescription, bool bAdES);
diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx
index 02bde3fcaedb..0a02fe34bc48 100644
--- a/vcl/source/filter/ipdf/pdfdocument.cxx
+++ b/vcl/source/filter/ipdf/pdfdocument.cxx
@@ -147,6 +147,11 @@ bool PDFDocument::RemoveSignature(size_t nPosition)
     return m_aEditBuffer.good();
 }
 
+void PDFDocument::SetSignatureLine(const std::vector<sal_Int8>& rSignatureLine)
+{
+    m_aSignatureLine = rSignatureLine;
+}
+
 sal_uInt32 PDFDocument::GetNextSignature()
 {
     sal_uInt32 nRet = 0;
@@ -229,6 +234,8 @@ sal_Int32 PDFDocument::WriteSignatureObject(const OUString& rDescription, bool b
 
 sal_Int32 PDFDocument::WriteAppearanceObject()
 {
+    m_aSignatureLine.clear();
+
     // Write appearance object.
     sal_Int32 nAppearanceId = m_aXRef.size();
     XRefEntry aAppearanceEntry;
diff --git a/xmlsecurity/source/helper/pdfsignaturehelper.cxx b/xmlsecurity/source/helper/pdfsignaturehelper.cxx
index 614d8e694e07..beb5b7e800bb 100644
--- a/xmlsecurity/source/helper/pdfsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/pdfsignaturehelper.cxx
@@ -202,6 +202,10 @@ bool PDFSignatureHelper::Sign(const uno::Reference<io::XInputStream>& xInputStre
 
     std::vector<sal_Int8> aSignatureLineShape;
     GetSignatureLineShape(aSignatureLineShape);
+    if (!aSignatureLineShape.empty())
+    {
+        aDocument.SetSignatureLine(aSignatureLineShape);
+    }
 
     if (!aDocument.Sign(m_xCertificate, m_aDescription, bAdES))
     {


More information about the Libreoffice-commits mailing list