Kaydet (Commit) f29baf77 authored tarafından Miklos Vajna's avatar Miklos Vajna

Executable_pdfverify: initialize nss / mscrypto

This was broken since commit 9fe910e4
(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/29887Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 29834be1
......@@ -19,6 +19,7 @@ $(eval $(call gb_Executable_set_include,pdfverify,\
$(eval $(call gb_Executable_use_libraries,pdfverify,\
comphelper \
cppu \
cppuhelper \
sal \
tl \
xmlsecurity \
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment