xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx |   13 
++--------
 xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx |    7 
-----
 xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx       |    3 --
 xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx     |    3 --
 xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx     |    5 
---
 xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx        |    6 
+---
 6 files changed, 7 insertions(+), 30 deletions(-)

New commits:
commit 1fd4e669a99225459fc3b5bf082487c2644ce691
Author:     Noel Grandin <noelgran...@collabora.co.uk>
AuthorDate: Fri Jan 13 15:30:14 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Jan 13 15:52:33 2023 +0000

    XUnoTunnel->dynamic_cast in X509Certificate_MSCryptImpl
    
    Change-Id: If61114df98f4096798281a28ffcdf58168ff7fdc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145475
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git 
a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
index cad73681efff..68b29fd2d3c7 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
@@ -584,8 +584,7 @@ uno::Sequence< uno::Reference < XCertificate > > 
SecurityEnvironment_MSCryptImpl
     chainPara.cbSize = sizeof( CERT_CHAIN_PARA ) ;
     chainPara.RequestedUsage = certUsage ;
 
-    uno::Reference< XUnoTunnel > xCertTunnel( begin, uno::UNO_QUERY_THROW ) ;
-    const auto* xcert = 
comphelper::getFromUnoTunnel<X509Certificate_MSCryptImpl>(xCertTunnel);
+    const auto* xcert = 
dynamic_cast<X509Certificate_MSCryptImpl*>(begin.get());
     if( xcert == nullptr ) {
         throw uno::RuntimeException() ;
     }
