LibreOffice Module xmlsecurity (master) 1
xmlsec_init.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 */
9
10#include <sal/config.h>
11#include <xmlsec-wrapper.h>
12
14
15#include <com/sun/star/uno/RuntimeException.hpp>
16
18#ifdef XMLSEC_CRYPTO_MSCRYPTO
19#include <xmlsec/mscng/crypto.h>
20#endif
21#ifdef XMLSEC_CRYPTO_NSS
22#include <xmlsec/nss/crypto.h>
23#endif
24
25using namespace css::uno;
26
28{
29 //Init xmlsec library
30 if( xmlSecInit() < 0 ) {
31 throw RuntimeException() ;
32 }
33
34 //Init xmlsec crypto engine library
35#ifdef XMLSEC_CRYPTO_MSCRYPTO
36 if( xmlSecMSCngInit() < 0 ) {
37 xmlSecShutdown();
38 throw RuntimeException();
39 }
40#endif
41#ifdef XMLSEC_CRYPTO_NSS
42 if( xmlSecNssInit() < 0 ) {
43 xmlSecShutdown();
44 throw RuntimeException();
45 }
46#endif
47
48 //Enable external stream handlers
50#ifdef XMLSEC_CRYPTO_MSCRYPTO
51 xmlSecMSCngShutdown();
52#endif
53#ifdef XMLSEC_CRYPTO_NSS
54 xmlSecNssShutdown();
55#endif
56 xmlSecShutdown() ;
57 throw RuntimeException() ;
58 }
59}
60
62{
64#ifdef XMLSEC_CRYPTO_MSCRYPTO
65 xmlSecMSCngShutdown();
66#endif
67#ifdef XMLSEC_CRYPTO_NSS
68 xmlSecNssShutdown();
69#endif
70 xmlSecShutdown();
71}
72
73/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
XSECXMLSEC_DLLPUBLIC void deInitXmlSec()
Definition: xmlsec_init.cxx:61
XSECXMLSEC_DLLPUBLIC void initXmlSec()
Definition: xmlsec_init.cxx:27
int xmlEnableStreamInputCallbacks()
void xmlDisableStreamInputCallbacks()
#define XSECXMLSEC_DLLPUBLIC