[Libreoffice-commits] core.git: filter/source offapi/com xmlsecurity/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Oct 7 13:38:50 UTC 2016


 filter/source/pdf/impdialog.cxx                             |    5 ++++-
 offapi/com/sun/star/security/XDocumentDigitalSignatures.idl |    4 +++-
 xmlsecurity/source/component/documentdigitalsignatures.cxx  |    3 ++-
 xmlsecurity/source/component/documentdigitalsignatures.hxx  |    2 +-
 4 files changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 8fab6ab36589d0dcd75d45feab43a0b06b7f2a3e
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Oct 7 15:35:33 2016 +0200

    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

diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index a4efda0..a2ff5f7 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 cc785b9..5ee5b9e 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 eb39caf..cfa3d24 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 7ab6405..bd07304 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(


More information about the Libreoffice-commits mailing list