summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-10-14 18:13:34 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-10-17 06:08:43 +0000
commitf29baf7735ddc162801fea73ecf705805aa4ec11 (patch)
tree975e9e700a2f2808111c830f126c9b8452ce3564 /xmlsecurity
parent29834be11ab48245abca212c05715395f4704f78 (diff)
Executable_pdfverify: initialize nss / mscrypto
This was broken since commit 9fe910e4861a7911c6d286258a30954e715653ac (xmlsecurity: use common NSS init in PDFDocument, 2016-10-13), after that PDFDocument assumes that the client code does the crypto initialization. Change-Id: Iaee005afef6bd602c3a95e9a18f407c4d4223a26 Reviewed-on: https://gerrit.libreoffice.org/29887 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/Executable_pdfverify.mk1
-rw-r--r--xmlsecurity/source/pdfio/pdfverify.cxx21
2 files changed, 19 insertions, 3 deletions
diff --git a/xmlsecurity/Executable_pdfverify.mk b/xmlsecurity/Executable_pdfverify.mk
index 8a18dbc08a54..5cfbcd2dd43b 100644
--- a/xmlsecurity/Executable_pdfverify.mk
+++ b/xmlsecurity/Executable_pdfverify.mk
@@ -19,6 +19,7 @@ $(eval $(call gb_Executable_set_include,pdfverify,\
$(eval $(call gb_Executable_use_libraries,pdfverify,\
comphelper \
cppu \
+ cppuhelper \
sal \
tl \
xmlsecurity \
diff --git a/xmlsecurity/source/pdfio/pdfverify.cxx b/xmlsecurity/source/pdfio/pdfverify.cxx
index 67dde459ff39..30e085cf2913 100644
--- a/xmlsecurity/source/pdfio/pdfverify.cxx
+++ b/xmlsecurity/source/pdfio/pdfverify.cxx
@@ -7,11 +7,18 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#include <pdfio/pdfdocument.hxx>
+#include <iostream>
-#include <sal/main.h>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/xml/crypto/SEInitializer.hpp>
+
+#include <comphelper/processfactory.hxx>
+#include <cppuhelper/bootstrap.hxx>
#include <osl/file.hxx>
-#include <iostream>
+#include <sal/main.h>
+
+#include <pdfio/pdfdocument.hxx>
using namespace com::sun::star;
@@ -23,6 +30,14 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(nArgc, pArgv)
return 1;
}
+ // Initialize nss / mscrypto.
+ uno::Reference<uno::XComponentContext> xComponentContext = cppu::defaultBootstrap_InitialComponentContext();
+ uno::Reference<lang::XMultiComponentFactory> xMultiComponentFactory = xComponentContext->getServiceManager();
+ uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(xMultiComponentFactory, uno::UNO_QUERY);;
+ comphelper::setProcessServiceFactory(xMultiServiceFactory);
+ uno::Reference<xml::crypto::XSEInitializer> xSEInitializer = xml::crypto::SEInitializer::create(xComponentContext);
+ uno::Reference<xml::crypto::XXMLSecurityContext> xSecurityContext = xSEInitializer->createSecurityContext(OUString());
+
OUString aURL;
osl::FileBase::getFileURLFromSystemPath(OUString::fromUtf8(pArgv[1]), aURL);