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 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); 79 virtual bool checkReady() const; 80 virtual void startEngine( const com::sun::star::uno::Reference< 81 com::sun::star::xml::crypto::XXMLEncryptionTemplate >& 82 xEncryptionTemplate) 83 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); 84 85 public: 86 explicit DecryptorImpl( const com::sun::star::uno::Reference< 87 com::sun::star::lang::XMultiServiceFactory >& rxMSF); 88 virtual ~DecryptorImpl(); 89 90 /* XDecryptionResultBroadcaster */ 91 virtual void SAL_CALL addDecryptionResultListener( 92 const com::sun::star::uno::Reference< 93 com::sun::star::xml::crypto::sax::XDecryptionResultListener >& 94 listener ) 95 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); 96 virtual void SAL_CALL removeDecryptionResultListener( 97 const com::sun::star::uno::Reference< 98 com::sun::star::xml::crypto::sax::XDecryptionResultListener >& 99 listener ) 100 throw (com::sun::star::uno::RuntimeException); 101 102 /* XInitialization */ 103 virtual void SAL_CALL initialize( 104 const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArguments ) 105 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException); 106 107 /* XServiceInfo */ 108 virtual rtl::OUString SAL_CALL getImplementationName( ) 109 throw (com::sun::star::uno::RuntimeException); 110 virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) 111 throw (com::sun::star::uno::RuntimeException); 112 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames( ) 113 throw (com::sun::star::uno::RuntimeException); 114 }; 115 116 rtl::OUString DecryptorImpl_getImplementationName() 117 throw ( com::sun::star::uno::RuntimeException ); 118 119 sal_Bool SAL_CALL DecryptorImpl_supportsService( const rtl::OUString& ServiceName ) 120 throw ( com::sun::star::uno::RuntimeException ); 121 122 com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL DecryptorImpl_getSupportedServiceNames( ) 123 throw ( com::sun::star::uno::RuntimeException ); 124 125 com::sun::star::uno::Reference< com::sun::star::uno::XInterface > 126 SAL_CALL DecryptorImpl_createInstance( 127 const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& 128 rSMgr) 129 throw ( com::sun::star::uno::Exception ); 130 131 #endif 132 133