1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
28 #ifndef _ENCRYPTORIMPL_HXX
29 #define _ENCRYPTORIMPL_HXX
31 #include <com/sun/star/xml/crypto/sax/XEncryptionResultBroadcaster.hpp>
32 #include <com/sun/star/xml/crypto/sax/XEncryptionResultListener.hpp>
33 #ifndef _COM_SUN_STAR_XML_CRYPTO_SAX_XSIGNATURECOLLECTOR_HPP_
34 #include <com/sun/star/xml/crypto/sax/XReferenceCollector.hpp>
36 #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
37 #include <com/sun/star/lang/XInitialization.hpp>
38 #include <com/sun/star/lang/XServiceInfo.hpp>
39 #include <cppuhelper/implbase4.hxx>
41 #include "encryptionengine.hxx"
43 class EncryptorImpl
: public cppu::ImplInheritanceHelper4
46 com::sun::star::xml::crypto::sax::XEncryptionResultBroadcaster
,
47 com::sun::star::xml::crypto::sax::XReferenceCollector
,
48 com::sun::star::lang::XInitialization
,
49 com::sun::star::lang::XServiceInfo
51 /****** EncryptorImpl.hxx/CLASS EncryptorImpl *********************************
54 * EncryptorImpl -- generates an encryption
57 * Collects all resources for an encryption generation, then generates the
58 * encryption by invoking a xmlsec-based encryption bridge component.
61 * 05.01.2004 - Interface supported: XInitialization, XServiceInfo
65 * Email: michael.mi@sun.com
66 ******************************************************************************/
70 * the Id of the encryption, which is used for the result listener to
71 * identify the encryption.
73 sal_Int32 m_nEncryptionId
;
76 * the Id of the element to be encrypted.
78 sal_Int32 m_nReferenceId
;
81 * the decryption result,
82 * remembers whether the encryption succeeds.
84 bool m_bEncryptionSucceed
;
86 com::sun::star::uno::Reference
<
87 com::sun::star::xml::crypto::XSecurityEnvironment
> m_xSecurityEnvironment
;
89 virtual void notifyResultListener() const
90 throw (com::sun::star::uno::Exception
, com::sun::star::uno::RuntimeException
);
91 virtual bool checkReady() const;
92 virtual void startEngine( const com::sun::star::uno::Reference
<
93 com::sun::star::xml::crypto::XXMLEncryptionTemplate
>&
95 throw (com::sun::star::uno::Exception
, com::sun::star::uno::RuntimeException
);
98 explicit EncryptorImpl( const com::sun::star::uno::Reference
<
99 com::sun::star::lang::XMultiServiceFactory
>& rxMSF
);
100 virtual ~EncryptorImpl();
102 /* XEncryptionResultBroadcaster */
103 virtual void SAL_CALL
addEncryptionResultListener(
104 const com::sun::star::uno::Reference
<
105 com::sun::star::xml::crypto::sax::XEncryptionResultListener
>&
107 throw (com::sun::star::uno::Exception
, com::sun::star::uno::RuntimeException
);
108 virtual void SAL_CALL
removeEncryptionResultListener(
109 const com::sun::star::uno::Reference
<
110 com::sun::star::xml::crypto::sax::XEncryptionResultListener
>&
112 throw (com::sun::star::uno::RuntimeException
);
114 /* XReferenceCollector */
115 virtual void SAL_CALL
setReferenceCount( sal_Int32 count
)
116 throw (com::sun::star::uno::Exception
, com::sun::star::uno::RuntimeException
);
118 virtual void SAL_CALL
setReferenceId( sal_Int32 id
)
119 throw (com::sun::star::uno::Exception
, com::sun::star::uno::RuntimeException
);
121 /* XInitialization */
122 virtual void SAL_CALL
initialize(
123 const com::sun::star::uno::Sequence
< com::sun::star::uno::Any
>& aArguments
)
124 throw (com::sun::star::uno::Exception
, com::sun::star::uno::RuntimeException
);
127 virtual rtl::OUString SAL_CALL
getImplementationName( )
128 throw (com::sun::star::uno::RuntimeException
);
129 virtual sal_Bool SAL_CALL
supportsService( const rtl::OUString
& ServiceName
)
130 throw (com::sun::star::uno::RuntimeException
);
131 virtual com::sun::star::uno::Sequence
< rtl::OUString
> SAL_CALL
getSupportedServiceNames( )
132 throw (com::sun::star::uno::RuntimeException
);
135 rtl::OUString
EncryptorImpl_getImplementationName()
136 throw ( com::sun::star::uno::RuntimeException
);
138 sal_Bool SAL_CALL
EncryptorImpl_supportsService( const rtl::OUString
& ServiceName
)
139 throw ( com::sun::star::uno::RuntimeException
);
141 com::sun::star::uno::Sequence
< rtl::OUString
> SAL_CALL
EncryptorImpl_getSupportedServiceNames( )
142 throw ( com::sun::star::uno::RuntimeException
);
144 com::sun::star::uno::Reference
< com::sun::star::uno::XInterface
>
145 SAL_CALL
EncryptorImpl_createInstance(
146 const com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
>& rSMgr
)
147 throw ( com::sun::star::uno::Exception
);