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 #ifndef _SIGNATURECREATORIMPL_HXX 25 #define _SIGNATURECREATORIMPL_HXX 26 27 #include <com/sun/star/xml/crypto/sax/XBlockerMonitor.hpp> 28 #include <com/sun/star/xml/crypto/sax/XSignatureCreationResultListener.hpp> 29 #include <com/sun/star/xml/crypto/sax/XSignatureCreationResultBroadcaster.hpp> 30 #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp> 31 #include <com/sun/star/lang/XInitialization.hpp> 32 #include <com/sun/star/lang/XServiceInfo.hpp> 33 #include <cppuhelper/implbase4.hxx> 34 35 #include "signatureengine.hxx" 36 37 class SignatureCreatorImpl : public cppu::ImplInheritanceHelper4 38 < 39 SignatureEngine, 40 com::sun::star::xml::crypto::sax::XBlockerMonitor, 41 com::sun::star::xml::crypto::sax::XSignatureCreationResultBroadcaster, 42 com::sun::star::lang::XInitialization, 43 com::sun::star::lang::XServiceInfo 44 > 45 /****** SignatureCreatorImpl.hxx/CLASS SignatureCreatorImpl ******************* 46 * 47 * NAME 48 * SignatureCreatorImpl -- generates a signature 49 * 50 * FUNCTION 51 * Collects all resources for a signature generation, then generates the 52 * signature by invoking a xmlsec-based signature bridge component. 53 * 54 * HISTORY 55 * 05.01.2004 - Interface supported: XBlockerMonitor, 56 * XInitialization, XServiceInfo 57 * 58 * AUTHOR 59 * Michael Mi 60 * Email: michael.mi@sun.com 61 ******************************************************************************/ 62 { 63 private: 64 /* 65 * the Id of the signature, which is used for the result listener to 66 * identify the signature. 67 */ 68 sal_Int32 m_nSignatureId; 69 70 /* 71 * the Id of template blocker. 72 */ 73 sal_Int32 m_nIdOfBlocker; 74 75 /* 76 * the signature creation result 77 */ 78 bool m_bCreationSucceed; 79 80 com::sun::star::uno::Reference< 81 com::sun::star::xml::crypto::XSecurityEnvironment > m_xSecurityEnvironment; 82 83 virtual void notifyResultListener() const; 84 virtual void clearUp( ) const; 85 virtual bool checkReady() const; 86 virtual void startEngine( const com::sun::star::uno::Reference< 87 com::sun::star::xml::crypto::XXMLSignatureTemplate >& 88 xSignatureTemplate); 89 90 public: 91 explicit SignatureCreatorImpl( const com::sun::star::uno::Reference< 92 com::sun::star::lang::XMultiServiceFactory >& rxMSF); 93 virtual ~SignatureCreatorImpl(); 94 95 /* XBlockerMonitor */ 96 virtual void SAL_CALL setBlockerId( sal_Int32 id ); 97 98 /* XSignatureCreationResultBroadcaster */ 99 void SAL_CALL addSignatureCreationResultListener( 100 const com::sun::star::uno::Reference< 101 com::sun::star::xml::crypto::sax::XSignatureCreationResultListener >& listener ); 102 103 void SAL_CALL removeSignatureCreationResultListener( 104 const com::sun::star::uno::Reference< 105 com::sun::star::xml::crypto::sax::XSignatureCreationResultListener >& listener ); 106 107 /* XInitialization */ 108 virtual void SAL_CALL initialize( 109 const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArguments ); 110 111 /* XServiceInfo */ 112 virtual rtl::OUString SAL_CALL getImplementationName( ); 113 virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ); 114 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames( ); 115 }; 116 117 rtl::OUString SignatureCreatorImpl_getImplementationName(); 118 119 sal_Bool SAL_CALL SignatureCreatorImpl_supportsService( const rtl::OUString& ServiceName ); 120 121 com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL SignatureCreatorImpl_getSupportedServiceNames( ); 122 123 com::sun::star::uno::Reference< com::sun::star::uno::XInterface > 124 SAL_CALL SignatureCreatorImpl_createInstance( 125 const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rSMgr); 126 127 #endif 128