1*06b3ce53SAndrew Rist /**************************************************************
2*06b3ce53SAndrew Rist *
3*06b3ce53SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*06b3ce53SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*06b3ce53SAndrew Rist * distributed with this work for additional information
6*06b3ce53SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*06b3ce53SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*06b3ce53SAndrew Rist * "License"); you may not use this file except in compliance
9*06b3ce53SAndrew Rist * with the License. You may obtain a copy of the License at
10*06b3ce53SAndrew Rist *
11*06b3ce53SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*06b3ce53SAndrew Rist *
13*06b3ce53SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*06b3ce53SAndrew Rist * software distributed under the License is distributed on an
15*06b3ce53SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*06b3ce53SAndrew Rist * KIND, either express or implied. See the License for the
17*06b3ce53SAndrew Rist * specific language governing permissions and limitations
18*06b3ce53SAndrew Rist * under the License.
19*06b3ce53SAndrew Rist *
20*06b3ce53SAndrew Rist *************************************************************/
21*06b3ce53SAndrew Rist
22cdf0e10cSrcweir /** -- C++ Source File -- **/
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_xmlsecurity.hxx"
26cdf0e10cSrcweir #include <stdio.h>
27cdf0e10cSrcweir #include "helper.hxx"
28cdf0e10cSrcweir
29cdf0e10cSrcweir #include "libxml/tree.h"
30cdf0e10cSrcweir #include "libxml/parser.h"
31cdf0e10cSrcweir #ifndef XMLSEC_NO_XSLT
32cdf0e10cSrcweir #include "libxslt/xslt.h"
33cdf0e10cSrcweir #endif
34cdf0e10cSrcweir
35cdf0e10cSrcweir #include "securityenvironment_mscryptimpl.hxx"
36cdf0e10cSrcweir #include "xmlelementwrapper_xmlsecimpl.hxx"
37cdf0e10cSrcweir
38cdf0e10cSrcweir #include "xmlsec/strings.h"
39cdf0e10cSrcweir #include "xmlsec/mscrypto/app.h"
40cdf0e10cSrcweir #include "xmlsec/xmltree.h"
41cdf0e10cSrcweir
42cdf0e10cSrcweir #include <rtl/ustring.hxx>
43cdf0e10cSrcweir #include <cppuhelper/servicefactory.hxx>
44cdf0e10cSrcweir
45cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp>
46cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
47cdf0e10cSrcweir #include <com/sun/star/xml/wrapper/XXMLElementWrapper.hpp>
48cdf0e10cSrcweir #include <com/sun/star/xml/wrapper/XXMLDocumentWrapper.hpp>
49cdf0e10cSrcweir #include <com/sun/star/xml/crypto/XXMLSignature.hpp>
50cdf0e10cSrcweir #include <com/sun/star/xml/crypto/XXMLSignatureTemplate.hpp>
51cdf0e10cSrcweir #include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
52cdf0e10cSrcweir #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
53cdf0e10cSrcweir
54cdf0e10cSrcweir using namespace ::rtl ;
55cdf0e10cSrcweir using namespace ::cppu ;
56cdf0e10cSrcweir using namespace ::com::sun::star::uno ;
57cdf0e10cSrcweir using namespace ::com::sun::star::io ;
58cdf0e10cSrcweir using namespace ::com::sun::star::ucb ;
59cdf0e10cSrcweir using namespace ::com::sun::star::beans ;
60cdf0e10cSrcweir using namespace ::com::sun::star::document ;
61cdf0e10cSrcweir using namespace ::com::sun::star::lang ;
62cdf0e10cSrcweir using namespace ::com::sun::star::registry ;
63cdf0e10cSrcweir using namespace ::com::sun::star::xml::wrapper ;
64cdf0e10cSrcweir using namespace ::com::sun::star::xml::crypto ;
65cdf0e10cSrcweir
66cdf0e10cSrcweir
main(int argc,char ** argv)67cdf0e10cSrcweir int SAL_CALL main( int argc, char **argv )
68cdf0e10cSrcweir {
69cdf0e10cSrcweir const char* n_pCertStore ;
70cdf0e10cSrcweir HCERTSTORE n_hStoreHandle ;
71cdf0e10cSrcweir
72cdf0e10cSrcweir xmlDocPtr doc = NULL ;
73cdf0e10cSrcweir xmlNodePtr tplNode ;
74cdf0e10cSrcweir xmlNodePtr tarNode ;
75cdf0e10cSrcweir xmlAttrPtr idAttr ;
76cdf0e10cSrcweir xmlChar* idValue ;
77cdf0e10cSrcweir xmlAttrPtr uriAttr ;
78cdf0e10cSrcweir xmlChar* uriValue ;
79cdf0e10cSrcweir OUString* uri = NULL ;
80cdf0e10cSrcweir Reference< XUriBinding > xUriBinding ;
81cdf0e10cSrcweir FILE* dstFile = NULL ;
82cdf0e10cSrcweir
83cdf0e10cSrcweir if( argc !=3 && argc != 4 ) {
84cdf0e10cSrcweir fprintf( stderr, "Usage: %s <file_url> <rdb file>\n" , argv[0] ) ;
85cdf0e10cSrcweir fprintf( stderr, "Or: \t%s <file_url> <rdb file> < Cert Store Name >\n\n" , argv[0] ) ;
86cdf0e10cSrcweir return 1 ;
87cdf0e10cSrcweir }
88cdf0e10cSrcweir
89cdf0e10cSrcweir for( int hhh = 0 ; hhh < 1 ; hhh ++ ) {
90cdf0e10cSrcweir
91cdf0e10cSrcweir //Init libxml and libxslt libraries
92cdf0e10cSrcweir xmlInitParser();
93cdf0e10cSrcweir LIBXML_TEST_VERSION
94cdf0e10cSrcweir xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
95cdf0e10cSrcweir xmlSubstituteEntitiesDefault(1);
96cdf0e10cSrcweir
97cdf0e10cSrcweir #ifndef XMLSEC_NO_XSLT
98cdf0e10cSrcweir xmlIndentTreeOutput = 1;
99cdf0e10cSrcweir #endif // XMLSEC_NO_XSLT
100cdf0e10cSrcweir
101cdf0e10cSrcweir //Initialize the crypto engine
102cdf0e10cSrcweir if( argc == 4 ) {
103cdf0e10cSrcweir n_pCertStore = argv[3] ;
104cdf0e10cSrcweir n_hStoreHandle = CertOpenSystemStore( NULL, n_pCertStore ) ;
105cdf0e10cSrcweir if( n_hStoreHandle == NULL ) {
106cdf0e10cSrcweir fprintf( stderr, "Can not open the system cert store %s\n", n_pCertStore ) ;
107cdf0e10cSrcweir return 1 ;
108cdf0e10cSrcweir }
109cdf0e10cSrcweir } else {
110cdf0e10cSrcweir n_pCertStore = NULL ;
111cdf0e10cSrcweir n_hStoreHandle = NULL ;
112cdf0e10cSrcweir }
113cdf0e10cSrcweir xmlSecMSCryptoAppInit( n_pCertStore ) ;
114cdf0e10cSrcweir
115cdf0e10cSrcweir //Load XML document
116cdf0e10cSrcweir doc = xmlParseFile( argv[1] ) ;
117cdf0e10cSrcweir if( doc == NULL || xmlDocGetRootElement( doc ) == NULL ) {
118cdf0e10cSrcweir fprintf( stderr , "### Cannot load template xml document!\n" ) ;
119cdf0e10cSrcweir goto done ;
120cdf0e10cSrcweir }
121cdf0e10cSrcweir
122cdf0e10cSrcweir //Find the signature template
123cdf0e10cSrcweir tplNode = xmlSecFindNode( xmlDocGetRootElement( doc ), xmlSecNodeSignature, xmlSecDSigNs ) ;
124cdf0e10cSrcweir if( tplNode == NULL ) {
125cdf0e10cSrcweir fprintf( stderr , "### Cannot find the signature template!\n" ) ;
126cdf0e10cSrcweir goto done ;
127cdf0e10cSrcweir }
128cdf0e10cSrcweir
129cdf0e10cSrcweir //Find the element with ID attribute
130cdf0e10cSrcweir tarNode = xmlSecFindNode( xmlDocGetRootElement( doc ), ( xmlChar* )"document", ( xmlChar* )"http://openoffice.org/2000/office" ) ;
131cdf0e10cSrcweir if( tarNode == NULL ) {
132cdf0e10cSrcweir tarNode = xmlSecFindNode( xmlDocGetRootElement( doc ), ( xmlChar* )"document", NULL ) ;
133cdf0e10cSrcweir }
134cdf0e10cSrcweir
135cdf0e10cSrcweir //Find the "id" attrbute in the element
136cdf0e10cSrcweir if( tarNode != NULL ) {
137cdf0e10cSrcweir if( ( idAttr = xmlHasProp( tarNode, ( xmlChar* )"id" ) ) != NULL ) {
138cdf0e10cSrcweir //NULL
139cdf0e10cSrcweir } else if( ( idAttr = xmlHasProp( tarNode, ( xmlChar* )"Id" ) ) != NULL ) {
140cdf0e10cSrcweir //NULL
141cdf0e10cSrcweir } else {
142cdf0e10cSrcweir idAttr = NULL ;
143cdf0e10cSrcweir }
144cdf0e10cSrcweir }
145cdf0e10cSrcweir
146cdf0e10cSrcweir //Add ID to DOM
147cdf0e10cSrcweir if( idAttr != NULL ) {
148cdf0e10cSrcweir idValue = xmlNodeListGetString( tarNode->doc, idAttr->children, 1 ) ;
149cdf0e10cSrcweir if( idValue == NULL ) {
150cdf0e10cSrcweir fprintf( stderr , "### the ID value is NULL!\n" ) ;
151cdf0e10cSrcweir goto done ;
152cdf0e10cSrcweir }
153cdf0e10cSrcweir
154cdf0e10cSrcweir if( xmlAddID( NULL, doc, idValue, idAttr ) == NULL ) {
155cdf0e10cSrcweir fprintf( stderr , "### Can not add the ID value!\n" ) ;
156cdf0e10cSrcweir goto done ;
157cdf0e10cSrcweir }
158cdf0e10cSrcweir }
159cdf0e10cSrcweir
160cdf0e10cSrcweir //Reference handler
161cdf0e10cSrcweir //Find the signature reference
162cdf0e10cSrcweir tarNode = xmlSecFindNode( tplNode, xmlSecNodeReference, xmlSecDSigNs ) ;
163cdf0e10cSrcweir if( tarNode == NULL ) {
164cdf0e10cSrcweir fprintf( stderr , "### Cannot find the signature reference!\n" ) ;
165cdf0e10cSrcweir goto done ;
166cdf0e10cSrcweir }
167cdf0e10cSrcweir
168cdf0e10cSrcweir //Find the "URI" attrbute in the reference
169cdf0e10cSrcweir uriAttr = xmlHasProp( tarNode, ( xmlChar* )"URI" ) ;
170cdf0e10cSrcweir if( tarNode == NULL ) {
171cdf0e10cSrcweir fprintf( stderr , "### Cannot find URI of the reference!\n" ) ;
172cdf0e10cSrcweir goto done ;
173cdf0e10cSrcweir }
174cdf0e10cSrcweir
175cdf0e10cSrcweir //Get the "URI" attrbute value
176cdf0e10cSrcweir uriValue = xmlNodeListGetString( tarNode->doc, uriAttr->children, 1 ) ;
177cdf0e10cSrcweir if( uriValue == NULL ) {
178cdf0e10cSrcweir fprintf( stderr , "### the URI value is NULL!\n" ) ;
179cdf0e10cSrcweir goto done ;
180cdf0e10cSrcweir }
181cdf0e10cSrcweir
182cdf0e10cSrcweir if( strchr( ( const char* )uriValue, '/' ) != NULL && strchr( ( const char* )uriValue, '#' ) == NULL ) {
183cdf0e10cSrcweir fprintf( stdout , "### Find a stream URI [%s]\n", uriValue ) ;
184cdf0e10cSrcweir // uri = new ::rtl::OUString( ( const sal_Unicode* )uriValue ) ;
185cdf0e10cSrcweir uri = new ::rtl::OUString( ( const sal_Char* )uriValue, xmlStrlen( uriValue ), RTL_TEXTENCODING_ASCII_US ) ;
186cdf0e10cSrcweir }
187cdf0e10cSrcweir
188cdf0e10cSrcweir if( uri != NULL ) {
189cdf0e10cSrcweir fprintf( stdout , "### Find the URI [%s]\n", OUStringToOString( *uri , RTL_TEXTENCODING_ASCII_US ).getStr() ) ;
190cdf0e10cSrcweir Reference< XInputStream > xStream = createStreamFromFile( *uri ) ;
191cdf0e10cSrcweir if( !xStream.is() ) {
192cdf0e10cSrcweir fprintf( stderr , "### Can not get the URI stream!\n" ) ;
193cdf0e10cSrcweir goto done ;
194cdf0e10cSrcweir }
195cdf0e10cSrcweir
196cdf0e10cSrcweir xUriBinding = new OUriBinding( *uri, xStream ) ;
197cdf0e10cSrcweir }
198cdf0e10cSrcweir
199cdf0e10cSrcweir
200cdf0e10cSrcweir try {
201cdf0e10cSrcweir Reference< XMultiComponentFactory > xManager = NULL ;
202cdf0e10cSrcweir Reference< XComponentContext > xContext = NULL ;
203cdf0e10cSrcweir
204cdf0e10cSrcweir xManager = serviceManager( xContext , OUString::createFromAscii( "local" ), OUString::createFromAscii( argv[2] ) ) ;
205cdf0e10cSrcweir
206cdf0e10cSrcweir //Create signature template
207cdf0e10cSrcweir Reference< XInterface > element =
208cdf0e10cSrcweir xManager->createInstanceWithContext( OUString::createFromAscii( "com.sun.star.xml.security.bridge.xmlsec.XMLElementWrapper_XmlSecImpl" ) , xContext ) ;
209cdf0e10cSrcweir OSL_ENSURE( element.is() ,
210cdf0e10cSrcweir "Verifier - "
211cdf0e10cSrcweir "Cannot get service instance of \"xsec.XMLElementWrapper\"" ) ;
212cdf0e10cSrcweir
213cdf0e10cSrcweir Reference< XXMLElementWrapper > xElement( element , UNO_QUERY ) ;
214cdf0e10cSrcweir OSL_ENSURE( xElement.is() ,
215cdf0e10cSrcweir "Verifier - "
216cdf0e10cSrcweir "Cannot get interface of \"XXMLElementWrapper\" from service \"xsec.XMLElementWrapper\"" ) ;
217cdf0e10cSrcweir
218cdf0e10cSrcweir Reference< XUnoTunnel > xEleTunnel( xElement , UNO_QUERY ) ;
219cdf0e10cSrcweir OSL_ENSURE( xEleTunnel.is() ,
220cdf0e10cSrcweir "Verifier - "
221cdf0e10cSrcweir "Cannot get interface of \"XUnoTunnel\" from service \"xsec.XMLElement\"" ) ;
222cdf0e10cSrcweir
223cdf0e10cSrcweir XMLElementWrapper_XmlSecImpl* pElement = ( XMLElementWrapper_XmlSecImpl* )xEleTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() ) ;
224cdf0e10cSrcweir OSL_ENSURE( pElement != NULL ,
225cdf0e10cSrcweir "Verifier - "
226cdf0e10cSrcweir "Cannot get implementation of \"xsec.XMLElementWrapper\"" ) ;
227cdf0e10cSrcweir
228cdf0e10cSrcweir //Set signature template
229cdf0e10cSrcweir pElement->setNativeElement( tplNode ) ;
230cdf0e10cSrcweir
231cdf0e10cSrcweir //Build XML Signature template
232cdf0e10cSrcweir Reference< XInterface > signtpl =
233cdf0e10cSrcweir xManager->createInstanceWithContext( OUString::createFromAscii("com.sun.star.xml.crypto.XMLSignatureTemplate"), xContext ) ;
234cdf0e10cSrcweir OSL_ENSURE( signtpl.is() ,
235cdf0e10cSrcweir "Verifier - "
236cdf0e10cSrcweir "Cannot get service instance of \"xsec.XMLSignatureTemplate\"" ) ;
237cdf0e10cSrcweir
238cdf0e10cSrcweir Reference< XXMLSignatureTemplate > xTemplate( signtpl , UNO_QUERY ) ;
239cdf0e10cSrcweir OSL_ENSURE( xTemplate.is() ,
240cdf0e10cSrcweir "Verifier - "
241cdf0e10cSrcweir "Cannot get interface of \"XXMLSignatureTemplate\" from service \"xsec.XMLSignatureTemplate\"" ) ;
242cdf0e10cSrcweir
243cdf0e10cSrcweir //Import the signature template
244cdf0e10cSrcweir xTemplate->setTemplate( xElement ) ;
245cdf0e10cSrcweir
246cdf0e10cSrcweir //Import the URI/Stream binding
247cdf0e10cSrcweir if( xUriBinding.is() )
248cdf0e10cSrcweir xTemplate->setBinding( xUriBinding ) ;
249cdf0e10cSrcweir
250cdf0e10cSrcweir //Create security environment
251cdf0e10cSrcweir //Build Security Environment
252cdf0e10cSrcweir Reference< XInterface > xsecenv =
253cdf0e10cSrcweir xManager->createInstanceWithContext( OUString::createFromAscii("com.sun.star.xml.security.bridge.xmlsec.SecurityEnvironment_MSCryptImpl"), xContext ) ;
254cdf0e10cSrcweir OSL_ENSURE( xsecenv.is() ,
255cdf0e10cSrcweir "Verifier - "
256cdf0e10cSrcweir "Cannot get service instance of \"xsec.SecurityEnvironment\"" ) ;
257cdf0e10cSrcweir
258cdf0e10cSrcweir Reference< XSecurityEnvironment > xSecEnv( xsecenv , UNO_QUERY ) ;
259cdf0e10cSrcweir OSL_ENSURE( xSecEnv.is() ,
260cdf0e10cSrcweir "Verifier - "
261cdf0e10cSrcweir "Cannot get interface of \"XSecurityEnvironment\" from service \"xsec.SecurityEnvironment\"" ) ;
262cdf0e10cSrcweir
263cdf0e10cSrcweir //Setup key slot and certDb
264cdf0e10cSrcweir Reference< XUnoTunnel > xEnvTunnel( xsecenv , UNO_QUERY ) ;
265cdf0e10cSrcweir OSL_ENSURE( xElement.is() ,
266cdf0e10cSrcweir "Verifier - "
267cdf0e10cSrcweir "Cannot get interface of \"XUnoTunnel\" from service \"xsec.SecurityEnvironment\"" ) ;
268cdf0e10cSrcweir
269cdf0e10cSrcweir SecurityEnvironment_MSCryptImpl* pSecEnv = ( SecurityEnvironment_MSCryptImpl* )xEnvTunnel->getSomething( SecurityEnvironment_MSCryptImpl::getUnoTunnelId() ) ;
270cdf0e10cSrcweir OSL_ENSURE( pSecEnv != NULL ,
271cdf0e10cSrcweir "Verifier - "
272cdf0e10cSrcweir "Cannot get implementation of \"xsec.SecurityEnvironment\"" ) ;
273cdf0e10cSrcweir
274cdf0e10cSrcweir //Setup key slot and certDb
275cdf0e10cSrcweir if( n_hStoreHandle != NULL ) {
276cdf0e10cSrcweir pSecEnv->setCryptoSlot( n_hStoreHandle ) ;
277cdf0e10cSrcweir pSecEnv->setCertDb( n_hStoreHandle ) ;
278cdf0e10cSrcweir } else {
279cdf0e10cSrcweir pSecEnv->enableDefaultCrypt( sal_True ) ;
280cdf0e10cSrcweir }
281cdf0e10cSrcweir
282cdf0e10cSrcweir //Build XML Security Context
283cdf0e10cSrcweir Reference< XInterface > xmlsecctx =
284cdf0e10cSrcweir xManager->createInstanceWithContext( OUString::createFromAscii("com.sun.star.xml.security.bridge.xmlsec.XMLSecurityContext_MSCryptImpl"), xContext ) ;
285cdf0e10cSrcweir OSL_ENSURE( xsecenv.is() ,
286cdf0e10cSrcweir "Verifier - "
287cdf0e10cSrcweir "Cannot get service instance of \"xsec.XMLSecurityContext\"" ) ;
288cdf0e10cSrcweir
289cdf0e10cSrcweir Reference< XXMLSecurityContext > xSecCtx( xmlsecctx , UNO_QUERY ) ;
290cdf0e10cSrcweir OSL_ENSURE( xSecCtx.is() ,
291cdf0e10cSrcweir "Verifier - "
292cdf0e10cSrcweir "Cannot get interface of \"XXMLSecurityContext\" from service \"xsec.XMLSecurityContext\"" ) ;
293cdf0e10cSrcweir
294cdf0e10cSrcweir xSecCtx->addSecurityEnvironment( xSecEnv ) ;
295cdf0e10cSrcweir
296cdf0e10cSrcweir //Generate XML signature
297cdf0e10cSrcweir Reference< XInterface > xmlsigner =
298cdf0e10cSrcweir xManager->createInstanceWithContext( OUString::createFromAscii("com.sun.star.xml.security.bridge.xmlsec.XMLSignature_MSCryptImpl"), xContext ) ;
299cdf0e10cSrcweir OSL_ENSURE( xmlsigner.is() ,
300cdf0e10cSrcweir "Verifier - "
301cdf0e10cSrcweir "Cannot get service instance of \"xsec.XMLSignature\"" ) ;
302cdf0e10cSrcweir
303cdf0e10cSrcweir Reference< XXMLSignature > xSigner( xmlsigner , UNO_QUERY ) ;
304cdf0e10cSrcweir OSL_ENSURE( xSigner.is() ,
305cdf0e10cSrcweir "Verifier - "
306cdf0e10cSrcweir "Cannot get interface of \"XXMLSignature\" from service \"xsec.XMLSignature\"" ) ;
307cdf0e10cSrcweir
308cdf0e10cSrcweir
309cdf0e10cSrcweir //perform validation
310cdf0e10cSrcweir xTemplate = xSigner->validate( xTemplate , xSecCtx ) ;
311cdf0e10cSrcweir
312cdf0e10cSrcweir com::sun::star::xml::crypto::SecurityOperationStatus m_nStatus = xTemplate->getStatus();
313cdf0e10cSrcweir
314cdf0e10cSrcweir if (m_nStatus == SecurityOperationStatus_OPERATION_SUCCEEDED)
315cdf0e10cSrcweir {
316cdf0e10cSrcweir fprintf( stdout, "Operation succeeds.\n") ;
317cdf0e10cSrcweir }
318cdf0e10cSrcweir else
319cdf0e10cSrcweir {
320cdf0e10cSrcweir fprintf( stdout, "Operation fails.\n") ;
321cdf0e10cSrcweir }
322cdf0e10cSrcweir } catch( Exception& e ) {
323cdf0e10cSrcweir fprintf( stderr , "Error Message: %s\n" , OUStringToOString( e.Message , RTL_TEXTENCODING_ASCII_US ).getStr() ) ;
324cdf0e10cSrcweir goto done ;
325cdf0e10cSrcweir }
326cdf0e10cSrcweir
327cdf0e10cSrcweir done :
328cdf0e10cSrcweir if( uri != NULL )
329cdf0e10cSrcweir delete uri ;
330cdf0e10cSrcweir
331cdf0e10cSrcweir if( doc != NULL )
332cdf0e10cSrcweir xmlFreeDoc( doc ) ;
333cdf0e10cSrcweir
334cdf0e10cSrcweir if( n_hStoreHandle != NULL )
335cdf0e10cSrcweir CertCloseStore( n_hStoreHandle, CERT_CLOSE_STORE_FORCE_FLAG ) ;
336cdf0e10cSrcweir
337cdf0e10cSrcweir xmlSecMSCryptoAppShutdown() ;
338cdf0e10cSrcweir
339cdf0e10cSrcweir /* Shutdown libxslt/libxml */
340cdf0e10cSrcweir #ifndef XMLSEC_NO_XSLT
341cdf0e10cSrcweir xsltCleanupGlobals();
342cdf0e10cSrcweir #endif /* XMLSEC_NO_XSLT */
343cdf0e10cSrcweir xmlCleanupParser();
344cdf0e10cSrcweir
345cdf0e10cSrcweir }
346cdf0e10cSrcweir
347cdf0e10cSrcweir return 0 ;
348cdf0e10cSrcweir }
349cdf0e10cSrcweir
350