diff options
-rw-r--r-- | xmlsecurity/Executable_pdfverify.mk | 1 | ||||
-rw-r--r-- | xmlsecurity/source/pdfio/pdfverify.cxx | 21 |
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); |