diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-12-21 15:54:54 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-12-22 08:15:51 +0000 |
commit | 5a14f009e6782c077463c8cbb8e9cea3d7950107 (patch) | |
tree | 353fdd4515bd1597a896c377cc4bd8dbed63ad6e /xmlsecurity/source/helper/documentsignaturemanager.cxx | |
parent | f5b3bfbded8ea8d4a0b854a62c82b66747b45833 (diff) |
loplugin:unocast (xmlsecurity::Certificate)
(See the upcoming commit introducing that loplugin:unocast on why such
dynamic_casts from UNO types are dangerous.)
Change-Id: I3d9bd77093d2e6376717d27f105e72ff5a919fe7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144696
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'xmlsecurity/source/helper/documentsignaturemanager.cxx')
-rw-r--r-- | xmlsecurity/source/helper/documentsignaturemanager.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/xmlsecurity/source/helper/documentsignaturemanager.cxx b/xmlsecurity/source/helper/documentsignaturemanager.cxx index cd08aadacc13..5c6c9efea726 100644 --- a/xmlsecurity/source/helper/documentsignaturemanager.cxx +++ b/xmlsecurity/source/helper/documentsignaturemanager.cxx @@ -37,6 +37,7 @@ #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> @@ -331,7 +332,7 @@ bool DocumentSignatureManager::add( comphelper::Base64::encode(aStrBuffer, xCert->getEncoded()); OUString aKeyId; - if (auto pCertificate = dynamic_cast<xmlsecurity::Certificate*>(xCert.get())) + if (auto pCertificate = comphelper::getFromUnoTunnel<xmlsecurity::Certificate>(xCert)) { OUStringBuffer aBuffer; comphelper::Base64::encode(aBuffer, pCertificate->getSHA256Thumbprint()); @@ -378,7 +379,7 @@ bool DocumentSignatureManager::add( OUString aCertDigest; svl::crypto::SignatureMethodAlgorithm eAlgorithmID = svl::crypto::SignatureMethodAlgorithm::RSA; - if (auto pCertificate = dynamic_cast<xmlsecurity::Certificate*>(xCert.get())) + if (auto pCertificate = comphelper::getFromUnoTunnel<xmlsecurity::Certificate>(xCert)) { OUStringBuffer aBuffer; comphelper::Base64::encode(aBuffer, pCertificate->getSHA256Thumbprint()); |