xmlsecurity/Executable_pdfverify.mk    |    1 +
 xmlsecurity/source/pdfio/pdfverify.cxx |   21 ++++++++++++++++++---
 2 files changed, 19 insertions(+), 3 deletions(-)

New commits:
commit f29baf7735ddc162801fea73ecf705805aa4ec11
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Fri Oct 14 18:13:34 2016 +0200

    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 <c...@libreoffice.org>
    Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>

diff --git a/xmlsecurity/Executable_pdfverify.mk 
b/xmlsecurity/Executable_pdfverify.mk
index 8a18dbc..5cfbcd2 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 67dde45..30e085c 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);
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to