diff options
Diffstat (limited to 'xmlsecurity/source/helper/xsecctl.cxx')
-rw-r--r-- | xmlsecurity/source/helper/xsecctl.cxx | 120 |
1 files changed, 58 insertions, 62 deletions
diff --git a/xmlsecurity/source/helper/xsecctl.cxx b/xmlsecurity/source/helper/xsecctl.cxx index f1cbbfd7c0a3..97bfd73637fe 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" ); |