From f30bc3ccdfb48356910d64ee4a3dda685b11de93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Fri, 4 Mar 2022 10:31:46 +0000 Subject: [PATCH] use internal SHA256Thumbprint api Change-Id: I6a51359af58dbb79b6a0399944030dbcbe97152b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130963 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- .../source/component/documentdigitalsignatures.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx index 0dbf0877ad1e..990fa5dea739 100644 --- a/xmlsecurity/source/component/documentdigitalsignatures.cxx +++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx @@ -19,9 +19,10 @@ #include -#include +#include #include #include +#include #include #include #include @@ -683,6 +684,12 @@ sal_Bool DocumentDigitalSignatures::isAuthorTrusted( if (!aSignatureManager.init()) return false; uno::Reference xCert = aSignatureManager.getSecurityEnvironment()->createCertificateFromAscii(rAuthor.RawData); + + auto pAuthor = dynamic_cast(xAuthor.get()); + auto pCert = dynamic_cast(xCert.get()); + if (pAuthor && pCert) + return pCert->getSHA256Thumbprint() == pAuthor->getSHA256Thumbprint(); + return xCert->getSHA1Thumbprint() == xAuthor->getSHA1Thumbprint(); }); }