diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-01-13 08:30:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-01-14 07:29:12 +0000 |
commit | 08cae41f6f8cb8f9f592c0735d1285c0575d6e49 (patch) | |
tree | 2bb9fbb7ae0fdfd8ce61c6d5bffa28b6ad9341ac /xmlsecurity | |
parent | d66d1f6fd47b02076945c09c0d6f8f019d0501d5 (diff) |
XUnoTunnel->dynamic_cast in X509Certificate_NssImpl
Change-Id: I027e8bcee4f9e2b7bafd2ddf9070b6a28bcded37
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145496
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmlsecurity')
3 files changed, 4 insertions, 26 deletions
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx index d130c03723e9..2add74631001 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx @@ -361,8 +361,7 @@ Sequence< Reference < XCertificate > > SecurityEnvironment_NssImpl::buildCertifi // Remember the signing certificate. m_xSigningCertificate = begin; - Reference< XUnoTunnel > xCertTunnel( begin, UNO_QUERY_THROW ) ; - const X509Certificate_NssImpl* xcert = comphelper::getFromUnoTunnel<X509Certificate_NssImpl>(xCertTunnel); + const X509Certificate_NssImpl* xcert = dynamic_cast<X509Certificate_NssImpl*>(begin.get()); if( xcert == nullptr ) { throw RuntimeException() ; } @@ -495,11 +494,10 @@ verifyCertificate( const Reference< csss::XCertificate >& aCert, { sal_Int32 validity = csss::CertificateValidity::INVALID; const CERTCertificate* cert ; - Reference< XUnoTunnel > xCertTunnel( aCert, UNO_QUERY_THROW ) ; SAL_INFO("xmlsecurity.xmlsec", "Start verification of certificate: " << aCert->getSubjectName()); - const X509Certificate_NssImpl* xcert = comphelper::getFromUnoTunnel<X509Certificate_NssImpl>(xCertTunnel); + const X509Certificate_NssImpl* xcert = dynamic_cast<X509Certificate_NssImpl*>(aCert.get()); if( xcert == nullptr ) { throw RuntimeException() ; } @@ -711,8 +709,7 @@ sal_Int32 SecurityEnvironment_NssImpl::getCertificateCharacters( sal_Int32 characters ; const CERTCertificate* cert ; - Reference< XUnoTunnel > xCertTunnel( aCert, UNO_QUERY_THROW ) ; - const X509Certificate_NssImpl* xcert = comphelper::getFromUnoTunnel<X509Certificate_NssImpl>(xCertTunnel); + const X509Certificate_NssImpl* xcert = dynamic_cast<X509Certificate_NssImpl*>(aCert.get()); if( xcert == nullptr ) { throw RuntimeException() ; } @@ -814,7 +811,7 @@ xmlSecKeysMngrPtr SecurityEnvironment_NssImpl::createKeysManager() { // Adopt the private key of the signing certificate, if it has any. if (auto pCertificate - = comphelper::getFromUnoTunnel<X509Certificate_NssImpl>(m_xSigningCertificate)) + = dynamic_cast<X509Certificate_NssImpl*>(m_xSigningCertificate.get())) { SECKEYPrivateKey* pPrivateKey = SECKEY_CopyPrivateKey(pCertificate->getPrivateKey()); if (pPrivateKey) diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx index 79441da1edf5..4997a482728e 100644 --- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx @@ -332,18 +332,6 @@ SECKEYPrivateKey* X509Certificate_NssImpl::getPrivateKey() return nullptr; } -/* XUnoTunnel */ -sal_Int64 SAL_CALL X509Certificate_NssImpl::getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) { - return comphelper::getSomethingImpl(aIdentifier, this); -} - -/* XUnoTunnel extension */ - -const css::uno::Sequence< sal_Int8>& X509Certificate_NssImpl::getUnoTunnelId() { - static const comphelper::UnoIdInit theX509Certificate_NssImplUnoTunnelId; - return theX509Certificate_NssImplUnoTunnelId.getSeq(); -} - static OUString getAlgorithmDescription(SECAlgorithmID const *aid) { SECOidTag tag; diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx index dbfb6c6b07ed..9ad50f12ba0f 100644 --- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx +++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx @@ -22,7 +22,6 @@ #include <sal/config.h> #include <rtl/ustring.hxx> #include <cppuhelper/implbase.hxx> -#include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/security/CertificateKind.hpp> #include <com/sun/star/security/XCertificate.hpp> @@ -33,7 +32,6 @@ class X509Certificate_NssImpl : public ::cppu::WeakImplHelper< css::security::XCertificate , - css::lang::XUnoTunnel, css::lang::XServiceInfo > , public xmlsecurity::Certificate { private: @@ -76,17 +74,12 @@ class X509Certificate_NssImpl : public ::cppu::WeakImplHelper< virtual sal_Int32 SAL_CALL getCertificateUsage( ) override ; - //Methods from XUnoTunnel - virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; - /// @see xmlsecurity::Certificate::getSHA256Thumbprint(). virtual css::uno::Sequence<sal_Int8> getSHA256Thumbprint() override; /// @see xmlsecurity::Certificate::getSignatureMethodAlgorithm(). virtual svl::crypto::SignatureMethodAlgorithm getSignatureMethodAlgorithm() override; - static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId() ; - //Helper methods void setCert( CERTCertificate* cert ) ; const CERTCertificate* getNssCert() const ; |