Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / xmlsecurity / source / xmlsec / xmlsec_init.cxx
blob410408ed2ebec713d5c793eaf0d5a55fb82a44f6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
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>
20 #endif
21 #ifdef XMLSEC_CRYPTO_NSS
22 #include <xmlsec/nss/crypto.h>
23 #endif
25 using namespace css::uno;
27 XSECXMLSEC_DLLPUBLIC void initXmlSec()
29 //Init xmlsec library
30 if( xmlSecInit() < 0 ) {
31 throw RuntimeException() ;
34 //Init xmlsec crypto engine library
35 #ifdef XMLSEC_CRYPTO_MSCRYPTO
36 if( xmlSecMSCngInit() < 0 ) {
37 xmlSecShutdown();
38 throw RuntimeException();
40 #endif
41 #ifdef XMLSEC_CRYPTO_NSS
42 if( xmlSecNssInit() < 0 ) {
43 xmlSecShutdown();
44 throw RuntimeException();
46 #endif
48 //Enable external stream handlers
49 if( xmlEnableStreamInputCallbacks() < 0 ) {
50 #ifdef XMLSEC_CRYPTO_MSCRYPTO
51 xmlSecMSCngShutdown();
52 #endif
53 #ifdef XMLSEC_CRYPTO_NSS
54 xmlSecNssShutdown();
55 #endif
56 xmlSecShutdown() ;
57 throw RuntimeException() ;
61 XSECXMLSEC_DLLPUBLIC void deInitXmlSec()
63 xmlDisableStreamInputCallbacks();
64 #ifdef XMLSEC_CRYPTO_MSCRYPTO
65 xmlSecMSCngShutdown();
66 #endif
67 #ifdef XMLSEC_CRYPTO_NSS
68 xmlSecNssShutdown();
69 #endif
70 xmlSecShutdown();
73 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */