1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include <sal/config.h>
11 #include <xmlsec-wrapper.h>
13 #include <xmlsec/xmlsec_init.hxx>
15 #include <com/sun/star/uno/RuntimeException.hpp>
17 #include <xmlsec/xmlstreamio.hxx>
18 #ifdef XMLSEC_CRYPTO_MSCRYPTO
19 #include <xmlsec/mscng/crypto.h>
21 #ifdef XMLSEC_CRYPTO_NSS
22 #include <xmlsec/nss/crypto.h>
25 using namespace css::uno
;
27 XSECXMLSEC_DLLPUBLIC
void initXmlSec()
30 if( xmlSecInit() < 0 ) {
31 throw RuntimeException() ;
34 //Init xmlsec crypto engine library
35 #ifdef XMLSEC_CRYPTO_MSCRYPTO
36 if( xmlSecMSCngInit() < 0 ) {
38 throw RuntimeException();
41 #ifdef XMLSEC_CRYPTO_NSS
42 if( xmlSecNssInit() < 0 ) {
44 throw RuntimeException();
48 //Enable external stream handlers
49 if( xmlEnableStreamInputCallbacks() < 0 ) {
50 #ifdef XMLSEC_CRYPTO_MSCRYPTO
51 xmlSecMSCngShutdown();
53 #ifdef XMLSEC_CRYPTO_NSS
57 throw RuntimeException() ;
61 XSECXMLSEC_DLLPUBLIC
void deInitXmlSec()
63 xmlDisableStreamInputCallbacks();
64 #ifdef XMLSEC_CRYPTO_MSCRYPTO
65 xmlSecMSCngShutdown();
67 #ifdef XMLSEC_CRYPTO_NSS
73 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */