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 _DECRYPTORIMPL_HXX 25 #define _DECRYPTORIMPL_HXX 26 27 #include <com/sun/star/xml/crypto/sax/XDecryptionResultBroadcaster.hpp> 28 #include <com/sun/star/xml/crypto/sax/XDecryptionResultListener.hpp> 29 #include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp> 30 #include <com/sun/star/lang/XInitialization.hpp> 31 #include <com/sun/star/lang/XServiceInfo.hpp> 32 #include <cppuhelper/implbase3.hxx> 33 34 #include "encryptionengine.hxx" 35 36 class DecryptorImpl : public cppu::ImplInheritanceHelper3 37 < 38 EncryptionEngine, 39 com::sun::star::xml::crypto::sax::XDecryptionResultBroadcaster, 40 com::sun::star::lang::XInitialization, 41 com::sun::star::lang::XServiceInfo 42 > 43 /****** DecryptorImpl.hxx/CLASS DecryptorImpl ********************************* 44 * 45 * NAME 46 * DecryptorImpl -- decrypts an encryption 47 * 48 * FUNCTION 49 * Collects all resources for decrypting an encryption, then decrypts the 50 * encryption by invoking a xmlsec-based encryption bridge component. 51 * 52 * HISTORY 53 * 05.01.2004 - Interface supported: XDecryptionResultBroadcaster, 54 * XInitialization, XServiceInfo 55 * 56 * AUTHOR 57 * Michael Mi 58 * Email: michael.mi@sun.com 59 ******************************************************************************/ 60 { 61 private: 62 /* 63 * the Id of the encryption, which is used for the result listener to 64 * identify the encryption. 65 */ 66 sal_Int32 m_nEncryptionId; 67 68 /* 69 * the decryption result, 70 * remembers whether the decryption succeeds. 71 */ 72 bool m_bDecryptionSucceed; 73 74 com::sun::star::uno::Reference< 75 com::sun::star::xml::crypto::XXMLSecurityContext > m_xXMLSecurityContext; 76 77 virtual void notifyResultListener() const; 78 virtual bool checkReady() const; 79 virtual void startEngine( const com::sun::star::uno::Reference< 80 com::sun::star::xml::crypto::XXMLEncryptionTemplate >& 81 xEncryptionTemplate); 82 83 public: 84 explicit DecryptorImpl( const com::sun::star::uno::Reference< 85 com::sun::star::lang::XMultiServiceFactory >& rxMSF); 86 virtual ~DecryptorImpl(); 87 88 /* XDecryptionResultBroadcaster */ 89 virtual void SAL_CALL addDecryptionResultListener( 90 const com::sun::star::uno::Reference< 91 com::sun::star::xml::crypto::sax::XDecryptionResultListener >& 92 listener ); 93 virtual void SAL_CALL removeDecryptionResultListener( 94 const com::sun::star::uno::Reference< 95 com::sun::star::xml::crypto::sax::XDecryptionResultListener >& 96 listener ); 97 98 /* XInitialization */ 99 virtual void SAL_CALL initialize( 100 const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArguments ); 101 102 /* XServiceInfo */ 103 virtual rtl::OUString SAL_CALL getImplementationName( ); 104 virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ); 105 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames( ); 106 }; 107 108 rtl::OUString DecryptorImpl_getImplementationName(); 109 110 sal_Bool SAL_CALL DecryptorImpl_supportsService( const rtl::OUString& ServiceName ); 111 112 com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL DecryptorImpl_getSupportedServiceNames( ); 113 114 com::sun::star::uno::Reference< com::sun::star::uno::XInterface > 115 SAL_CALL DecryptorImpl_createInstance( 116 const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& 117 rSMgr); 118 119 #endif 120