Files
odfstudio/xmlsecurity
Michael Weghorn c368f94db2 libxml2: Ignore deprecations for system libxml2 as well for now
commit e3b5e3aebc
    Date:   Wed Apr 23 13:38:50 2025 +0200

        libxml2: upgrade to 2.14.3

        * In https://gitlab.gnome.org/GNOME/libxml2/-/commit/712a31abe458eed75f0e2a442b35af58cf7091ca
        some members used by Libreoffice were marked as deprecated.
        Add deprecated.patch.0 to undeprecate them for now.
        Meanwhile
        https://gitlab.gnome.org/GNOME/libxml2/-/issues/936#note_2461334 has been
        opened to discuss it. The necessary code changes
        will be addressed in a follow-up commit
        [...]

added a patch to ignore deprecated symbols in
the internal libxml2, by undeprecating the symbols for
that version.

Drop that patch again and instead let compilers ignore
the deprecation warnings for now, to also make the --enable-werror
build pass for the (default) system libxml2 used e.g. on
Debian testing (which currently provides 2.14.5+dfsg-0.2).

Build failure seen there otherwise:

    /home/michi/development/git/libreoffice/xmlsecurity/source/xmlsec/saxhelper.cxx:162:24: error: 'recovery' is deprecated [-Werror,-Wdeprecated-declarations]
      162 |         m_pParserCtxt->recovery = 1 ;
          |                        ^
    /usr/include/libxml2/libxml/parser.h:377:18: note: 'recovery' has been explicitly marked deprecated here
      377 |     int recovery XML_DEPRECATED_MEMBER;
          |                  ^
    /usr/include/libxml2/libxml/xmlexports.h:74:50: note: expanded from macro 'XML_DEPRECATED_MEMBER'
       74 |     #define XML_DEPRECATED_MEMBER __attribute__((deprecated))
          |                                                  ^
    /home/michi/development/git/libreoffice/xmlsecurity/source/xmlsec/saxhelper.cxx:209:20: error: 'nodeTab' is deprecated [-Werror,-Wdeprecated-declarations]
      209 |     m_pParserCtxt->nodeTab[m_pParserCtxt->nodeNr - 1]
          |                    ^
    /usr/include/libxml2/libxml/parser.h:284:25: note: 'nodeTab' has been explicitly marked deprecated here
      284 |     xmlNodePtr *nodeTab XML_DEPRECATED_MEMBER;
          |                         ^
    /usr/include/libxml2/libxml/xmlexports.h:74:50: note: expanded from macro 'XML_DEPRECATED_MEMBER'
       74 |     #define XML_DEPRECATED_MEMBER __attribute__((deprecated))
          |                                                  ^
    /home/michi/development/git/libreoffice/xmlsecurity/source/xmlsec/saxhelper.cxx:209:43: error: 'nodeNr' is deprecated [-Werror,-Wdeprecated-declarations]
      209 |     m_pParserCtxt->nodeTab[m_pParserCtxt->nodeNr - 1]
          |                                           ^
    /usr/include/libxml2/libxml/parser.h:280:16: note: 'nodeNr' has been explicitly marked deprecated here
      280 |     int nodeNr XML_DEPRECATED_MEMBER;
          |                ^
    /usr/include/libxml2/libxml/xmlexports.h:74:50: note: expanded from macro 'XML_DEPRECATED_MEMBER'
       74 |     #define XML_DEPRECATED_MEMBER __attribute__((deprecated))
          |                                                  ^
    /home/michi/development/git/libreoffice/xmlsecurity/source/xmlsec/saxhelper.cxx:229:62: error: 'inputMax' is deprecated [-Werror,-Wdeprecated-declarations]
      229 |     if( m_pParserCtxt->inputTab != nullptr && m_pParserCtxt->inputMax != 0 )
          |                                                              ^
    /usr/include/libxml2/libxml/parser.h:271:18: note: 'inputMax' has been explicitly marked deprecated here
      271 |     int inputMax XML_DEPRECATED_MEMBER;
          |                  ^
    /usr/include/libxml2/libxml/xmlexports.h:74:50: note: expanded from macro 'XML_DEPRECATED_MEMBER'
       74 |     #define XML_DEPRECATED_MEMBER __attribute__((deprecated))
          |                                                  ^
    4 errors generated.
    make[1]: *** [/home/michi/development/git/libreoffice/solenv/gbuild/LinkTarget.mk:338: /home/michi/development/git/libreoffice/workdir/CxxObject/xmlsecurity/source/xmlsec/saxhelper.o] Error 1
    make[1]: *** Waiting for unfinished jobs....
    make: *** [Makefile:301: build] Error 2

Change-Id: I1124859c0ef766b73f506dd997d89543ccf6eb12
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190668
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2025-09-08 15:32:08 +02:00
..
…
2025-09-05 19:45:45 +02:00
…
2025-08-25 18:12:03 +02:00
…
…

Document Signing

Introduction

This code provides dialogs, and infrastructure wrapping libxmlsec and gpgme that implements document signing.

For signing a document, a personal key pair is used, which consists of a private key and a public key, which is added to the document in addition to the digital signature of the document, when signing it.

The document signing can be done both for the source ODF/OOXML files and the exported PDF files. It is also possible to sign existing PDF files.

Module Contents

  • doc: OpenDocument workflow legacy information with some illustrations to have an idea of the workflow, for starters check doc/OpenDocumentSignatures-Workflow.odt.
  • inc: Headers to a subset of source files inside the module, parts like source/framework have headers inside the folder.
  • qa: Unit tests for signing and shell scripts for certificates creation for testing.
  • test_docs: Documents & certificates used for testing.
  • source: More on that below.
  • uiconfig: User interface configuration for different dialogs, it is recommended to navigate from relevant source file to the .ui file linked in the class which will be under uiconfig/ui.
  • util: UNO passive registration config for GPG/ NSS.

Source Primary Contents

  • component: Main implementation of DocumentDigitalSignatures where the interaction with security environment and certificates occur.
  • dialogs: Certificate & Signatures management dialogs.
    • certificatechooser: Dialog that allows you to find and choose certificates or signatures for encryption.
    • certificateviewer: More detailed information about each certificate.
    • digitalsignaturesdialog: Main window for signatures of the documents and the start point of signing document.
  • framework: Various elements for verifying signatures and running security engine.
  • gpg: The implementation of encrypting with GPG and security environment initialization.
  • helper: Some helper classes that include signatures manager and the helpers for PDF signing, UriBinding, and XML signatures. It also include helper tools for XSecurityEnvironment.
  • xmlsec: XML, NSS, MSCrypt encryption/ signing tools, more on the low-level side of actual implementation of algorithms.

PDF Testing

To test the signed PDFs, one can use the pdfverify in this way:

./bin/run pdfverify $PWD/xmlsecurity/qa/unit/pdfsigning/data/2good.pdf

The file parameter should be an absolute path.

This is the output of pdfverify for 2good.pdf:

verifying signatures
found 2 signatures
signature #0: digest match? 1
signature #0: partial? 0
signature #1: digest match? 1
signature #1: partial? 0

References