diff options
-rw-r--r-- | include/vcl/filter/pdfdocument.hxx | 4 | ||||
-rw-r--r-- | vcl/source/filter/ipdf/pdfdocument.cxx | 7 | ||||
-rw-r--r-- | xmlsecurity/source/helper/pdfsignaturehelper.cxx | 4 |
3 files changed, 15 insertions, 0 deletions
diff --git a/include/vcl/filter/pdfdocument.hxx b/include/vcl/filter/pdfdocument.hxx index 42130eba9d15..8700e4892df2 100644 --- a/include/vcl/filter/pdfdocument.hxx +++ b/include/vcl/filter/pdfdocument.hxx @@ -344,6 +344,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. @@ -397,6 +400,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 73d7f452688d..316b8c74d169 100644 --- a/vcl/source/filter/ipdf/pdfdocument.cxx +++ b/vcl/source/filter/ipdf/pdfdocument.cxx @@ -151,6 +151,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; @@ -233,6 +238,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)) { |