1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _DECRYPTORIMPL_HXX 29 #define _DECRYPTORIMPL_HXX 30 31 #include <com/sun/star/xml/crypto/sax/XDecryptionResultBroadcaster.hpp> 32 #include <com/sun/star/xml/crypto/sax/XDecryptionResultListener.hpp> 33 #include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp> 34 #include <com/sun/star/lang/XInitialization.hpp> 35 #include <com/sun/star/lang/XServiceInfo.hpp> 36 #include <cppuhelper/implbase3.hxx> 37 38 #include "encryptionengine.hxx" 39 40 class DecryptorImpl : public cppu::ImplInheritanceHelper3 41 < 42 EncryptionEngine, 43 com::sun::star::xml::crypto::sax::XDecryptionResultBroadcaster, 44 com::sun::star::lang::XInitialization, 45 com::sun::star::lang::XServiceInfo 46 > 47 /****** DecryptorImpl.hxx/CLASS DecryptorImpl ********************************* 48 * 49 * NAME 50 * DecryptorImpl -- decrypts an encryption 51 * 52 * FUNCTION 53 * Collects all resources for decrypting an encryption, then decrypts the 54 * encryption by invoking a xmlsec-based encryption bridge component. 55 * 56 * HISTORY 57 * 05.01.2004 - Interface supported: XDecryptionResultBroadcaster, 58 * XInitialization, XServiceInfo 59 * 60 * AUTHOR 61 * Michael Mi 62 * Email: michael.mi@sun.com 63 ******************************************************************************/ 64 { 65 private: 66 /* 67 * the Id of the encryption, which is used for the result listener to 68 * identify the encryption. 69 */ 70 sal_Int32 m_nEncryptionId; 71 72 /* 73 * the decryption result, 74 * remembers whether the decryption succeeds. 75 */ 76 bool m_bDecryptionSucceed; 77 78 com::sun::star::uno::Reference< 79 com::sun::star::xml::crypto::XXMLSecurityContext > m_xXMLSecurityContext; 80 81 virtual void notifyResultListener() const 82 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); 83 virtual bool checkReady() const; 84 virtual void startEngine( const com::sun::star::uno::Reference< 85 com::sun::star::xml::crypto::XXMLEncryptionTemplate >& 86 xEncryptionTemplate) 87 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); 88 89 public: 90 explicit DecryptorImpl( const com::sun::star::uno::Reference< 91 com::sun::star::lang::XMultiServiceFactory >& rxMSF); 92 virtual ~DecryptorImpl(); 93 94 /* XDecryptionResultBroadcaster */ 95 virtual void SAL_CALL addDecryptionResultListener( 96 const com::sun::star::uno::Reference< 97 com::sun::star::xml::crypto::sax::XDecryptionResultListener >& 98 listener ) 99 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); 100 virtual void SAL_CALL removeDecryptionResultListener( 101 const com::sun::star::uno::Reference< 102 com::sun::star::xml::crypto::sax::XDecryptionResultListener >& 103 listener ) 104 throw (com::sun::star::uno::RuntimeException); 105 106 /* XInitialization */ 107 virtual void SAL_CALL initialize( 108 const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArguments ) 109 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); 110 111 /* XServiceInfo */ 112 virtual rtl::OUString SAL_CALL getImplementationName( ) 113 throw (com::sun::star::uno::RuntimeException); 114 virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) 115 throw (com::sun::star::uno::RuntimeException); 116 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames( ) 117 throw (com::sun::star::uno::RuntimeException); 118 }; 119 120 rtl::OUString DecryptorImpl_getImplementationName() 121 throw ( com::sun::star::uno::RuntimeException ); 122 123 sal_Bool SAL_CALL DecryptorImpl_supportsService( const rtl::OUString& ServiceName ) 124 throw ( com::sun::star::uno::RuntimeException ); 125 126 com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL DecryptorImpl_getSupportedServiceNames( ) 127 throw ( com::sun::star::uno::RuntimeException ); 128 129 com::sun::star::uno::Reference< com::sun::star::uno::XInterface > 130 SAL_CALL DecryptorImpl_createInstance( 131 const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& 132 rSMgr) 133 throw ( com::sun::star::uno::Exception ); 134 135 #endif 136 137