1*ec61c6edSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*ec61c6edSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*ec61c6edSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*ec61c6edSAndrew Rist * distributed with this work for additional information 6*ec61c6edSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*ec61c6edSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*ec61c6edSAndrew Rist * "License"); you may not use this file except in compliance 9*ec61c6edSAndrew Rist * with the License. You may obtain a copy of the License at 10*ec61c6edSAndrew Rist * 11*ec61c6edSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*ec61c6edSAndrew Rist * 13*ec61c6edSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*ec61c6edSAndrew Rist * software distributed under the License is distributed on an 15*ec61c6edSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*ec61c6edSAndrew Rist * KIND, either express or implied. See the License for the 17*ec61c6edSAndrew Rist * specific language governing permissions and limitations 18*ec61c6edSAndrew Rist * under the License. 19*ec61c6edSAndrew Rist * 20*ec61c6edSAndrew Rist *************************************************************/ 21*ec61c6edSAndrew Rist 22*ec61c6edSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _ENCRYPTORIMPL_HXX 25cdf0e10cSrcweir #define _ENCRYPTORIMPL_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/xml/crypto/sax/XEncryptionResultBroadcaster.hpp> 28cdf0e10cSrcweir #include <com/sun/star/xml/crypto/sax/XEncryptionResultListener.hpp> 29cdf0e10cSrcweir #ifndef _COM_SUN_STAR_XML_CRYPTO_SAX_XSIGNATURECOLLECTOR_HPP_ 30cdf0e10cSrcweir #include <com/sun/star/xml/crypto/sax/XReferenceCollector.hpp> 31cdf0e10cSrcweir #endif 32cdf0e10cSrcweir #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp> 33cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp> 34cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 35cdf0e10cSrcweir #include <cppuhelper/implbase4.hxx> 36cdf0e10cSrcweir 37cdf0e10cSrcweir #include "encryptionengine.hxx" 38cdf0e10cSrcweir 39cdf0e10cSrcweir class EncryptorImpl : public cppu::ImplInheritanceHelper4 40cdf0e10cSrcweir < 41cdf0e10cSrcweir EncryptionEngine, 42cdf0e10cSrcweir com::sun::star::xml::crypto::sax::XEncryptionResultBroadcaster, 43cdf0e10cSrcweir com::sun::star::xml::crypto::sax::XReferenceCollector, 44cdf0e10cSrcweir com::sun::star::lang::XInitialization, 45cdf0e10cSrcweir com::sun::star::lang::XServiceInfo 46cdf0e10cSrcweir > 47cdf0e10cSrcweir /****** EncryptorImpl.hxx/CLASS EncryptorImpl ********************************* 48cdf0e10cSrcweir * 49cdf0e10cSrcweir * NAME 50cdf0e10cSrcweir * EncryptorImpl -- generates an encryption 51cdf0e10cSrcweir * 52cdf0e10cSrcweir * FUNCTION 53cdf0e10cSrcweir * Collects all resources for an encryption generation, then generates the 54cdf0e10cSrcweir * encryption by invoking a xmlsec-based encryption bridge component. 55cdf0e10cSrcweir * 56cdf0e10cSrcweir * HISTORY 57cdf0e10cSrcweir * 05.01.2004 - Interface supported: XInitialization, XServiceInfo 58cdf0e10cSrcweir * 59cdf0e10cSrcweir * AUTHOR 60cdf0e10cSrcweir * Michael Mi 61cdf0e10cSrcweir * Email: michael.mi@sun.com 62cdf0e10cSrcweir ******************************************************************************/ 63cdf0e10cSrcweir { 64cdf0e10cSrcweir private: 65cdf0e10cSrcweir /* 66cdf0e10cSrcweir * the Id of the encryption, which is used for the result listener to 67cdf0e10cSrcweir * identify the encryption. 68cdf0e10cSrcweir */ 69cdf0e10cSrcweir sal_Int32 m_nEncryptionId; 70cdf0e10cSrcweir 71cdf0e10cSrcweir /* 72cdf0e10cSrcweir * the Id of the element to be encrypted. 73cdf0e10cSrcweir */ 74cdf0e10cSrcweir sal_Int32 m_nReferenceId; 75cdf0e10cSrcweir 76cdf0e10cSrcweir /* 77cdf0e10cSrcweir * the decryption result, 78cdf0e10cSrcweir * remembers whether the encryption succeeds. 79cdf0e10cSrcweir */ 80cdf0e10cSrcweir bool m_bEncryptionSucceed; 81cdf0e10cSrcweir 82cdf0e10cSrcweir com::sun::star::uno::Reference< 83cdf0e10cSrcweir com::sun::star::xml::crypto::XSecurityEnvironment > m_xSecurityEnvironment; 84cdf0e10cSrcweir 85cdf0e10cSrcweir virtual void notifyResultListener() const 86cdf0e10cSrcweir throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); 87cdf0e10cSrcweir virtual bool checkReady() const; 88cdf0e10cSrcweir virtual void startEngine( const com::sun::star::uno::Reference< 89cdf0e10cSrcweir com::sun::star::xml::crypto::XXMLEncryptionTemplate >& 90cdf0e10cSrcweir xEncryptionTemplate) 91cdf0e10cSrcweir throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); 92cdf0e10cSrcweir 93cdf0e10cSrcweir public: 94cdf0e10cSrcweir explicit EncryptorImpl( const com::sun::star::uno::Reference< 95cdf0e10cSrcweir com::sun::star::lang::XMultiServiceFactory >& rxMSF); 96cdf0e10cSrcweir virtual ~EncryptorImpl(); 97cdf0e10cSrcweir 98cdf0e10cSrcweir /* XEncryptionResultBroadcaster */ 99cdf0e10cSrcweir virtual void SAL_CALL addEncryptionResultListener( 100cdf0e10cSrcweir const com::sun::star::uno::Reference< 101cdf0e10cSrcweir com::sun::star::xml::crypto::sax::XEncryptionResultListener >& 102cdf0e10cSrcweir listener ) 103cdf0e10cSrcweir throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); 104cdf0e10cSrcweir virtual void SAL_CALL removeEncryptionResultListener( 105cdf0e10cSrcweir const com::sun::star::uno::Reference< 106cdf0e10cSrcweir com::sun::star::xml::crypto::sax::XEncryptionResultListener >& 107cdf0e10cSrcweir listener ) 108cdf0e10cSrcweir throw (com::sun::star::uno::RuntimeException); 109cdf0e10cSrcweir 110cdf0e10cSrcweir /* XReferenceCollector */ 111cdf0e10cSrcweir virtual void SAL_CALL setReferenceCount( sal_Int32 count ) 112cdf0e10cSrcweir throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); 113cdf0e10cSrcweir 114cdf0e10cSrcweir virtual void SAL_CALL setReferenceId( sal_Int32 id ) 115cdf0e10cSrcweir throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); 116cdf0e10cSrcweir 117cdf0e10cSrcweir /* XInitialization */ 118cdf0e10cSrcweir virtual void SAL_CALL initialize( 119cdf0e10cSrcweir const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArguments ) 120cdf0e10cSrcweir throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); 121cdf0e10cSrcweir 122cdf0e10cSrcweir /* XServiceInfo */ 123cdf0e10cSrcweir virtual rtl::OUString SAL_CALL getImplementationName( ) 124cdf0e10cSrcweir throw (com::sun::star::uno::RuntimeException); 125cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) 126cdf0e10cSrcweir throw (com::sun::star::uno::RuntimeException); 127cdf0e10cSrcweir virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames( ) 128cdf0e10cSrcweir throw (com::sun::star::uno::RuntimeException); 129cdf0e10cSrcweir }; 130cdf0e10cSrcweir 131cdf0e10cSrcweir rtl::OUString EncryptorImpl_getImplementationName() 132cdf0e10cSrcweir throw ( com::sun::star::uno::RuntimeException ); 133cdf0e10cSrcweir 134cdf0e10cSrcweir sal_Bool SAL_CALL EncryptorImpl_supportsService( const rtl::OUString& ServiceName ) 135cdf0e10cSrcweir throw ( com::sun::star::uno::RuntimeException ); 136cdf0e10cSrcweir 137cdf0e10cSrcweir com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL EncryptorImpl_getSupportedServiceNames( ) 138cdf0e10cSrcweir throw ( com::sun::star::uno::RuntimeException ); 139cdf0e10cSrcweir 140cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::uno::XInterface > 141cdf0e10cSrcweir SAL_CALL EncryptorImpl_createInstance( 142cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rSMgr) 143cdf0e10cSrcweir throw ( com::sun::star::uno::Exception ); 144cdf0e10cSrcweir 145cdf0e10cSrcweir #endif 146cdf0e10cSrcweir 147