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 _ENCRYPTORIMPL_HXX 25 #define _ENCRYPTORIMPL_HXX 26 27 #include <com/sun/star/xml/crypto/sax/XEncryptionResultBroadcaster.hpp> 28 #include <com/sun/star/xml/crypto/sax/XEncryptionResultListener.hpp> 29 #ifndef _COM_SUN_STAR_XML_CRYPTO_SAX_XSIGNATURECOLLECTOR_HPP_ 30 #include <com/sun/star/xml/crypto/sax/XReferenceCollector.hpp> 31 #endif 32 #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp> 33 #include <com/sun/star/lang/XInitialization.hpp> 34 #include <com/sun/star/lang/XServiceInfo.hpp> 35 #include <cppuhelper/implbase4.hxx> 36 37 #include "encryptionengine.hxx" 38 39 class EncryptorImpl : public cppu::ImplInheritanceHelper4 40 < 41 EncryptionEngine, 42 com::sun::star::xml::crypto::sax::XEncryptionResultBroadcaster, 43 com::sun::star::xml::crypto::sax::XReferenceCollector, 44 com::sun::star::lang::XInitialization, 45 com::sun::star::lang::XServiceInfo 46 > 47 /****** EncryptorImpl.hxx/CLASS EncryptorImpl ********************************* 48 * 49 * NAME 50 * EncryptorImpl -- generates an encryption 51 * 52 * FUNCTION 53 * Collects all resources for an encryption generation, then generates the 54 * encryption by invoking a xmlsec-based encryption bridge component. 55 * 56 * HISTORY 57 * 05.01.2004 - Interface supported: XInitialization, XServiceInfo 58 * 59 * AUTHOR 60 * Michael Mi 61 * Email: michael.mi@sun.com 62 ******************************************************************************/ 63 { 64 private: 65 /* 66 * the Id of the encryption, which is used for the result listener to 67 * identify the encryption. 68 */ 69 sal_Int32 m_nEncryptionId; 70 71 /* 72 * the Id of the element to be encrypted. 73 */ 74 sal_Int32 m_nReferenceId; 75 76 /* 77 * the decryption result, 78 * remembers whether the encryption succeeds. 79 */ 80 bool m_bEncryptionSucceed; 81 82 com::sun::star::uno::Reference< 83 com::sun::star::xml::crypto::XSecurityEnvironment > m_xSecurityEnvironment; 84 85 virtual void notifyResultListener() const; 86 virtual bool checkReady() const; 87 virtual void startEngine( const com::sun::star::uno::Reference< 88 com::sun::star::xml::crypto::XXMLEncryptionTemplate >& 89 xEncryptionTemplate); 90 91 public: 92 explicit EncryptorImpl( const com::sun::star::uno::Reference< 93 com::sun::star::lang::XMultiServiceFactory >& rxMSF); 94 virtual ~EncryptorImpl(); 95 96 /* XEncryptionResultBroadcaster */ 97 virtual void SAL_CALL addEncryptionResultListener( 98 const com::sun::star::uno::Reference< 99 com::sun::star::xml::crypto::sax::XEncryptionResultListener >& 100 listener ); 101 virtual void SAL_CALL removeEncryptionResultListener( 102 const com::sun::star::uno::Reference< 103 com::sun::star::xml::crypto::sax::XEncryptionResultListener >& 104 listener ); 105 106 /* XReferenceCollector */ 107 virtual void SAL_CALL setReferenceCount( sal_Int32 count ); 108 109 virtual void SAL_CALL setReferenceId( sal_Int32 id ); 110 111 /* XInitialization */ 112 virtual void SAL_CALL initialize( 113 const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArguments ); 114 115 /* XServiceInfo */ 116 virtual rtl::OUString SAL_CALL getImplementationName( ); 117 virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ); 118 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames( ); 119 }; 120 121 rtl::OUString EncryptorImpl_getImplementationName(); 122 123 sal_Bool SAL_CALL EncryptorImpl_supportsService( const rtl::OUString& ServiceName ); 124 125 com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL EncryptorImpl_getSupportedServiceNames( ); 126 127 com::sun::star::uno::Reference< com::sun::star::uno::XInterface > 128 SAL_CALL EncryptorImpl_createInstance( 129 const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rSMgr); 130 131 #endif 132