summaryrefslogtreecommitdiffstats
path: root/xmlsecurity/source/helper/xsecctl.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-03-03 14:59:03 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-03-03 17:11:07 +0100
commit122c01989d4843db52725d375af22f866345d80a (patch)
tree255a3f93f52478094f1d92021dceee3a3293c2ef /xmlsecurity/source/helper/xsecctl.cxx
parentloplugin:nullptr (diff)
downloadcore-122c01989d4843db52725d375af22f866345d80a.tar.gz
core-122c01989d4843db52725d375af22f866345d80a.zip
xmlsecurity: avoid calculating the certificate digest late in XSecController
Every other aspect of the certificate is calculated earlier in DocumentSignatureManager, so calculate the digest there as well. Change-Id: Icd97f3ecb084bbce60fcdfa496b6aaf0ac75026d
Diffstat (limited to 'xmlsecurity/source/helper/xsecctl.cxx')
-rw-r--r--xmlsecurity/source/helper/xsecctl.cxx19
1 files changed, 2 insertions, 17 deletions
diff --git a/xmlsecurity/source/helper/xsecctl.cxx b/xmlsecurity/source/helper/xsecctl.cxx
index 4178aab81a23..f347863f4b2f 100644
--- a/xmlsecurity/source/helper/xsecctl.cxx
+++ b/xmlsecurity/source/helper/xsecctl.cxx
@@ -40,8 +40,6 @@
#include <comphelper/ofopxmlhelper.hxx>
#include <sax/tools/converter.hxx>
-#include <certificate.hxx>
-
namespace cssu = com::sun::star::uno;
namespace cssl = com::sun::star::lang;
namespace cssxc = com::sun::star::xml::crypto;
@@ -1320,21 +1318,8 @@ void XSecController::exportOOXMLSignature(const uno::Reference<embed::XStorage>&
xDocumentHandler->endElement("DigestMethod");
xDocumentHandler->startElement("DigestValue", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
- if (rInformation.ouCertDigest.isEmpty())
- {
- uno::Reference<xml::crypto::XSecurityEnvironment> xEnvironment = m_xSecurityContext->getSecurityEnvironment();
- uno::Reference<security::XCertificate> xCertificate = xEnvironment->createCertificateFromAscii(rInformation.ouX509Certificate);
- if (xmlsecurity::Certificate* pCertificate = dynamic_cast<xmlsecurity::Certificate*>(xCertificate.get()))
- {
- OUStringBuffer aBuffer;
- sax::Converter::encodeBase64(aBuffer, pCertificate->getSHA256Thumbprint());
- xDocumentHandler->characters(aBuffer.makeStringAndClear());
- }
- else
- SAL_WARN("xmlsecurity.helper", "XCertificate implementation without an xmlsecurity::Certificate one");
- }
- else
- xDocumentHandler->characters(rInformation.ouCertDigest);
+ assert(!rInformation.ouCertDigest.isEmpty());
+ xDocumentHandler->characters(rInformation.ouCertDigest);
xDocumentHandler->endElement("DigestValue");
xDocumentHandler->endElement("xd:CertDigest");