From 201321f648e82ecc610e7a3324a46248a19c1704 Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Wed, 16 May 2018 16:34:35 +0200 Subject: tdf#83877 Write SignatureLineId to ODF & OOXML signatures Change-Id: I483a3b7895cdcb10ef9d6dacf167ed0f8db7e723 Reviewed-on: https://gerrit.libreoffice.org/54432 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt --- sfx2/source/doc/docfile.cxx | 9 +++++---- sfx2/source/doc/objserv.cxx | 13 +++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 9de896d77a62..14a5f6aa61f0 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -3661,8 +3661,9 @@ void SfxMedium::CreateTempFileNoCopy() CloseStorage(); } -bool SfxMedium::SignContents_Impl(const Reference xCert, bool bScriptingContent, - const OUString& aODFVersion, bool bHasValidDocumentSignature) +bool SfxMedium::SignContents_Impl(const Reference xCert, const OUString& aSignatureLineId, + bool bScriptingContent, const OUString& aODFVersion, + bool bHasValidDocumentSignature) { bool bChanges = false; @@ -3753,7 +3754,7 @@ bool SfxMedium::SignContents_Impl(const Reference xCert, bool bScr bool bSuccess = false; if (xCert.is()) bSuccess = xSigner->signDocumentContentWithCertificate( - GetZipStorageToSign_Impl(), xStream, xCert); + GetZipStorageToSign_Impl(), xStream, xCert, aSignatureLineId); else bSuccess = xSigner->signDocumentContent(GetZipStorageToSign_Impl(), xStream); @@ -3779,7 +3780,7 @@ bool SfxMedium::SignContents_Impl(const Reference xCert, bool bScr if (xCert.is()) { bSuccess = xSigner->signDocumentContentWithCertificate( - GetZipStorageToSign_Impl(), xStream, xCert); + GetZipStorageToSign_Impl(/*bReadOnly=*/false), xStream, xCert, aSignatureLineId); } else { diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index edac57aeceee..46865cf1107a 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -1361,7 +1361,7 @@ SignatureState SfxObjectShell::ImplGetSignatureState( bool bScriptingContent ) return *pState; } -void SfxObjectShell::ImplSign(Reference xCert, +void SfxObjectShell::ImplSign(Reference xCert, const OUString& aSignatureLineId, bool bScriptingContent) { // Check if it is stored in OASIS format... @@ -1488,7 +1488,7 @@ void SfxObjectShell::ImplSign(Reference xCert, || pImpl->nDocumentSignatureState == SignatureState::PARTIAL_OK; bool bSignSuccess = GetMedium()->SignContents_Impl( - xCert, bScriptingContent, aODFVersion, bHasValidSignatures); + xCert, aSignatureLineId, bScriptingContent, aODFVersion, bHasValidSignatures); pImpl->m_bSavingForSigning = true; DoSaveCompleted( GetMedium() ); @@ -1523,12 +1523,13 @@ SignatureState SfxObjectShell::GetDocumentSignatureState() void SfxObjectShell::SignDocumentContent() { - ImplSign(Reference()); + ImplSign(); } -void SfxObjectShell::SignDocumentContent(const Reference xCert) +void SfxObjectShell::SignDocumentContent(const Reference xCert, + const OUString& aSignatureLineId) { - ImplSign(xCert); + ImplSign(xCert, aSignatureLineId); } SignatureState SfxObjectShell::GetScriptingSignatureState() @@ -1538,7 +1539,7 @@ SignatureState SfxObjectShell::GetScriptingSignatureState() void SfxObjectShell::SignScriptingContent() { - ImplSign( Reference(), true ); + ImplSign( Reference(), OUString(), true ); } namespace -- cgit v1.2.3