diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-10-07 15:35:33 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-10-07 15:35:56 +0200 |
commit | 8fab6ab36589d0dcd75d45feab43a0b06b7f2a3e (patch) | |
tree | 6471120650079335e156d46007071ae80a1bc463 | |
parent | 96814d2469f476790999634a1b7a9cd75447bef7 (diff) |
filter: don't loose signing description during pdf export
The free-form string attached to a signature is called description
during ODF/OOXML signing. The certificate chooser dialog has an input
field to provide that. The PDF export dialog's signature tab reuses
this dialog, but also provides an an own reason input field for the same
purpose.
So in case the generic dialog's description field is filled, don't
simply throw away that string, but set the pdf export's reason field to
the same value.
XDocumentDigitalSignatures.idl is not a published interface and it is
used only internally, so the API change is only nominal.
Change-Id: I6d4cf0b3f586417a76a052dc30c960478a95c984
4 files changed, 10 insertions, 4 deletions
diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx index a4efda00bff6..a2ff5f7e3952 100644 --- a/filter/source/pdf/impdialog.cxx +++ b/filter/source/pdf/impdialog.cxx @@ -1758,7 +1758,9 @@ IMPL_LINK_NOARG( ImpPDFTabSigningPage, ClickmaPbSignCertSelect, Button*, void ) security::DocumentDigitalSignatures::createWithVersion( comphelper::getProcessComponentContext(), "1.2" ) ); - maSignCertificate = xSigner->chooseCertificate(); + // The use may provide a description while choosing a certificate. + OUString aDescription; + maSignCertificate = xSigner->chooseCertificate(aDescription); if (maSignCertificate.is()) { @@ -1768,6 +1770,7 @@ IMPL_LINK_NOARG( ImpPDFTabSigningPage, ClickmaPbSignCertSelect, Button*, void ) mpEdSignPassword->Enable(); mpEdSignContactInfo->Enable(); mpEdSignReason->Enable(); + mpEdSignReason->SetText(aDescription); try { diff --git a/offapi/com/sun/star/security/XDocumentDigitalSignatures.idl b/offapi/com/sun/star/security/XDocumentDigitalSignatures.idl index cc785b988390..5ee5b9e44106 100644 --- a/offapi/com/sun/star/security/XDocumentDigitalSignatures.idl +++ b/offapi/com/sun/star/security/XDocumentDigitalSignatures.idl @@ -131,8 +131,10 @@ interface XDocumentDigitalSignatures : com::sun::star::uno::XInterface void addLocationToTrustedSources( [in] string Location ); /** This method shows CertificateChooser dialog, used by document and PDF signing + + @since LibreOffice 5.3 */ - com::sun::star::security::XCertificate chooseCertificate(); + com::sun::star::security::XCertificate chooseCertificate( [out] string Description ); } ; diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx index eb39cafa9397..cfa3d247634f 100644 --- a/xmlsecurity/source/component/documentdigitalsignatures.cxx +++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx @@ -440,7 +440,7 @@ sal_Bool DocumentDigitalSignatures::isAuthorTrusted( return bFound; } -Reference< css::security::XCertificate > DocumentDigitalSignatures::chooseCertificate() throw (RuntimeException, std::exception) +Reference< css::security::XCertificate > DocumentDigitalSignatures::chooseCertificate(OUString& rDescription) throw (RuntimeException, std::exception) { Reference< css::xml::crypto::XSecurityEnvironment > xSecEnv; @@ -454,6 +454,7 @@ Reference< css::security::XCertificate > DocumentDigitalSignatures::chooseCertif return Reference< css::security::XCertificate >(nullptr); Reference< css::security::XCertificate > xCert = aChooser->GetSelectedCertificate(); + rDescription = aChooser->GetDescription(); if ( !xCert.is() ) return Reference< css::security::XCertificate >(nullptr); diff --git a/xmlsecurity/source/component/documentdigitalsignatures.hxx b/xmlsecurity/source/component/documentdigitalsignatures.hxx index 7ab640570e2d..bd07304ed20c 100644 --- a/xmlsecurity/source/component/documentdigitalsignatures.hxx +++ b/xmlsecurity/source/component/documentdigitalsignatures.hxx @@ -96,7 +96,7 @@ public: void SAL_CALL addAuthorToTrustedSources( const css::uno::Reference< css::security::XCertificate >& Author ) throw (css::uno::RuntimeException, std::exception) override; void SAL_CALL addLocationToTrustedSources( const OUString& Location ) throw (css::uno::RuntimeException, std::exception) override; - css::uno::Reference< css::security::XCertificate > SAL_CALL chooseCertificate( ) throw (css::uno::RuntimeException, std::exception) override; + css::uno::Reference< css::security::XCertificate > SAL_CALL chooseCertificate(OUString& rDescription) throw (css::uno::RuntimeException, std::exception) override; }; css::uno::Reference< css::uno::XInterface > SAL_CALL DocumentDigitalSignatures_CreateInstance( |