From 83e028ae46d73afa24e0c963619d3798d208a6ce Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 12 May 2020 16:17:25 +0200 Subject: expand out some namespace aliases [xmlsecurity/source/helper] Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94093 Tested-by: Jenkins Reviewed-by: Noel Grandin (cherry picked from commit 943fbfad668da76f7d0ebd4f4d8cdd67224d2f01) plus one line in xsecverify.cxx from: commit f59d9e7ea09482c2e9e5f52a8d0445e4cebc3df5 Author: Noel Grandin 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/+/113052 Tested-by: Michael Stahl Reviewed-by: Michael Stahl --- 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(-) diff --git a/xmlsecurity/source/helper/xsecctl.cxx b/xmlsecurity/source/helper/xsecctl.cxx index 5fdc45c2c8c0..916e47f9b017 100644 --- a/xmlsecurity/source/helper/xsecctl.cxx +++ b/xmlsecurity/source/helper/xsecctl.cxx @@ -46,10 +46,6 @@ #include "ooxmlsecexporter.hxx" #include -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& rxCtx ) +XSecController::XSecController( const css::uno::Reference& 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 arg(1); + css::uno::Sequence arg(1); arg[0] <<= uno::Reference(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(m_xSAXEventKeeper.get()), cssu::UNO_QUERY); + css::uno::Reference< css::xml::sax::XDocumentHandler > xSEKHandler(static_cast(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 aArgs( 1 ); + css::uno::Sequence 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 aArgs( 1 ); + css::uno::Sequence aArgs( 1 ); aArgs[0] <<= uno::Reference(); 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()); } } @@ -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& xUriBinding, const cssu::Reference< cssxc::XXMLSecurityContext >& xSecurityContext ) +void XSecController::startMission(const rtl::Reference& xUriBinding, const css::uno::Reference< css::xml::crypto::XXMLSecurityContext >& xSecurityContext ) /****** XSecController/startMission ******************************************* * * NAME @@ -461,7 +457,7 @@ void XSecController::startMission(const rtl::Reference& 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& xDocumentHandler, + const css::uno::Reference& 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 532ba07a0298..70c3c165612c 100644 --- a/xmlsecurity/source/helper/xsecparser.cxx +++ b/xmlsecurity/source/helper/xsecparser.cxx @@ -26,9 +26,6 @@ #include -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) @@ -50,12 +47,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"); @@ -99,7 +96,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 { @@ -159,11 +156,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; } @@ -286,18 +283,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()); } } @@ -410,18 +407,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()); } } @@ -514,7 +511,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()) { @@ -526,7 +523,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 d8089b1773b3..f1cebe5589d0 100644 --- a/xmlsecurity/source/helper/xsecsign.cxx +++ b/xmlsecurity/source/helper/xsecsign.cxx @@ -38,10 +38,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() @@ -59,7 +55,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) @@ -70,13 +66,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 xSignatureCreator(new SignatureCreatorImpl); - cssu::Sequence args(5); + css::uno::Sequence args(5); args[0] <<= OUString::number(nSecurityId); args[1] <<= uno::Reference(static_cast(m_xSAXEventKeeper.get()), uno::UNO_QUERY); args[2] <<= OUString::number(nIdOfSignatureElementCollector); @@ -121,7 +117,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()) @@ -132,7 +128,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) { @@ -183,7 +179,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 ); @@ -197,7 +193,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()); } } @@ -352,7 +348,7 @@ void XSecController::setSignatureLineInvalidGraphic( } bool XSecController::WriteSignature( - const cssu::Reference& xDocumentHandler, + const css::uno::Reference& xDocumentHandler, bool bXAdESCompliantIfODF ) { bool rc = false; @@ -378,7 +374,7 @@ bool XSecController::WriteSignature( /* * export the signature template */ - cssu::Reference xSEKHandler(static_cast(m_xSAXEventKeeper.get()),cssu::UNO_QUERY); + css::uno::Reference xSEKHandler(static_cast(m_xSAXEventKeeper.get()),css::uno::UNO_QUERY); int i; int sigNum = m_vInternalSignatureInformations.size(); @@ -399,7 +395,7 @@ bool XSecController::WriteSignature( rc = true; } - catch( cssu::Exception& ) + catch( css::uno::Exception& ) { } @@ -427,7 +423,7 @@ bool XSecController::WriteOOXMLSignature(const uno::Reference& try { // Export the signature template. - cssu::Reference xSEKHandler(static_cast(m_xSAXEventKeeper.get()), uno::UNO_QUERY); + css::uno::Reference xSEKHandler(static_cast(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 305e5aa28128..9d7bc84f3d19 100644 --- a/xmlsecurity/source/helper/xsecverify.cxx +++ b/xmlsecurity/source/helper/xsecverify.cxx @@ -47,13 +47,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 ) @@ -62,10 +58,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); @@ -74,9 +70,9 @@ cssu::Reference< cssxc::sax::XReferenceResolvedListener > XSecController::prepar */ xReferenceResolvedListener = new SignatureVerifierImpl; - cssu::Reference xInitialization(xReferenceResolvedListener, cssu::UNO_QUERY); + css::uno::Reference xInitialization(xReferenceResolvedListener, css::uno::UNO_QUERY); - cssu::Sequence args(5); + css::uno::Sequence args(5); args[0] <<= OUString::number(nSecurityId); args[1] <<= uno::Reference(static_cast(m_xSAXEventKeeper.get()), uno::UNO_QUERY); args[2] <<= OUString::number(nIdOfSignatureElementCollector); @@ -84,8 +80,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 ); @@ -93,7 +89,7 @@ cssu::Reference< cssxc::sax::XReferenceResolvedListener > XSecController::prepar nIdOfSignatureElementCollector, xReferenceResolvedListener); - cssu::Reference keyCollector (xReferenceResolvedListener, cssu::UNO_QUERY); + css::uno::Reference keyCollector (xReferenceResolvedListener, css::uno::UNO_QUERY); keyCollector->setKeyId(0); return xReferenceResolvedListener; @@ -101,7 +97,7 @@ cssu::Reference< cssxc::sax::XReferenceResolvedListener > XSecController::prepar void XSecController::addSignature() { - cssu::Reference< cssxc::sax::XReferenceResolvedListener > xReferenceResolvedListener; + css::uno::Reference< css::xml::crypto::sax::XReferenceResolvedListener > xReferenceResolvedListener; sal_Int32 nSignatureId = 0; @@ -178,13 +174,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 xUriBinding - (isi.xReferenceResolvedListener, cssu::UNO_QUERY); + css::uno::Reference xUriBinding + (isi.xReferenceResolvedListener, css::uno::UNO_QUERY); xUriBinding->setUriBinding(ouUri, xObjectInputStream); } } @@ -220,8 +216,8 @@ void XSecController::setReferenceCount() const } } - cssu::Reference xReferenceCollector - (isi.xReferenceResolvedListener, cssu::UNO_QUERY); + css::uno::Reference xReferenceCollector + (isi.xReferenceResolvedListener, css::uno::UNO_QUERY); xReferenceCollector->setReferenceCount( referenceCount ); } } @@ -466,7 +462,7 @@ void XSecController::collectToVerify( const OUString& referenceId ) */ { bool bJustChainingOn = false; - cssu::Reference< cssxs::XDocumentHandler > xHandler; + css::uno::Reference< css::xml::sax::XDocumentHandler > xHandler; int i,j; int sigNum = m_vInternalSignatureInformations.size(); @@ -490,10 +486,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 xReferenceCollector - ( isi.xReferenceResolvedListener, cssu::UNO_QUERY ); + css::uno::Reference xReferenceCollector + ( isi.xReferenceResolvedListener, css::uno::UNO_QUERY ); m_xSAXEventKeeper->setSecurityId(nKeeperId, isi.signatureInfor.nSecurityId); m_xSAXEventKeeper->addReferenceResolvedListener( nKeeperId, isi.xReferenceResolvedListener); @@ -507,7 +503,6 @@ void XSecController::collectToVerify( const OUString& referenceId ) if ( bJustChainingOn ) { - cssu::Reference< cssxs::XDocumentHandler > xSEKHandler(static_cast(m_xSAXEventKeeper.get()), cssu::UNO_QUERY); m_xSAXEventKeeper->setNextHandler(xHandler); } } @@ -521,13 +516,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); -- cgit