[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - xmlsecurity/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 26 17:41:06 UTC 2021


 xmlsecurity/source/helper/xsecctl.cxx    |  120 ++++++++++++++-----------------
 xmlsecurity/source/helper/xsecparser.cxx |   39 ++++------
 xmlsecurity/source/helper/xsecsign.cxx   |   26 ++----
 xmlsecurity/source/helper/xsecverify.cxx |   45 +++++------
 4 files changed, 107 insertions(+), 123 deletions(-)

New commits:
commit 31c515cf7af84f5fd1b8126906c2d8e76a66dc1a
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue May 12 16:17:25 2020 +0200
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Fri Mar 26 18:40:31 2021 +0100

    expand out some namespace aliases [xmlsecurity/source/helper]
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94093
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    (cherry picked from commit 943fbfad668da76f7d0ebd4f4d8cdd67224d2f01)
    
    plus one line in xsecverify.cxx from:
    
        commit f59d9e7ea09482c2e9e5f52a8d0445e4cebc3df5
        Author:     Noel Grandin <noel.grandin at collabora.co.uk>
        AuthorDate: Fri Apr 3 15:53:49 2020 +0200
    
        new loplugin:unusedvariableplus
    
        a particularly aggressive checker, which is why it is off by default
    
    Change-Id: I5fdb554a1b116824843f35645bc1cea3ca91e0f2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113094
    Tested-by: Michael Stahl <michael.stahl at allotropia.de>
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>

diff --git a/xmlsecurity/source/helper/xsecctl.cxx b/xmlsecurity/source/helper/xsecctl.cxx
index 13ef9eb2e299..bc188709235f 100644
--- a/xmlsecurity/source/helper/xsecctl.cxx
+++ b/xmlsecurity/source/helper/xsecctl.cxx
@@ -46,10 +46,6 @@
 #include "ooxmlsecexporter.hxx"
 #include <xmlsignaturehelper2.hxx>
 
-namespace cssu = com::sun::star::uno;
-namespace cssl = com::sun::star::lang;
-namespace cssxc = com::sun::star::xml::crypto;
-namespace cssxs = com::sun::star::xml::sax;
 using namespace com::sun::star;
 
 namespace
@@ -58,11 +54,11 @@ OUString getDigestURI(sal_Int32 nID)
 {
     switch( nID )
     {
-        case cssxc::DigestID::SHA1:
+        case css::xml::crypto::DigestID::SHA1:
             return OUString(ALGO_XMLDSIGSHA1);
-        case cssxc::DigestID::SHA256:
+        case css::xml::crypto::DigestID::SHA256:
             return OUString(ALGO_XMLDSIGSHA256);
-        case cssxc::DigestID::SHA512:
+        case css::xml::crypto::DigestID::SHA512:
             return OUString(ALGO_XMLDSIGSHA512);
         default:
             return OUString(ALGO_XMLDSIGSHA1);
@@ -76,13 +72,13 @@ OUString getSignatureURI(svl::crypto::SignatureMethodAlgorithm eAlgorithm, sal_I
     {
         switch (nDigestID)
         {
-            case cssxc::DigestID::SHA1:
+            case css::xml::crypto::DigestID::SHA1:
                 aRet = ALGO_ECDSASHA1;
                 break;
-            case cssxc::DigestID::SHA256:
+            case css::xml::crypto::DigestID::SHA256:
                 aRet = ALGO_ECDSASHA256;
                 break;
-            case cssxc::DigestID::SHA512:
+            case css::xml::crypto::DigestID::SHA512:
                 aRet = ALGO_ECDSASHA512;
                 break;
             default:
@@ -95,11 +91,11 @@ OUString getSignatureURI(svl::crypto::SignatureMethodAlgorithm eAlgorithm, sal_I
 
     switch (nDigestID)
     {
-        case cssxc::DigestID::SHA1:
+        case css::xml::crypto::DigestID::SHA1:
             return OUString(ALGO_RSASHA1);
-        case cssxc::DigestID::SHA256:
+        case css::xml::crypto::DigestID::SHA256:
             return OUString(ALGO_RSASHA256);
-        case cssxc::DigestID::SHA512:
+        case css::xml::crypto::DigestID::SHA512:
             return OUString(ALGO_RSASHA512);
         default:
             return OUString(ALGO_RSASHA1);
@@ -107,7 +103,7 @@ OUString getSignatureURI(svl::crypto::SignatureMethodAlgorithm eAlgorithm, sal_I
 }
 }
 
-XSecController::XSecController( const cssu::Reference<cssu::XComponentContext>& rxCtx )
+XSecController::XSecController( const css::uno::Reference<css::uno::XComponentContext>& rxCtx )
     : mxCtx(rxCtx)
     , m_nNextSecurityId(1)
     , m_bIsPreviousNodeInitializable(false)
@@ -182,15 +178,15 @@ void XSecController::createXSecComponent( )
     m_xXMLDocumentWrapper = nullptr;
     m_xSAXEventKeeper = nullptr;
 
-    cssu::Reference< cssl::XMultiComponentFactory > xMCF( mxCtx->getServiceManager() );
+    css::uno::Reference< css::lang::XMultiComponentFactory > xMCF( mxCtx->getServiceManager() );
 
 #if HAVE_FEATURE_GPGME
-    uno::Reference< lang::XServiceInfo > xServiceInfo( m_xSecurityContext, cssu::UNO_QUERY );
+    uno::Reference< lang::XServiceInfo > xServiceInfo( m_xSecurityContext, css::uno::UNO_QUERY );
     if (xServiceInfo->getImplementationName() == "com.sun.star.xml.security.gpg.XMLSecurityContext_GpgImpl")
         m_xXMLSignature.set(new XMLSignature_GpgImpl());
     else // xmlsec or mscrypt
 #endif
-        m_xXMLSignature.set(xMCF->createInstanceWithContext("com.sun.star.xml.crypto.XMLSignature", mxCtx), cssu::UNO_QUERY);
+        m_xXMLSignature.set(xMCF->createInstanceWithContext("com.sun.star.xml.crypto.XMLSignature", mxCtx), css::uno::UNO_QUERY);
 
     bool bSuccess = m_xXMLSignature.is();
     if ( bSuccess )
@@ -210,11 +206,11 @@ void XSecController::createXSecComponent( )
      * SAXEventKeeper created successfully.
      */
     {
-        cssu::Sequence <cssu::Any> arg(1);
+        css::uno::Sequence <css::uno::Any> arg(1);
         arg[0] <<= uno::Reference<xml::wrapper::XXMLDocumentWrapper>(m_xXMLDocumentWrapper.get());
         m_xSAXEventKeeper->initialize(arg);
 
-        cssu::Reference< cssxc::sax::XSAXEventKeeperStatusChangeListener >
+        css::uno::Reference< css::xml::crypto::sax::XSAXEventKeeperStatusChangeListener >
             xStatusChangeListener = this;
 
         m_xSAXEventKeeper->addSAXEventKeeperStatusChangeListener( xStatusChangeListener );
@@ -277,7 +273,7 @@ bool XSecController::chainOn()
              */
             m_xSAXEventKeeper->setNextHandler( nullptr );
 
-            cssu::Reference< cssxs::XDocumentHandler > xSEKHandler(static_cast<cppu::OWeakObject*>(m_xSAXEventKeeper.get()), cssu::UNO_QUERY);
+            css::uno::Reference< css::xml::sax::XDocumentHandler > xSEKHandler(static_cast<cppu::OWeakObject*>(m_xSAXEventKeeper.get()), css::uno::UNO_QUERY);
 
             /*
              * connects the previous document handler on the SAX chain
@@ -286,17 +282,17 @@ bool XSecController::chainOn()
             {
                 if ( m_bIsPreviousNodeInitializable )
                 {
-                    cssu::Reference< cssl::XInitialization > xInitialization
-                        (m_xPreviousNodeOnSAXChain, cssu::UNO_QUERY);
+                    css::uno::Reference< css::lang::XInitialization > xInitialization
+                        (m_xPreviousNodeOnSAXChain, css::uno::UNO_QUERY);
 
-                    cssu::Sequence<cssu::Any> aArgs( 1 );
+                    css::uno::Sequence<css::uno::Any> aArgs( 1 );
                     aArgs[0] <<= xSEKHandler;
                     xInitialization->initialize(aArgs);
                 }
                 else
                 {
-                    cssu::Reference< cssxs::XParser > xParser
-                        (m_xPreviousNodeOnSAXChain, cssu::UNO_QUERY);
+                    css::uno::Reference< css::xml::sax::XParser > xParser
+                        (m_xPreviousNodeOnSAXChain, css::uno::UNO_QUERY);
                     xParser->setDocumentHandler( xSEKHandler );
                 }
             }
@@ -332,16 +328,16 @@ void XSecController::chainOff()
             {
                 if ( m_bIsPreviousNodeInitializable )
                 {
-                    cssu::Reference< cssl::XInitialization > xInitialization
-                        (m_xPreviousNodeOnSAXChain, cssu::UNO_QUERY);
+                    css::uno::Reference< css::lang::XInitialization > xInitialization
+                        (m_xPreviousNodeOnSAXChain, css::uno::UNO_QUERY);
 
-                    cssu::Sequence<cssu::Any> aArgs( 1 );
+                    css::uno::Sequence<css::uno::Any> aArgs( 1 );
                     aArgs[0] <<= uno::Reference<xml::sax::XDocumentHandler>();
                     xInitialization->initialize(aArgs);
                 }
                 else
                 {
-                    cssu::Reference< cssxs::XParser > xParser(m_xPreviousNodeOnSAXChain, cssu::UNO_QUERY);
+                    css::uno::Reference< css::xml::sax::XParser > xParser(m_xPreviousNodeOnSAXChain, css::uno::UNO_QUERY);
                     xParser->setDocumentHandler(uno::Reference<xml::sax::XDocumentHandler>());
                 }
             }
@@ -398,7 +394,7 @@ void XSecController::initializeSAXChain()
     chainOff();
 }
 
-cssu::Reference< css::io::XInputStream >
+css::uno::Reference< css::io::XInputStream >
     XSecController::getObjectInputStream( const OUString& objectURL )
 /****** XSecController/getObjectInputStream ************************************
  *
@@ -415,7 +411,7 @@ cssu::Reference< css::io::XInputStream >
  *  xInputStream - the XInputStream interface
  ******************************************************************************/
 {
-        cssu::Reference< css::io::XInputStream > xObjectInputStream;
+    css::uno::Reference< css::io::XInputStream > xObjectInputStream;
 
     SAL_WARN_IF( !m_xUriBinding.is(), "xmlsecurity.helper", "Need XUriBinding!" );
 
@@ -435,7 +431,7 @@ sal_Int32 XSecController::getNewSecurityId(  )
     return nId;
 }
 
-void XSecController::startMission(const rtl::Reference<UriBindingHelper>& xUriBinding, const cssu::Reference< cssxc::XXMLSecurityContext >& xSecurityContext )
+void XSecController::startMission(const rtl::Reference<UriBindingHelper>& xUriBinding, const css::uno::Reference< css::xml::crypto::XXMLSecurityContext >& xSecurityContext )
 /****** XSecController/startMission *******************************************
  *
  *   NAME
@@ -461,7 +457,7 @@ void XSecController::startMission(const rtl::Reference<UriBindingHelper>& xUriBi
     m_bVerifyCurrentSignature = false;
 }
 
-void XSecController::setSAXChainConnector(const cssu::Reference< cssl::XInitialization >& xInitialization)
+void XSecController::setSAXChainConnector(const css::uno::Reference< css::lang::XInitialization >& xInitialization)
 /****** XSecController/setSAXChainConnector ***********************************
  *
  *   NAME
@@ -512,8 +508,8 @@ void XSecController::endMission()
          * ResolvedListener only exist when the security components are created.
          */
         {
-            cssu::Reference< cssxc::sax::XMissionTaker > xMissionTaker
-                ( m_vInternalSignatureInformations[i].xReferenceResolvedListener, cssu::UNO_QUERY );
+            css::uno::Reference< css::xml::crypto::sax::XMissionTaker > xMissionTaker
+                ( m_vInternalSignatureInformations[i].xReferenceResolvedListener, css::uno::UNO_QUERY );
 
             /*
              * asks the SignatureCreator/SignatureVerifier to release
@@ -572,7 +568,7 @@ void writeUnsignedProperties(
 }
 
 void XSecController::exportSignature(
-    const cssu::Reference<cssxs::XDocumentHandler>& xDocumentHandler,
+    const css::uno::Reference<css::xml::sax::XDocumentHandler>& xDocumentHandler,
     const SignatureInformation& signatureInfo,
     bool bXAdESCompliantIfODF )
 /****** XSecController/exportSignature ****************************************
@@ -606,19 +602,19 @@ void XSecController::exportSignature(
             signatureInfo.ouSignatureId);
     }
 
-    xDocumentHandler->startElement( "Signature", cssu::Reference< cssxs::XAttributeList > (pAttributeList));
+    xDocumentHandler->startElement( "Signature", css::uno::Reference< css::xml::sax::XAttributeList > (pAttributeList));
     {
         /* Write SignedInfo element */
         xDocumentHandler->startElement(
             "SignedInfo",
-            cssu::Reference< cssxs::XAttributeList > (new SvXMLAttributeList()));
+            css::uno::Reference< css::xml::sax::XAttributeList > (new SvXMLAttributeList()));
         {
             /* Write CanonicalizationMethod element */
             pAttributeList = new SvXMLAttributeList();
             pAttributeList->AddAttribute(
                 "Algorithm",
                 ALGO_C14N);
-            xDocumentHandler->startElement( "CanonicalizationMethod", cssu::Reference< cssxs::XAttributeList > (pAttributeList) );
+            xDocumentHandler->startElement( "CanonicalizationMethod", css::uno::Reference< css::xml::sax::XAttributeList > (pAttributeList) );
             xDocumentHandler->endElement( "CanonicalizationMethod" );
 
             /* Write SignatureMethod element */
@@ -632,7 +628,7 @@ void XSecController::exportSignature(
             pAttributeList->AddAttribute(
                 "Algorithm",
                 getSignatureURI(signatureInfo.eAlgorithmID, vReferenceInfors[0].nDigestID));
-            xDocumentHandler->startElement( "SignatureMethod", cssu::Reference< cssxs::XAttributeList > (pAttributeList) );
+            xDocumentHandler->startElement( "SignatureMethod", css::uno::Reference< css::xml::sax::XAttributeList > (pAttributeList) );
             xDocumentHandler->endElement( "SignatureMethod" );
 
             /* Write Reference element */
@@ -671,7 +667,7 @@ void XSecController::exportSignature(
                     }
                 }
 
-                xDocumentHandler->startElement( "Reference", cssu::Reference< cssxs::XAttributeList > (pAttributeList) );
+                xDocumentHandler->startElement( "Reference", css::uno::Reference< css::xml::sax::XAttributeList > (pAttributeList) );
                 {
                     /* Write Transforms element */
                     if (refInfor.nType == SignatureReferenceType::XMLSTREAM)
@@ -681,7 +677,7 @@ void XSecController::exportSignature(
                     {
                         xDocumentHandler->startElement(
                             "Transforms",
-                            cssu::Reference< cssxs::XAttributeList > (new SvXMLAttributeList()));
+                            css::uno::Reference< css::xml::sax::XAttributeList > (new SvXMLAttributeList()));
                         {
                             pAttributeList = new SvXMLAttributeList();
                             pAttributeList->AddAttribute(
@@ -689,7 +685,7 @@ void XSecController::exportSignature(
                                 ALGO_C14N);
                             xDocumentHandler->startElement(
                                 "Transform",
-                                cssu::Reference< cssxs::XAttributeList > (pAttributeList) );
+                                css::uno::Reference< css::xml::sax::XAttributeList > (pAttributeList) );
                             xDocumentHandler->endElement( "Transform" );
                         }
                         xDocumentHandler->endElement( "Transforms" );
@@ -702,13 +698,13 @@ void XSecController::exportSignature(
                         getDigestURI(refInfor.nDigestID));
                     xDocumentHandler->startElement(
                         "DigestMethod",
-                        cssu::Reference< cssxs::XAttributeList > (pAttributeList) );
+                        css::uno::Reference< css::xml::sax::XAttributeList > (pAttributeList) );
                     xDocumentHandler->endElement( "DigestMethod" );
 
                     /* Write DigestValue element */
                     xDocumentHandler->startElement(
                         "DigestValue",
-                        cssu::Reference< cssxs::XAttributeList > (new SvXMLAttributeList()));
+                        css::uno::Reference< css::xml::sax::XAttributeList > (new SvXMLAttributeList()));
                     xDocumentHandler->characters( refInfor.ouDigestValue );
                     xDocumentHandler->endElement( "DigestValue" );
                 }
@@ -720,14 +716,14 @@ void XSecController::exportSignature(
         /* Write SignatureValue element */
         xDocumentHandler->startElement(
             "SignatureValue",
-            cssu::Reference< cssxs::XAttributeList > (new SvXMLAttributeList()));
+            css::uno::Reference< css::xml::sax::XAttributeList > (new SvXMLAttributeList()));
         xDocumentHandler->characters( signatureInfo.ouSignatureValue );
         xDocumentHandler->endElement( "SignatureValue" );
 
         /* Write KeyInfo element */
         xDocumentHandler->startElement(
             "KeyInfo",
-            cssu::Reference< cssxs::XAttributeList > (new SvXMLAttributeList()));
+            css::uno::Reference< css::xml::sax::XAttributeList > (new SvXMLAttributeList()));
         {
             // GPG or X509 key?
             if (!signatureInfo.ouGpgCertificate.isEmpty())
@@ -737,12 +733,12 @@ void XSecController::exportSignature(
                 /* Write PGPData element */
                 xDocumentHandler->startElement(
                     "PGPData",
-                    cssu::Reference< cssxs::XAttributeList > (pAttributeList));
+                    css::uno::Reference< css::xml::sax::XAttributeList > (pAttributeList));
                 {
                     /* Write keyid element */
                     xDocumentHandler->startElement(
                         "PGPKeyID",
-                        cssu::Reference< cssxs::XAttributeList > (new SvXMLAttributeList()));
+                        css::uno::Reference< css::xml::sax::XAttributeList > (new SvXMLAttributeList()));
                     xDocumentHandler->characters( signatureInfo.ouCertDigest );
                     xDocumentHandler->endElement( "PGPKeyID" );
 
@@ -751,7 +747,7 @@ void XSecController::exportSignature(
                     {
                         xDocumentHandler->startElement(
                             "PGPKeyPacket",
-                            cssu::Reference< cssxs::XAttributeList > (new SvXMLAttributeList()));
+                            css::uno::Reference< css::xml::sax::XAttributeList > (new SvXMLAttributeList()));
                         xDocumentHandler->characters( signatureInfo.ouGpgCertificate );
                         xDocumentHandler->endElement( "PGPKeyPacket" );
                     }
@@ -759,7 +755,7 @@ void XSecController::exportSignature(
                     /* Write PGPOwner element */
                     xDocumentHandler->startElement(
                         "loext:PGPOwner",
-                        cssu::Reference< cssxs::XAttributeList >(new SvXMLAttributeList()));
+                        css::uno::Reference< css::xml::sax::XAttributeList >(new SvXMLAttributeList()));
                     xDocumentHandler->characters( signatureInfo.ouGpgOwner );
                     xDocumentHandler->endElement( "loext:PGPOwner" );
                 }
@@ -770,24 +766,24 @@ void XSecController::exportSignature(
                 /* Write X509Data element */
                 xDocumentHandler->startElement(
                     "X509Data",
-                    cssu::Reference< cssxs::XAttributeList > (new SvXMLAttributeList()));
+                    css::uno::Reference< css::xml::sax::XAttributeList > (new SvXMLAttributeList()));
                 {
                     /* Write X509IssuerSerial element */
                     xDocumentHandler->startElement(
                         "X509IssuerSerial",
-                        cssu::Reference< cssxs::XAttributeList > (new SvXMLAttributeList()));
+                        css::uno::Reference< css::xml::sax::XAttributeList > (new SvXMLAttributeList()));
                     {
                         /* Write X509IssuerName element */
                         xDocumentHandler->startElement(
                             "X509IssuerName",
-                            cssu::Reference< cssxs::XAttributeList > (new SvXMLAttributeList()));
+                            css::uno::Reference< css::xml::sax::XAttributeList > (new SvXMLAttributeList()));
                         xDocumentHandler->characters( signatureInfo.ouX509IssuerName );
                         xDocumentHandler->endElement( "X509IssuerName" );
 
                         /* Write X509SerialNumber element */
                         xDocumentHandler->startElement(
                             "X509SerialNumber",
-                            cssu::Reference< cssxs::XAttributeList > (new SvXMLAttributeList()));
+                            css::uno::Reference< css::xml::sax::XAttributeList > (new SvXMLAttributeList()));
                         xDocumentHandler->characters( signatureInfo.ouX509SerialNumber );
                         xDocumentHandler->endElement( "X509SerialNumber" );
                     }
@@ -798,7 +794,7 @@ void XSecController::exportSignature(
                     {
                         xDocumentHandler->startElement(
                             "X509Certificate",
-                            cssu::Reference< cssxs::XAttributeList > (new SvXMLAttributeList()));
+                            css::uno::Reference< css::xml::sax::XAttributeList > (new SvXMLAttributeList()));
                         xDocumentHandler->characters( signatureInfo.ouX509Certificate );
                         xDocumentHandler->endElement( "X509Certificate" );
                     }
@@ -813,12 +809,12 @@ void XSecController::exportSignature(
         /* Write Object element */
         xDocumentHandler->startElement(
             "Object",
-            cssu::Reference< cssxs::XAttributeList > (new SvXMLAttributeList()));
+            css::uno::Reference< css::xml::sax::XAttributeList > (new SvXMLAttributeList()));
         {
             /* Write SignatureProperties element */
             xDocumentHandler->startElement(
                 "SignatureProperties",
-                cssu::Reference< cssxs::XAttributeList > (new SvXMLAttributeList()));
+                css::uno::Reference< css::xml::sax::XAttributeList > (new SvXMLAttributeList()));
             {
                 /* Write SignatureProperty element */
                 pAttributeList = new SvXMLAttributeList();
@@ -830,7 +826,7 @@ void XSecController::exportSignature(
                     "#" + signatureInfo.ouSignatureId);
                 xDocumentHandler->startElement(
                     "SignatureProperty",
-                    cssu::Reference< cssxs::XAttributeList > (pAttributeList));
+                    css::uno::Reference< css::xml::sax::XAttributeList > (pAttributeList));
                 {
                     /* Write timestamp element */
 
@@ -841,7 +837,7 @@ void XSecController::exportSignature(
 
                     xDocumentHandler->startElement(
                         "dc:date",
-                        cssu::Reference< cssxs::XAttributeList > (pAttributeList));
+                        css::uno::Reference< css::xml::sax::XAttributeList > (pAttributeList));
 
                     OUStringBuffer buffer;
                     //If the xml signature was already contained in the document,
@@ -899,13 +895,13 @@ void XSecController::exportSignature(
             pAttributeList->AddAttribute("xmlns:xd", NS_XD);
             xDocumentHandler->startElement(
                 "Object",
-                cssu::Reference< cssxs::XAttributeList > (pAttributeList));
+                css::uno::Reference< css::xml::sax::XAttributeList > (pAttributeList));
             {
                 pAttributeList = new SvXMLAttributeList();
                 pAttributeList->AddAttribute("Target", "#" + signatureInfo.ouSignatureId);
                 xDocumentHandler->startElement(
                     "xd:QualifyingProperties",
-                    cssu::Reference< cssxs::XAttributeList > (pAttributeList));
+                    css::uno::Reference< css::xml::sax::XAttributeList > (pAttributeList));
                 DocumentSignatureHelper::writeSignedProperties(xDocumentHandler, signatureInfo, sDate, true);
                 writeUnsignedProperties(xDocumentHandler, signatureInfo);
                 xDocumentHandler->endElement( "xd:QualifyingProperties" );
diff --git a/xmlsecurity/source/helper/xsecparser.cxx b/xmlsecurity/source/helper/xsecparser.cxx
index 153a4aeddd77..72bfeb16e896 100644
--- a/xmlsecurity/source/helper/xsecparser.cxx
+++ b/xmlsecurity/source/helper/xsecparser.cxx
@@ -25,9 +25,6 @@
 
 #include <string.h>
 
-namespace cssu = com::sun::star::uno;
-namespace cssxc = com::sun::star::xml::crypto;
-namespace cssxs = com::sun::star::xml::sax;
 
 XSecParser::XSecParser(XMLSignatureHelper& rXMLSignatureHelper,
     XSecController* pXSecController)
@@ -49,12 +46,12 @@ XSecParser::XSecParser(XMLSignatureHelper& rXMLSignatureHelper,
     , m_bInSignatureLineInvalidImage(false)
     , m_pXSecController(pXSecController)
     , m_bReferenceUnresolved(false)
-    , m_nReferenceDigestID(cssxc::DigestID::SHA1)
+    , m_nReferenceDigestID(css::xml::crypto::DigestID::SHA1)
     , m_rXMLSignatureHelper(rXMLSignatureHelper)
 {
 }
 
-OUString XSecParser::getIdAttr(const cssu::Reference< cssxs::XAttributeList >& xAttribs )
+OUString XSecParser::getIdAttr(const css::uno::Reference< css::xml::sax::XAttributeList >& xAttribs )
 {
     OUString ouIdAttr = xAttribs->getValueByName("id");
 
@@ -98,7 +95,7 @@ void SAL_CALL XSecParser::endDocument(  )
 
 void SAL_CALL XSecParser::startElement(
     const OUString& aName,
-    const cssu::Reference< cssxs::XAttributeList >& xAttribs )
+    const css::uno::Reference< css::xml::sax::XAttributeList >& xAttribs )
 {
     try
     {
@@ -158,11 +155,11 @@ void SAL_CALL XSecParser::startElement(
                              && ouAlgorithm != ALGO_XMLDSIGSHA512,
                              "xmlsecurity.helper", "Algorithm neither SHA1, SHA256 nor SHA512");
                 if (ouAlgorithm == ALGO_XMLDSIGSHA1)
-                    m_nReferenceDigestID = cssxc::DigestID::SHA1;
+                    m_nReferenceDigestID = css::xml::crypto::DigestID::SHA1;
                 else if (ouAlgorithm == ALGO_XMLDSIGSHA256)
-                    m_nReferenceDigestID = cssxc::DigestID::SHA256;
+                    m_nReferenceDigestID = css::xml::crypto::DigestID::SHA256;
                 else if (ouAlgorithm == ALGO_XMLDSIGSHA512)
-                    m_nReferenceDigestID = cssxc::DigestID::SHA512;
+                    m_nReferenceDigestID = css::xml::crypto::DigestID::SHA512;
                 else
                     m_nReferenceDigestID = 0;
             }
@@ -285,18 +282,18 @@ void SAL_CALL XSecParser::startElement(
             m_xNextHandler->startElement(aName, xAttribs);
         }
     }
-    catch (cssu::Exception& )
+    catch (css::uno::Exception& )
     {//getCaughtException MUST be the first line in the catch block
-        cssu::Any exc =  cppu::getCaughtException();
-        throw cssxs::SAXException(
+        css::uno::Any exc =  cppu::getCaughtException();
+        throw css::xml::sax::SAXException(
             "xmlsecurity: Exception in XSecParser::startElement",
             nullptr, exc);
     }
     catch (...)
     {
-        throw cssxs::SAXException(
+        throw css::xml::sax::SAXException(
             "xmlsecurity: unexpected exception in XSecParser::startElement", nullptr,
-            cssu::Any());
+            css::uno::Any());
     }
 }
 
@@ -409,18 +406,18 @@ void SAL_CALL XSecParser::endElement( const OUString& aName )
             m_xNextHandler->endElement(aName);
         }
     }
-    catch (cssu::Exception& )
+    catch (css::uno::Exception& )
     {//getCaughtException MUST be the first line in the catch block
-        cssu::Any exc =  cppu::getCaughtException();
-        throw cssxs::SAXException(
+        css::uno::Any exc =  cppu::getCaughtException();
+        throw css::xml::sax::SAXException(
             "xmlsecurity: Exception in XSecParser::endElement",
             nullptr, exc);
     }
     catch (...)
     {
-        throw cssxs::SAXException(
+        throw css::xml::sax::SAXException(
             "xmlsecurity: unexpected exception in XSecParser::endElement", nullptr,
-            cssu::Any());
+            css::uno::Any());
     }
 }
 
@@ -513,7 +510,7 @@ void SAL_CALL XSecParser::processingInstruction( const OUString& aTarget, const
     }
 }
 
-void SAL_CALL XSecParser::setDocumentLocator( const cssu::Reference< cssxs::XLocator >& xLocator )
+void SAL_CALL XSecParser::setDocumentLocator( const css::uno::Reference< css::xml::sax::XLocator >& xLocator )
 {
     if (m_xNextHandler.is())
     {
@@ -525,7 +522,7 @@ void SAL_CALL XSecParser::setDocumentLocator( const cssu::Reference< cssxs::XLoc
  * XInitialization
  */
 void SAL_CALL XSecParser::initialize(
-    const cssu::Sequence< cssu::Any >& aArguments )
+    const css::uno::Sequence< css::uno::Any >& aArguments )
 {
     aArguments[0] >>= m_xNextHandler;
 }
diff --git a/xmlsecurity/source/helper/xsecsign.cxx b/xmlsecurity/source/helper/xsecsign.cxx
index 657440b6753b..e7062df56fe5 100644
--- a/xmlsecurity/source/helper/xsecsign.cxx
+++ b/xmlsecurity/source/helper/xsecsign.cxx
@@ -37,10 +37,6 @@
 using namespace css;
 using namespace css::uno;
 using namespace css::graphic;
-namespace cssu = com::sun::star::uno;
-namespace cssl = com::sun::star::lang;
-namespace cssxc = com::sun::star::xml::crypto;
-namespace cssxs = com::sun::star::xml::sax;
 
 /* protected: for signature generation */
 OUString XSecController::createId()
@@ -58,7 +54,7 @@ OUString XSecController::createId()
     return OUString::createFromAscii(str);
 }
 
-cssu::Reference< cssxc::sax::XReferenceResolvedListener > XSecController::prepareSignatureToWrite(
+css::uno::Reference< css::xml::crypto::sax::XReferenceResolvedListener > XSecController::prepareSignatureToWrite(
     InternalSignatureInformation& internalSignatureInfor,
     sal_Int32 nStorageFormat,
     bool bXAdESCompliantIfODF)
@@ -69,13 +65,13 @@ cssu::Reference< cssxc::sax::XReferenceResolvedListener > XSecController::prepar
     sal_Int32 nIdOfSignatureElementCollector;
 
     nIdOfSignatureElementCollector =
-        m_xSAXEventKeeper->addSecurityElementCollector( cssxc::sax::ElementMarkPriority_AFTERMODIFY, true );
+        m_xSAXEventKeeper->addSecurityElementCollector( css::xml::crypto::sax::ElementMarkPriority_AFTERMODIFY, true );
 
     m_xSAXEventKeeper->setSecurityId(nIdOfSignatureElementCollector, nSecurityId);
 
     rtl::Reference<SignatureCreatorImpl> xSignatureCreator(new SignatureCreatorImpl);
 
-    cssu::Sequence<cssu::Any> args(5);
+    css::uno::Sequence<css::uno::Any> args(5);
     args[0] <<= OUString::number(nSecurityId);
     args[1] <<= uno::Reference<xml::crypto::sax::XSecuritySAXEventKeeper>(static_cast<cppu::OWeakObject*>(m_xSAXEventKeeper.get()), uno::UNO_QUERY);
     args[2] <<= OUString::number(nIdOfSignatureElementCollector);
@@ -120,7 +116,7 @@ cssu::Reference< cssxc::sax::XReferenceResolvedListener > XSecController::prepar
     {
         const SignatureReferenceInformation& refInfor = vReferenceInfors[i];
 
-        cssu::Reference< css::io::XInputStream > xInputStream
+        css::uno::Reference< css::io::XInputStream > xInputStream
             = getObjectInputStream( refInfor.ouURI );
 
         if (xInputStream.is())
@@ -131,7 +127,7 @@ cssu::Reference< cssxc::sax::XReferenceResolvedListener > XSecController::prepar
 
     // use sha512 for gpg signing unconditionally
     const sal_Int32 digestID = !internalSignatureInfor.signatureInfor.ouGpgCertificate.isEmpty()?
-        cssxc::DigestID::SHA512 : (bXAdESCompliantIfODF ? cssxc::DigestID::SHA256 : cssxc::DigestID::SHA1);
+        css::xml::crypto::DigestID::SHA512 : (bXAdESCompliantIfODF ? css::xml::crypto::DigestID::SHA256 : css::xml::crypto::DigestID::SHA1);
 
     if (nStorageFormat != embed::StorageFormats::OFOPXML)
     {
@@ -182,7 +178,7 @@ cssu::Reference< cssxc::sax::XReferenceResolvedListener > XSecController::prepar
 void XSecController::signAStream( sal_Int32 securityId, const OUString& uri, bool isBinary, bool bXAdESCompliantIfODF)
 {
     const SignatureReferenceType type = isBinary ? SignatureReferenceType::BINARYSTREAM : SignatureReferenceType::XMLSTREAM;
-    sal_Int32 digestID = bXAdESCompliantIfODF ? cssxc::DigestID::SHA256 : cssxc::DigestID::SHA1;
+    sal_Int32 digestID = bXAdESCompliantIfODF ? css::xml::crypto::DigestID::SHA256 : css::xml::crypto::DigestID::SHA1;
 
     int index = findSignatureInfor( securityId );
 
@@ -196,7 +192,7 @@ void XSecController::signAStream( sal_Int32 securityId, const OUString& uri, boo
     {
         // use sha512 for gpg signing unconditionally
         if (!m_vInternalSignatureInformations[index].signatureInfor.ouGpgCertificate.isEmpty())
-            digestID = cssxc::DigestID::SHA512;
+            digestID = css::xml::crypto::DigestID::SHA512;
         m_vInternalSignatureInformations[index].addReference(type, digestID, uri, -1, OUString());
     }
 }
@@ -351,7 +347,7 @@ void XSecController::setSignatureLineInvalidGraphic(
 }
 
 bool XSecController::WriteSignature(
-    const cssu::Reference<cssxs::XDocumentHandler>& xDocumentHandler,
+    const css::uno::Reference<css::xml::sax::XDocumentHandler>& xDocumentHandler,
     bool bXAdESCompliantIfODF )
 {
     bool rc = false;
@@ -377,7 +373,7 @@ bool XSecController::WriteSignature(
             /*
              * export the signature template
              */
-            cssu::Reference<cssxs::XDocumentHandler> xSEKHandler(static_cast<cppu::OWeakObject*>(m_xSAXEventKeeper.get()),cssu::UNO_QUERY);
+            css::uno::Reference<css::xml::sax::XDocumentHandler> xSEKHandler(static_cast<cppu::OWeakObject*>(m_xSAXEventKeeper.get()),css::uno::UNO_QUERY);
 
             int i;
             int sigNum = m_vInternalSignatureInformations.size();
@@ -398,7 +394,7 @@ bool XSecController::WriteSignature(
 
             rc = true;
         }
-        catch( cssu::Exception& )
+        catch( css::uno::Exception& )
         {
         }
 
@@ -426,7 +422,7 @@ bool XSecController::WriteOOXMLSignature(const uno::Reference<embed::XStorage>&
         try
         {
             // Export the signature template.
-            cssu::Reference<xml::sax::XDocumentHandler> xSEKHandler(static_cast<cppu::OWeakObject*>(m_xSAXEventKeeper.get()), uno::UNO_QUERY);
+            css::uno::Reference<xml::sax::XDocumentHandler> xSEKHandler(static_cast<cppu::OWeakObject*>(m_xSAXEventKeeper.get()), uno::UNO_QUERY);
 
             for (InternalSignatureInformation & rInformation : m_vInternalSignatureInformations)
             {
diff --git a/xmlsecurity/source/helper/xsecverify.cxx b/xmlsecurity/source/helper/xsecverify.cxx
index cc63f2ef3a90..de0f2ea7867d 100644
--- a/xmlsecurity/source/helper/xsecverify.cxx
+++ b/xmlsecurity/source/helper/xsecverify.cxx
@@ -48,13 +48,9 @@
 using namespace css;
 using namespace css::uno;
 using namespace css::beans;
-namespace cssu = com::sun::star::uno;
-namespace cssl = com::sun::star::lang;
-namespace cssxc = com::sun::star::xml::crypto;
-namespace cssxs = com::sun::star::xml::sax;
 
 /* protected: for signature verify */
-cssu::Reference< cssxc::sax::XReferenceResolvedListener > XSecController::prepareSignatureToRead(
+css::uno::Reference< css::xml::crypto::sax::XReferenceResolvedListener > XSecController::prepareSignatureToRead(
     sal_Int32 nSecurityId)
 {
     if ( m_eStatusOfSecurityComponents != InitializationState::INITIALIZED )
@@ -63,10 +59,10 @@ cssu::Reference< cssxc::sax::XReferenceResolvedListener > XSecController::prepar
     }
 
     sal_Int32 nIdOfSignatureElementCollector;
-    cssu::Reference< cssxc::sax::XReferenceResolvedListener > xReferenceResolvedListener;
+    css::uno::Reference< css::xml::crypto::sax::XReferenceResolvedListener > xReferenceResolvedListener;
 
     nIdOfSignatureElementCollector =
-        m_xSAXEventKeeper->addSecurityElementCollector( cssxc::sax::ElementMarkPriority_BEFOREMODIFY, false);
+        m_xSAXEventKeeper->addSecurityElementCollector( css::xml::crypto::sax::ElementMarkPriority_BEFOREMODIFY, false);
 
     m_xSAXEventKeeper->setSecurityId(nIdOfSignatureElementCollector, nSecurityId);
 
@@ -75,9 +71,9 @@ cssu::Reference< cssxc::sax::XReferenceResolvedListener > XSecController::prepar
          */
     xReferenceResolvedListener = new SignatureVerifierImpl;
 
-    cssu::Reference<cssl::XInitialization> xInitialization(xReferenceResolvedListener, cssu::UNO_QUERY);
+    css::uno::Reference<css::lang::XInitialization> xInitialization(xReferenceResolvedListener, css::uno::UNO_QUERY);
 
-    cssu::Sequence<cssu::Any> args(5);
+    css::uno::Sequence<css::uno::Any> args(5);
     args[0] <<= OUString::number(nSecurityId);
     args[1] <<= uno::Reference<xml::crypto::sax::XSecuritySAXEventKeeper>(static_cast<cppu::OWeakObject*>(m_xSAXEventKeeper.get()), uno::UNO_QUERY);
     args[2] <<= OUString::number(nIdOfSignatureElementCollector);
@@ -85,8 +81,8 @@ cssu::Reference< cssxc::sax::XReferenceResolvedListener > XSecController::prepar
     args[4] <<= m_xXMLSignature;
     xInitialization->initialize(args);
 
-    cssu::Reference< cssxc::sax::XSignatureVerifyResultBroadcaster >
-        signatureVerifyResultBroadcaster(xReferenceResolvedListener, cssu::UNO_QUERY);
+    css::uno::Reference< css::xml::crypto::sax::XSignatureVerifyResultBroadcaster >
+        signatureVerifyResultBroadcaster(xReferenceResolvedListener, css::uno::UNO_QUERY);
 
     signatureVerifyResultBroadcaster->addSignatureVerifyResultListener( this );
 
@@ -94,7 +90,7 @@ cssu::Reference< cssxc::sax::XReferenceResolvedListener > XSecController::prepar
         nIdOfSignatureElementCollector,
         xReferenceResolvedListener);
 
-    cssu::Reference<cssxc::sax::XKeyCollector> keyCollector (xReferenceResolvedListener, cssu::UNO_QUERY);
+    css::uno::Reference<css::xml::crypto::sax::XKeyCollector> keyCollector (xReferenceResolvedListener, css::uno::UNO_QUERY);
     keyCollector->setKeyId(0);
 
     return xReferenceResolvedListener;
@@ -102,7 +98,7 @@ cssu::Reference< cssxc::sax::XReferenceResolvedListener > XSecController::prepar
 
 void XSecController::addSignature()
 {
-    cssu::Reference< cssxc::sax::XReferenceResolvedListener > xReferenceResolvedListener = nullptr;
+    css::uno::Reference< css::xml::crypto::sax::XReferenceResolvedListener > xReferenceResolvedListener;
     sal_Int32 nSignatureId = 0;
 
 
@@ -179,13 +175,13 @@ void XSecController::addStreamReference(
             /*
              * get the input stream
              */
-            cssu::Reference< css::io::XInputStream > xObjectInputStream
+        css::uno::Reference< css::io::XInputStream > xObjectInputStream
                 = getObjectInputStream( ouUri );
 
         if ( xObjectInputStream.is() )
         {
-            cssu::Reference<cssxc::XUriBinding> xUriBinding
-                (isi.xReferenceResolvedListener, cssu::UNO_QUERY);
+            css::uno::Reference<css::xml::crypto::XUriBinding> xUriBinding
+                (isi.xReferenceResolvedListener, css::uno::UNO_QUERY);
             xUriBinding->setUriBinding(ouUri, xObjectInputStream);
         }
     }
@@ -221,8 +217,8 @@ void XSecController::setReferenceCount() const
             }
         }
 
-        cssu::Reference<cssxc::sax::XReferenceCollector> xReferenceCollector
-            (isi.xReferenceResolvedListener, cssu::UNO_QUERY);
+        css::uno::Reference<css::xml::crypto::sax::XReferenceCollector> xReferenceCollector
+            (isi.xReferenceResolvedListener, css::uno::UNO_QUERY);
         xReferenceCollector->setReferenceCount( referenceCount );
     }
 }
@@ -467,7 +463,7 @@ void XSecController::collectToVerify( const OUString& referenceId )
      */
     {
         bool bJustChainingOn = false;
-        cssu::Reference< cssxs::XDocumentHandler > xHandler = nullptr;
+        css::uno::Reference< css::xml::sax::XDocumentHandler > xHandler;
 
         int i,j;
         int sigNum = m_vInternalSignatureInformations.size();
@@ -491,10 +487,10 @@ void XSecController::collectToVerify( const OUString& referenceId )
                     }
 
                     sal_Int32 nKeeperId = m_xSAXEventKeeper->addSecurityElementCollector(
-                        cssxc::sax::ElementMarkPriority_BEFOREMODIFY, false );
+                        css::xml::crypto::sax::ElementMarkPriority_BEFOREMODIFY, false );
 
-                    cssu::Reference<cssxc::sax::XReferenceCollector> xReferenceCollector
-                        ( isi.xReferenceResolvedListener, cssu::UNO_QUERY );
+                    css::uno::Reference<css::xml::crypto::sax::XReferenceCollector> xReferenceCollector
+                        ( isi.xReferenceResolvedListener, css::uno::UNO_QUERY );
 
                     m_xSAXEventKeeper->setSecurityId(nKeeperId, isi.signatureInfor.nSecurityId);
                     m_xSAXEventKeeper->addReferenceResolvedListener( nKeeperId, isi.xReferenceResolvedListener);
@@ -508,7 +504,6 @@ void XSecController::collectToVerify( const OUString& referenceId )
 
         if ( bJustChainingOn )
         {
-            cssu::Reference< cssxs::XDocumentHandler > xSEKHandler(static_cast<cppu::OWeakObject*>(m_xSAXEventKeeper.get()), cssu::UNO_QUERY);
             m_xSAXEventKeeper->setNextHandler(xHandler);
         }
     }
@@ -522,13 +517,13 @@ void XSecController::addSignature( sal_Int32 nSignatureId )
     m_bVerifyCurrentSignature = true;
 }
 
-cssu::Reference< cssxs::XDocumentHandler > const & XSecController::createSignatureReader(XMLSignatureHelper& rXMLSignatureHelper, sal_Int32 nType)
+css::uno::Reference< css::xml::sax::XDocumentHandler > const & XSecController::createSignatureReader(XMLSignatureHelper& rXMLSignatureHelper, sal_Int32 nType)
 {
     if (nType == embed::StorageFormats::OFOPXML)
         m_xSecParser = new OOXMLSecParser(rXMLSignatureHelper, this);
     else
         m_xSecParser = new XSecParser(rXMLSignatureHelper, this);
-    cssu::Reference< cssl::XInitialization > xInitialization(m_xSecParser, uno::UNO_QUERY);
+    css::uno::Reference< css::lang::XInitialization > xInitialization(m_xSecParser, uno::UNO_QUERY);
 
     setSAXChainConnector(xInitialization);
 


More information about the Libreoffice-commits mailing list