summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-09-21 08:21:35 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-09-21 11:43:52 +0200
commit1cfcbf3573206c2e9c435f276ba8d7431c75665c (patch)
tree418424b605b4460818c6917a393de4a581e2d4b2 /xmlsecurity
parent33725d5be1b2d4d4c34fa40070fd8e99de600473 (diff)
xmlsecurity: hold SignatureCreatorImpl by rtl::Reference
Not going via UNO means explicit interface casting can be avoided. Change-Id: I4fa2db810cade787913bca222530405d8d2eb6a9 Reviewed-on: https://gerrit.libreoffice.org/42573 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/inc/framework/securityengine.hxx4
-rw-r--r--xmlsecurity/source/helper/xsecsign.cxx47
2 files changed, 17 insertions, 34 deletions
diff --git a/xmlsecurity/inc/framework/securityengine.hxx b/xmlsecurity/inc/framework/securityengine.hxx
index b0cb842d5e56..b0d0a361324e 100644
--- a/xmlsecurity/inc/framework/securityengine.hxx
+++ b/xmlsecurity/inc/framework/securityengine.hxx
@@ -29,7 +29,9 @@
#include <cppuhelper/implbase.hxx>
-class SAL_DLLPUBLIC_RTTI SecurityEngine : public cppu::WeakImplHelper
+#include <xsecfwdllapi.h>
+
+class XSECFW_DLLPUBLIC SecurityEngine : public cppu::WeakImplHelper
<
css::xml::crypto::sax::XReferenceResolvedListener,
css::xml::crypto::sax::XKeyCollector,
diff --git a/xmlsecurity/source/helper/xsecsign.cxx b/xmlsecurity/source/helper/xsecsign.cxx
index cd173e2fb956..f55c57910443 100644
--- a/xmlsecurity/source/helper/xsecsign.cxx
+++ b/xmlsecurity/source/helper/xsecsign.cxx
@@ -20,7 +20,6 @@
#include "xsecctl.hxx"
-#include <com/sun/star/xml/crypto/sax/XKeyCollector.hpp>
#include <com/sun/star/xml/crypto/sax/ElementMarkPriority.hpp>
#include <com/sun/star/xml/crypto/sax/XReferenceResolvedBroadcaster.hpp>
#include <com/sun/star/xml/crypto/sax/XBlockerMonitor.hpp>
@@ -70,9 +69,7 @@ cssu::Reference< cssxc::sax::XReferenceResolvedListener > XSecController::prepar
m_xSAXEventKeeper->setSecurityId(nIdOfSignatureElementCollector, nSecurityId);
- uno::Reference<xml::crypto::sax::XReferenceResolvedListener> xReferenceResolvedListener(new SignatureCreatorImpl);
-
- cssu::Reference<cssl::XInitialization> xInitialization(xReferenceResolvedListener, cssu::UNO_QUERY);
+ rtl::Reference<SignatureCreatorImpl> xSignatureCreator(new SignatureCreatorImpl);
cssu::Sequence<cssu::Any> args(5);
args[0] <<= OUString::number(nSecurityId);
@@ -83,52 +80,39 @@ cssu::Reference< cssxc::sax::XReferenceResolvedListener > XSecController::prepar
args[3] <<= m_xSecurityContext->getSecurityEnvironment();
args[4] <<= m_xXMLSignature;
- xInitialization->initialize(args);
+ xSignatureCreator->initialize(args);
sal_Int32 nBlockerId = m_xSAXEventKeeper->addBlocker();
m_xSAXEventKeeper->setSecurityId(nBlockerId, nSecurityId);
- cssu::Reference<cssxc::sax::XBlockerMonitor> xBlockerMonitor(xReferenceResolvedListener, cssu::UNO_QUERY);
- xBlockerMonitor->setBlockerId(nBlockerId);
-
- cssu::Reference< cssxc::sax::XSignatureCreationResultBroadcaster >
- xSignatureCreationResultBroadcaster(xReferenceResolvedListener, cssu::UNO_QUERY);
-
- xSignatureCreationResultBroadcaster->addSignatureCreationResultListener( this );
+ xSignatureCreator->setBlockerId(nBlockerId);
- m_xSAXEventKeeper->addReferenceResolvedListener(
- nIdOfSignatureElementCollector,
- xReferenceResolvedListener);
+ xSignatureCreator->addSignatureCreationResultListener(this);
- cssu::Reference<cssxc::sax::XReferenceCollector> xReferenceCollector
- (xReferenceResolvedListener, cssu::UNO_QUERY);
+ m_xSAXEventKeeper->addReferenceResolvedListener(nIdOfSignatureElementCollector, xSignatureCreator.get());
- int i;
int size = vReferenceInfors.size();
sal_Int32 nReferenceCount = 0;
- for(i=0; i<size; ++i)
+ for(int i=0; i<size; ++i)
{
sal_Int32 keeperId = internalSignatureInfor.vKeeperIds[i];
if ( keeperId != -1)
{
m_xSAXEventKeeper->setSecurityId(keeperId, nSecurityId);
- m_xSAXEventKeeper->addReferenceResolvedListener( keeperId, xReferenceResolvedListener);
- xReferenceCollector->setReferenceId( keeperId );
+ m_xSAXEventKeeper->addReferenceResolvedListener( keeperId, xSignatureCreator.get());
+ xSignatureCreator->setReferenceId( keeperId );
nReferenceCount++;
}
}
- xReferenceCollector->setReferenceCount( nReferenceCount );
+ xSignatureCreator->setReferenceCount( nReferenceCount );
/*
* adds all URI binding
*/
- cssu::Reference<cssxc::XUriBinding> xUriBinding
- (xReferenceResolvedListener, cssu::UNO_QUERY);
-
- for(i=0; i<size; ++i)
+ for(int i=0; i<size; ++i)
{
const SignatureReferenceInformation& refInfor = vReferenceInfors[i];
@@ -136,13 +120,10 @@ cssu::Reference< cssxc::sax::XReferenceResolvedListener > XSecController::prepar
= getObjectInputStream( refInfor.ouURI );
if (xInputStream.is())
- {
- xUriBinding->setUriBinding(refInfor.ouURI,xInputStream);
- }
+ xSignatureCreator->setUriBinding(refInfor.ouURI,xInputStream);
}
- cssu::Reference<cssxc::sax::XKeyCollector> keyCollector (xReferenceResolvedListener, cssu::UNO_QUERY);
- keyCollector->setKeyId(0);
+ xSignatureCreator->setKeyId(0);
// use sha512 for gpg signing unconditionally
const sal_Int32 digestID = !internalSignatureInfor.signatureInfor.ouGpgCertificate.isEmpty()?
@@ -182,7 +163,7 @@ cssu::Reference< cssxc::sax::XReferenceResolvedListener > XSecController::prepar
/*
* replace both digestValues and signatureValue to " "
*/
- for(i=0; i<size; ++i)
+ for(int i=0; i<size; ++i)
{
SignatureReferenceInformation& refInfor = vReferenceInfors[i];
refInfor.ouDigestValue = " ";
@@ -190,7 +171,7 @@ cssu::Reference< cssxc::sax::XReferenceResolvedListener > XSecController::prepar
internalSignatureInfor.signatureInfor.ouSignatureValue = " ";
- return xReferenceResolvedListener;
+ return xSignatureCreator.get();
}
void XSecController::signAStream( sal_Int32 securityId, const OUString& uri, bool isBinary, bool bXAdESCompliantIfODF)