@@ -805,11 +804,9 @@ sal_Int32 
SecurityEnvironment_MSCryptImpl::verifyCertificate(
     PCCERT_CHAIN_CONTEXT pChainContext = nullptr;
     PCCERT_CONTEXT pCertContext = nullptr;
 
-    uno::Reference< XUnoTunnel > xCertTunnel( aCert, uno::UNO_QUERY_THROW ) ;
-
     SAL_INFO("xmlsecurity.xmlsec", "Start verification of certificate: " << 
aCert->getSubjectName());
 
-    const auto* xcert = 
comphelper::getFromUnoTunnel<X509Certificate_MSCryptImpl>(xCertTunnel);
+    const auto* xcert = 
dynamic_cast<X509Certificate_MSCryptImpl*>(aCert.get());
     if( xcert == nullptr ) {
         throw uno::RuntimeException() ;
     }
@@ -973,8 +970,7 @@ sal_Int32 
SecurityEnvironment_MSCryptImpl::getCertificateCharacters( const css::
     sal_Int32 characters ;
     PCCERT_CONTEXT pCertContext ;
 
-    uno::Reference< XUnoTunnel > xCertTunnel( aCert, uno::UNO_QUERY_THROW ) ;
-    const auto* xcert = 
comphelper::getFromUnoTunnel<X509Certificate_MSCryptImpl>(xCertTunnel);
+    const auto* xcert = 
dynamic_cast<X509Certificate_MSCryptImpl*>(aCert.get());
     if( xcert == nullptr ) {
         throw uno::RuntimeException() ;
     }
diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
index 88bf6169bf11..9c671d0c21c0 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
@@ -457,9 +457,6 @@ void X509Certificate_MSCryptImpl::setRawCert( Sequence< 
sal_Int8 > const & rawCe
     }
 }
 
-/* XUnoTunnel */
-UNO3_GETIMPLEMENTATION_IMPL(X509Certificate_MSCryptImpl);
-
 static OUString findOIDDescription(char const *oid)
 {
     OUString ouOID = OUString::createFromAscii( oid );
diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx 
b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx
index 9bd6a34ce68e..ba02281794f6 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx
@@ -30,7 +30,6 @@
 #include <cppuhelper/implbase.hxx>
 #include <comphelper/servicehelper.hxx>
 #include <com/sun/star/uno/Exception.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/uno/SecurityException.hpp>
 #include <com/sun/star/security/CertificateKind.hpp>
@@ -39,7 +38,6 @@
 
 class X509Certificate_MSCryptImpl : public ::cppu::WeakImplHelper<
     css::security::XCertificate ,
-    css::lang::XUnoTunnel,
     css::lang::XServiceInfo > , public xmlsecurity::Certificate
 {
     private:
@@ -72,9 +70,6 @@ class X509Certificate_MSCryptImpl : public 
::cppu::WeakImplHelper<
 
         virtual sal_Int32 SAL_CALL getCertificateUsage( ) override;
 
-        //Methods from XUnoTunnel
-        UNO3_GETIMPLEMENTATION_DECL(X509Certificate_MSCryptImpl)
-
         /// @see xmlsecurity::Certificate::getSHA256Thumbprint().
         virtual css::uno::Sequence<sal_Int8> getSHA256Thumbprint() override;
 
commit 817dc69bb6c96f7494510cd45262aae677323a47
Author:     Noel Grandin <noelgran...@collabora.co.uk>
AuthorDate: Fri Jan 13 15:27:02 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Jan 13 15:52:25 2023 +0000

    XUnoTunnel->dynamic_cast in SecurityEnvironment_MSCryptImpl
    
    Change-Id: Idb013bd71b2a90cd6fb8927b199eb36e9bfd9c06
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145474
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git 
a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
index a9e58a33c746..cad73681efff 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
@@ -174,9 +174,6 @@ uno::Sequence< OUString > SAL_CALL 
SecurityEnvironment_MSCryptImpl::getSupported
     return { "com.sun.star.xml.crypto.SecurityEnvironment" };
 }
 
-/* XUnoTunnel */
-UNO3_GETIMPLEMENTATION_IMPL(SecurityEnvironment_MSCryptImpl);
-
 HCRYPTPROV SecurityEnvironment_MSCryptImpl::getCryptoProvider() {
     return m_hProv ;
 }
diff --git 
a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx 
b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx
index a4ae45742b98..5867b2b46281 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx
@@ -39,7 +39,6 @@
 #include <com/sun/star/security/XCertificate.hpp>
 #include <com/sun/star/security/CertificateCharacters.hpp>
 #include <com/sun/star/security/CertificateValidity.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
 
 #include <vector>
 #include <xmlsec-wrapper.h>
@@ -49,8 +48,7 @@
 
 class SecurityEnvironment_MSCryptImpl : public ::cppu::WeakImplHelper<
     css::xml::crypto::XSecurityEnvironment ,
-    css::lang::XServiceInfo,
-    css::lang::XUnoTunnel >
+    css::lang::XServiceInfo >
 {
     private:
         //crypto provider and key container
@@ -123,9 +121,6 @@ class SecurityEnvironment_MSCryptImpl : public 
::cppu::WeakImplHelper<
 
         virtual css::uno::Sequence< OUString > SAL_CALL 
getSupportedServiceNames() override;
 
-        //Methods from XUnoTunnel
-        UNO3_GETIMPLEMENTATION_DECL(SecurityEnvironment_MSCryptImpl)
-
         /// @throws css::uno::Exception
         /// @throws css::uno::RuntimeException
         HCRYPTPROV getCryptoProvider() ;
diff --git a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx
index 08143f992379..d4eb48f877cd 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx
@@ -78,8 +78,7 @@ uno::Reference< cssxc::XXMLSecurityContext > SAL_CALL
         uno::Reference< cssxc::XSecurityEnvironment > xSecEnv = 
cssxc::SecurityEnvironment::create( mxContext );
 
         /* Setup key slot and certDb */
-        uno::Reference< cssl::XUnoTunnel > xSecEnvTunnel( xSecEnv, 
uno::UNO_QUERY_THROW );
-        SecurityEnvironment_MSCryptImpl* pSecEnv = 
comphelper::getFromUnoTunnel<SecurityEnvironment_MSCryptImpl>(xSecEnvTunnel);
+        SecurityEnvironment_MSCryptImpl* pSecEnv = 
dynamic_cast<SecurityEnvironment_MSCryptImpl*>(xSecEnv.get());
         if( pSecEnv == nullptr )
         {
             if( n_hStoreHandle != nullptr )
diff --git a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx
index 87af0f040866..23833e71106b 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx
@@ -102,8 +102,7 @@ SAL_CALL XMLSignature_MSCryptImpl::generate(
         throw RuntimeException() ;
 
     //Get Keys Manager
-    Reference< XUnoTunnel > xSecTunnel( aEnvironment , UNO_QUERY_THROW ) ;
-    SecurityEnvironment_MSCryptImpl* pSecEnv = 
comphelper::getFromUnoTunnel<SecurityEnvironment_MSCryptImpl>(xSecTunnel);
+    SecurityEnvironment_MSCryptImpl* pSecEnv = 
dynamic_cast<SecurityEnvironment_MSCryptImpl*>(aEnvironment.get());
     if( pSecEnv == nullptr )
         throw RuntimeException() ;
 
@@ -191,8 +190,7 @@ SAL_CALL XMLSignature_MSCryptImpl::validate(
     Reference< XSecurityEnvironment > xSecEnv
         = aSecurityCtx->getSecurityEnvironmentByIndex(
             aSecurityCtx->getDefaultSecurityEnvironmentIndex());
-    Reference< XUnoTunnel > xSecTunnel( xSecEnv , UNO_QUERY_THROW ) ;
-    SecurityEnvironment_MSCryptImpl* pSecEnv = 
comphelper::getFromUnoTunnel<SecurityEnvironment_MSCryptImpl>(xSecTunnel);
+    SecurityEnvironment_MSCryptImpl* pSecEnv = 
dynamic_cast<SecurityEnvironment_MSCryptImpl*>(xSecEnv.get());
     if( pSecEnv == nullptr )
         throw RuntimeException() ;
 

Reply via email to