diff options
Diffstat (limited to 'xmlsecurity')
-rw-r--r-- | xmlsecurity/Library_xsec_xmlsec.mk | 1 | ||||
-rw-r--r-- | xmlsecurity/inc/certificate.hxx | 15 | ||||
-rw-r--r-- | xmlsecurity/inc/framework/signatureverifierimpl.hxx | 7 | ||||
-rw-r--r-- | xmlsecurity/qa/unit/signing/signing.cxx | 3 | ||||
-rw-r--r-- | xmlsecurity/source/component/documentdigitalsignatures.cxx | 11 | ||||
-rw-r--r-- | xmlsecurity/source/framework/signatureverifierimpl.cxx | 10 | ||||
-rw-r--r-- | xmlsecurity/source/gpg/CertificateImpl.cxx | 3 | ||||
-rw-r--r-- | xmlsecurity/source/gpg/CertificateImpl.hxx | 9 | ||||
-rw-r--r-- | xmlsecurity/source/helper/documentsignaturemanager.cxx | 5 | ||||
-rw-r--r-- | xmlsecurity/source/helper/xsecverify.cxx | 5 | ||||
-rw-r--r-- | xmlsecurity/source/xmlsec/certificate.cxx | 27 | ||||
-rw-r--r-- | xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx | 2 | ||||
-rw-r--r-- | xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx | 9 | ||||
-rw-r--r-- | xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx | 3 | ||||
-rw-r--r-- | xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx | 9 |
15 files changed, 40 insertions, 79 deletions
diff --git a/xmlsecurity/Library_xsec_xmlsec.mk b/xmlsecurity/Library_xsec_xmlsec.mk index 23997aa2bfae..615c3eba0032 100644 --- a/xmlsecurity/Library_xsec_xmlsec.mk +++ b/xmlsecurity/Library_xsec_xmlsec.mk @@ -64,7 +64,6 @@ $(eval $(call gb_Library_use_externals,xsec_xmlsec,\ $(eval $(call gb_Library_add_exception_objects,xsec_xmlsec,\ xmlsecurity/source/xmlsec/biginteger \ - xmlsecurity/source/xmlsec/certificate \ xmlsecurity/source/xmlsec/certificateextension_certextn \ xmlsecurity/source/xmlsec/errorcallback \ xmlsecurity/source/xmlsec/saxhelper \ diff --git a/xmlsecurity/inc/certificate.hxx b/xmlsecurity/inc/certificate.hxx index 885fcc8bd5ff..8357f50651a1 100644 --- a/xmlsecurity/inc/certificate.hxx +++ b/xmlsecurity/inc/certificate.hxx @@ -11,13 +11,7 @@ #include <sal/types.h> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XUnoTunnel.hpp> -#include <com/sun/star/security/XCertificate.hpp> #include <com/sun/star/uno/Sequence.hxx> -#include <cppuhelper/implbase.hxx> - -#include "xsecxmlsecdllapi.h" namespace svl { @@ -29,10 +23,8 @@ enum class SignatureMethodAlgorithm; namespace xmlsecurity { -/// Base class of css::security::XCertificate implementations, for module-internal purposes. -class XSECXMLSEC_DLLPUBLIC Certificate - : public ::cppu::WeakImplHelper<css::security::XCertificate, css::lang::XUnoTunnel, - css::lang::XServiceInfo> +/// Extension of css::security::XCertificate for module-internal purposes. +class SAL_NO_VTABLE SAL_DLLPUBLIC_RTTI SAL_LOPLUGIN_ANNOTATE("crosscast") Certificate { public: /// Returns the SHA-256 thumbprint. @@ -43,9 +35,6 @@ public: /// Same as getSubjectPublicKeyAlgorithm(), but returns an ID, not a string. virtual svl::crypto::SignatureMethodAlgorithm getSignatureMethodAlgorithm() = 0; - sal_Int64 SAL_CALL getSomething(css::uno::Sequence<sal_Int8> const& aIdentifier) override; - static css::uno::Sequence<sal_Int8> const& getUnoTunnelId(); - protected: ~Certificate() noexcept = default; }; diff --git a/xmlsecurity/inc/framework/signatureverifierimpl.hxx b/xmlsecurity/inc/framework/signatureverifierimpl.hxx index 29d286d7ee57..15c79643e0aa 100644 --- a/xmlsecurity/inc/framework/signatureverifierimpl.hxx +++ b/xmlsecurity/inc/framework/signatureverifierimpl.hxx @@ -22,7 +22,6 @@ #include <com/sun/star/xml/crypto/sax/XSignatureVerifyResultBroadcaster.hpp> #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XUnoTunnel.hpp> #include <cppuhelper/implbase.hxx> #include <xmlsecuritydllapi.h> @@ -36,8 +35,7 @@ typedef cppu::ImplInheritanceHelper SignatureEngine, css::xml::crypto::sax::XSignatureVerifyResultBroadcaster, css::lang::XInitialization, - css::lang::XServiceInfo, - css::lang::XUnoTunnel + css::lang::XServiceInfo > SignatureVerifierImpl_Base; class SignatureVerifierImpl final : public SignatureVerifierImpl_Base @@ -76,9 +74,6 @@ public: virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; - sal_Int64 SAL_CALL getSomething(css::uno::Sequence<sal_Int8> const & aIdentifier) override; - static css::uno::Sequence<sal_Int8> const & getUnoTunnelId(); - void updateSignature( const css::uno::Reference< css::xml::crypto::XXMLSignature >& xSignature, const css::uno::Reference< css::xml::crypto::XXMLSecurityContext >& xContext ) { m_xXMLSignature = xSignature; m_xXMLSecurityContext = xContext; } }; diff --git a/xmlsecurity/qa/unit/signing/signing.cxx b/xmlsecurity/qa/unit/signing/signing.cxx index d75c93de1a4a..d8518ece0f9b 100644 --- a/xmlsecurity/qa/unit/signing/signing.cxx +++ b/xmlsecurity/qa/unit/signing/signing.cxx @@ -33,7 +33,6 @@ #include <comphelper/processfactory.hxx> #include <comphelper/propertysequence.hxx> -#include <comphelper/servicehelper.hxx> #include <unotools/mediadescriptor.hxx> #include <unotools/tempfile.hxx> #include <unotools/ucbstreamhelper.hxx> @@ -128,7 +127,7 @@ SigningTest::getCertificate(DocumentSignatureManager& rSignatureManager, for (const auto& xCertificate : aCertificates) { - auto pCertificate = comphelper::getFromUnoTunnel<xmlsecurity::Certificate>(xCertificate); + auto pCertificate = dynamic_cast<xmlsecurity::Certificate*>(xCertificate.get()); CPPUNIT_ASSERT(pCertificate); if (pCertificate->getSignatureMethodAlgorithm() == eAlgo && IsValid(xCertificate, xSecurityEnvironment)) diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx index 4ab5851581ee..990fa5dea739 100644 --- a/xmlsecurity/source/component/documentdigitalsignatures.cxx +++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx @@ -52,7 +52,6 @@ #include <comphelper/documentconstants.hxx> #include <comphelper/propertyvalue.hxx> #include <comphelper/sequence.hxx> -#include <comphelper/servicehelper.hxx> #include <cppuhelper/implbase.hxx> #include <comphelper/xmlsechelper.hxx> #include <cppuhelper/supportsservice.hxx> @@ -72,9 +71,9 @@ using namespace css::xml::crypto; namespace { class DocumentDigitalSignatures - : public cppu::ImplInheritanceHelper<sfx2::DigitalSignatures, - css::security::XDocumentDigitalSignatures, - css::lang::XInitialization, css::lang::XServiceInfo> + : public cppu::WeakImplHelper<css::security::XDocumentDigitalSignatures, + css::lang::XInitialization, css::lang::XServiceInfo>, + public sfx2::DigitalSignatures { private: css::uno::Reference<css::uno::XComponentContext> mxCtx; @@ -686,8 +685,8 @@ sal_Bool DocumentDigitalSignatures::isAuthorTrusted( return false; uno::Reference<css::security::XCertificate> xCert = aSignatureManager.getSecurityEnvironment()->createCertificateFromAscii(rAuthor.RawData); - auto pAuthor = comphelper::getFromUnoTunnel<xmlsecurity::Certificate>(xAuthor); - auto pCert = comphelper::getFromUnoTunnel<xmlsecurity::Certificate>(xCert); + auto pAuthor = dynamic_cast<xmlsecurity::Certificate*>(xAuthor.get()); + auto pCert = dynamic_cast<xmlsecurity::Certificate*>(xCert.get()); if (pAuthor && pCert) return pCert->getSHA256Thumbprint() == pAuthor->getSHA256Thumbprint(); diff --git a/xmlsecurity/source/framework/signatureverifierimpl.cxx b/xmlsecurity/source/framework/signatureverifierimpl.cxx index 3489dab31bed..44e9e4c0a46c 100644 --- a/xmlsecurity/source/framework/signatureverifierimpl.cxx +++ b/xmlsecurity/source/framework/signatureverifierimpl.cxx @@ -21,7 +21,6 @@ #include <framework/signatureverifierimpl.hxx> #include <framework/xmlsignaturetemplateimpl.hxx> #include <com/sun/star/xml/crypto/XXMLSignatureTemplate.hpp> -#include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> #include <osl/diagnose.h> #include <rtl/ref.hxx> @@ -128,13 +127,4 @@ css::uno::Sequence< OUString > SAL_CALL SignatureVerifierImpl::getSupportedServi return SignatureVerifierImpl_getSupportedServiceNames(); } -sal_Int64 SignatureVerifierImpl::getSomething(css::uno::Sequence<sal_Int8> const & aIdentifier) { - return comphelper::getSomethingImpl(aIdentifier, this); -} - -css::uno::Sequence<sal_Int8> const & SignatureVerifierImpl::getUnoTunnelId() { - static comphelper::UnoIdInit const id; - return id.getSeq(); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlsecurity/source/gpg/CertificateImpl.cxx b/xmlsecurity/source/gpg/CertificateImpl.cxx index ae2c4544e001..a0a08fc807a8 100644 --- a/xmlsecurity/source/gpg/CertificateImpl.cxx +++ b/xmlsecurity/source/gpg/CertificateImpl.cxx @@ -196,8 +196,7 @@ sal_Int32 SAL_CALL CertificateImpl::getCertificateUsage() /* XUnoTunnel */ sal_Int64 SAL_CALL CertificateImpl::getSomething(const Sequence< sal_Int8 >& aIdentifier) { - return comphelper::getSomethingImpl( - aIdentifier, this, comphelper::FallbackToGetSomethingOf<xmlsecurity::Certificate>{}); + return comphelper::getSomethingImpl(aIdentifier, this); } /* XUnoTunnel extension */ diff --git a/xmlsecurity/source/gpg/CertificateImpl.hxx b/xmlsecurity/source/gpg/CertificateImpl.hxx index 1c845f5dc103..b6c50cb2ed5c 100644 --- a/xmlsecurity/source/gpg/CertificateImpl.hxx +++ b/xmlsecurity/source/gpg/CertificateImpl.hxx @@ -14,9 +14,13 @@ #include <sal/types.h> #include <sal/config.h> #include <rtl/ustring.hxx> +#include <cppuhelper/implbase.hxx> #include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/security/CertificateKind.hpp> +#include <com/sun/star/security/XCertificate.hpp> #if defined _MSC_VER && defined __clang__ #pragma clang diagnostic push @@ -27,7 +31,10 @@ #pragma clang diagnostic pop #endif -class CertificateImpl : public xmlsecurity::Certificate +class CertificateImpl : public cppu::WeakImplHelper< css::security::XCertificate, + css::lang::XUnoTunnel, + css::lang::XServiceInfo >, + public xmlsecurity::Certificate { private: GpgME::Key m_pKey; diff --git a/xmlsecurity/source/helper/documentsignaturemanager.cxx b/xmlsecurity/source/helper/documentsignaturemanager.cxx index 5c6c9efea726..cd08aadacc13 100644 --- a/xmlsecurity/source/helper/documentsignaturemanager.cxx +++ b/xmlsecurity/source/helper/documentsignaturemanager.cxx @@ -37,7 +37,6 @@ #include <com/sun/star/frame/XModel.hpp> #include <comphelper/base64.hxx> -#include <comphelper/servicehelper.hxx> #include <comphelper/storagehelper.hxx> #include <rtl/ustrbuf.hxx> #include <sal/log.hxx> @@ -332,7 +331,7 @@ bool DocumentSignatureManager::add( comphelper::Base64::encode(aStrBuffer, xCert->getEncoded()); OUString aKeyId; - if (auto pCertificate = comphelper::getFromUnoTunnel<xmlsecurity::Certificate>(xCert)) + if (auto pCertificate = dynamic_cast<xmlsecurity::Certificate*>(xCert.get())) { OUStringBuffer aBuffer; comphelper::Base64::encode(aBuffer, pCertificate->getSHA256Thumbprint()); @@ -379,7 +378,7 @@ bool DocumentSignatureManager::add( OUString aCertDigest; svl::crypto::SignatureMethodAlgorithm eAlgorithmID = svl::crypto::SignatureMethodAlgorithm::RSA; - if (auto pCertificate = comphelper::getFromUnoTunnel<xmlsecurity::Certificate>(xCert)) + if (auto pCertificate = dynamic_cast<xmlsecurity::Certificate*>(xCert.get())) { OUStringBuffer aBuffer; comphelper::Base64::encode(aBuffer, pCertificate->getSHA256Thumbprint()); diff --git a/xmlsecurity/source/helper/xsecverify.cxx b/xmlsecurity/source/helper/xsecverify.cxx index e2d3fc8b5050..c45bece5fed9 100644 --- a/xmlsecurity/source/helper/xsecverify.cxx +++ b/xmlsecurity/source/helper/xsecverify.cxx @@ -42,7 +42,6 @@ #include <comphelper/processfactory.hxx> #include <comphelper/propertyvalue.hxx> #include <comphelper/seqstream.hxx> -#include <comphelper/servicehelper.hxx> namespace com::sun::star::graphic { class XGraphic; } @@ -134,8 +133,8 @@ void XSecController::switchGpgSignature() return; SignatureVerifierImpl* pImpl= - comphelper::getFromUnoTunnel<SignatureVerifierImpl>( - m_vInternalSignatureInformations.back().xReferenceResolvedListener); + dynamic_cast<SignatureVerifierImpl*>( + m_vInternalSignatureInformations.back().xReferenceResolvedListener.get()); if (pImpl) { css::uno::Reference<css::xml::crypto::XSEInitializer> xGpgSEInitializer( diff --git a/xmlsecurity/source/xmlsec/certificate.cxx b/xmlsecurity/source/xmlsec/certificate.cxx deleted file mode 100644 index f43273a47518..000000000000 --- a/xmlsecurity/source/xmlsec/certificate.cxx +++ /dev/null @@ -1,27 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#include <sal/config.h> - -#include <comphelper/servicehelper.hxx> - -#include <certificate.hxx> - -sal_Int64 xmlsecurity::Certificate::getSomething(css::uno::Sequence<sal_Int8> const& aIdentifier) -{ - return comphelper::getSomethingImpl(aIdentifier, this); -} - -css::uno::Sequence<sal_Int8> const& xmlsecurity::Certificate::getUnoTunnelId() -{ - static comphelper::UnoIdInit const id; - return id.getSeq(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx index 96d4b691d3d4..88bf6169bf11 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx @@ -458,7 +458,7 @@ void X509Certificate_MSCryptImpl::setRawCert( Sequence< sal_Int8 > const & rawCe } /* XUnoTunnel */ -UNO3_GETIMPLEMENTATION2_IMPL(X509Certificate_MSCryptImpl, Certificate); +UNO3_GETIMPLEMENTATION_IMPL(X509Certificate_MSCryptImpl); static OUString findOIDDescription(char const *oid) { diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx index 53016dd6c438..9bd6a34ce68e 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx +++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx @@ -27,13 +27,20 @@ #include <sal/config.h> #include <rtl/ustring.hxx> #include <cppuhelper/factory.hxx> +#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> +#include <com/sun/star/security/XCertificate.hpp> #include <certificate.hxx> -class X509Certificate_MSCryptImpl : public xmlsecurity::Certificate +class X509Certificate_MSCryptImpl : public ::cppu::WeakImplHelper< + css::security::XCertificate , + css::lang::XUnoTunnel, + css::lang::XServiceInfo > , public xmlsecurity::Certificate { private: const CERT_CONTEXT* m_pCertContext ; diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx index b737a845fb45..79441da1edf5 100644 --- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx @@ -334,8 +334,7 @@ SECKEYPrivateKey* X509Certificate_NssImpl::getPrivateKey() /* XUnoTunnel */ sal_Int64 SAL_CALL X509Certificate_NssImpl::getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) { - return comphelper::getSomethingImpl( - aIdentifier, this, comphelper::FallbackToGetSomethingOf<xmlsecurity::Certificate>{}); + return comphelper::getSomethingImpl(aIdentifier, this); } /* XUnoTunnel extension */ diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx index 26d85a09f491..dbfb6c6b07ed 100644 --- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx +++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx @@ -21,13 +21,20 @@ #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> #include <certificate.hxx> #include <certt.h> #include <keythi.h> -class X509Certificate_NssImpl : public xmlsecurity::Certificate +class X509Certificate_NssImpl : public ::cppu::WeakImplHelper< + css::security::XCertificate , + css::lang::XUnoTunnel, + css::lang::XServiceInfo > , public xmlsecurity::Certificate { private: CERTCertificate* m_pCert; |