1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_xmlsecurity.hxx" 26 27 #include "securityengine.hxx" 28 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 29 30 namespace cssu = com::sun::star::uno; 31 namespace cssl = com::sun::star::lang; 32 namespace cssxc = com::sun::star::xml::crypto; 33 namespace cssxw = com::sun::star::xml::wrapper; 34 35 #define DECLARE_ASCII( SASCIIVALUE ) \ 36 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SASCIIVALUE ) ) 37 38 SecurityEngine::SecurityEngine( const cssu::Reference< cssl::XMultiServiceFactory >& rxMSF ) 39 :mxMSF( rxMSF ), 40 m_nIdOfTemplateEC(-1), 41 m_nNumOfResolvedReferences(0), 42 m_nIdOfKeyEC(-1), 43 m_bMissionDone(false), 44 m_nSecurityId(-1), 45 m_nStatus(::com::sun::star::xml::crypto::SecurityOperationStatus_UNKNOWN) 46 { 47 } 48 49 /* XReferenceResolvedListener */ 50 void SAL_CALL SecurityEngine::referenceResolved( sal_Int32 /*referenceId*/) 51 { 52 m_nNumOfResolvedReferences++; 53 tryToPerform(); 54 } 55 56 /* XKeyCollector */ 57 void SAL_CALL SecurityEngine::setKeyId( sal_Int32 id ) 58 { 59 m_nIdOfKeyEC = id; 60 tryToPerform(); 61 } 62 63 /* XMissionTaker */ 64 sal_Bool SAL_CALL SecurityEngine::endMission( ) 65 { 66 sal_Bool rc = m_bMissionDone; 67 68 if (!rc) 69 { 70 clearUp( ); 71 72 notifyResultListener(); 73 m_bMissionDone = true; 74 } 75 76 m_xResultListener = NULL; 77 m_xSAXEventKeeper = NULL; 78 79 return rc; 80 } 81