1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: encryptorimpl.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _ENCRYPTORIMPL_HXX
32 #define _ENCRYPTORIMPL_HXX
34 #include <com/sun/star/xml/crypto/sax/XEncryptionResultBroadcaster.hpp>
35 #include <com/sun/star/xml/crypto/sax/XEncryptionResultListener.hpp>
36 #ifndef _COM_SUN_STAR_XML_CRYPTO_SAX_XSIGNATURECOLLECTOR_HPP_
37 #include <com/sun/star/xml/crypto/sax/XReferenceCollector.hpp>
39 #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
40 #include <com/sun/star/lang/XInitialization.hpp>
41 #include <com/sun/star/lang/XServiceInfo.hpp>
42 #include <cppuhelper/implbase4.hxx>
44 #include "encryptionengine.hxx"
46 class EncryptorImpl
: public cppu::ImplInheritanceHelper4
49 com::sun::star::xml::crypto::sax::XEncryptionResultBroadcaster
,
50 com::sun::star::xml::crypto::sax::XReferenceCollector
,
51 com::sun::star::lang::XInitialization
,
52 com::sun::star::lang::XServiceInfo
54 /****** EncryptorImpl.hxx/CLASS EncryptorImpl *********************************
57 * EncryptorImpl -- generates an encryption
60 * Collects all resources for an encryption generation, then generates the
61 * encryption by invoking a xmlsec-based encryption bridge component.
64 * 05.01.2004 - Interface supported: XInitialization, XServiceInfo
68 * Email: michael.mi@sun.com
69 ******************************************************************************/
73 * the Id of the encryption, which is used for the result listener to
74 * identify the encryption.
76 sal_Int32 m_nEncryptionId
;
79 * the Id of the element to be encrypted.
81 sal_Int32 m_nReferenceId
;
84 * the decryption result,
85 * remembers whether the encryption succeeds.
87 bool m_bEncryptionSucceed
;
89 com::sun::star::uno::Reference
<
90 com::sun::star::xml::crypto::XSecurityEnvironment
> m_xSecurityEnvironment
;
92 virtual void notifyResultListener() const
93 throw (com::sun::star::uno::Exception
, com::sun::star::uno::RuntimeException
);
94 virtual bool checkReady() const;
95 virtual void startEngine( const com::sun::star::uno::Reference
<
96 com::sun::star::xml::crypto::XXMLEncryptionTemplate
>&
98 throw (com::sun::star::uno::Exception
, com::sun::star::uno::RuntimeException
);
101 explicit EncryptorImpl( const com::sun::star::uno::Reference
<
102 com::sun::star::lang::XMultiServiceFactory
>& rxMSF
);
103 virtual ~EncryptorImpl();
105 /* XEncryptionResultBroadcaster */
106 virtual void SAL_CALL
addEncryptionResultListener(
107 const com::sun::star::uno::Reference
<
108 com::sun::star::xml::crypto::sax::XEncryptionResultListener
>&
110 throw (com::sun::star::uno::Exception
, com::sun::star::uno::RuntimeException
);
111 virtual void SAL_CALL
removeEncryptionResultListener(
112 const com::sun::star::uno::Reference
<
113 com::sun::star::xml::crypto::sax::XEncryptionResultListener
>&
115 throw (com::sun::star::uno::RuntimeException
);
117 /* XReferenceCollector */
118 virtual void SAL_CALL
setReferenceCount( sal_Int32 count
)
119 throw (com::sun::star::uno::Exception
, com::sun::star::uno::RuntimeException
);
121 virtual void SAL_CALL
setReferenceId( sal_Int32 id
)
122 throw (com::sun::star::uno::Exception
, com::sun::star::uno::RuntimeException
);
124 /* XInitialization */
125 virtual void SAL_CALL
initialize(
126 const com::sun::star::uno::Sequence
< com::sun::star::uno::Any
>& aArguments
)
127 throw (com::sun::star::uno::Exception
, com::sun::star::uno::RuntimeException
);
130 virtual rtl::OUString SAL_CALL
getImplementationName( )
131 throw (com::sun::star::uno::RuntimeException
);
132 virtual sal_Bool SAL_CALL
supportsService( const rtl::OUString
& ServiceName
)
133 throw (com::sun::star::uno::RuntimeException
);
134 virtual com::sun::star::uno::Sequence
< rtl::OUString
> SAL_CALL
getSupportedServiceNames( )
135 throw (com::sun::star::uno::RuntimeException
);
138 rtl::OUString
EncryptorImpl_getImplementationName()
139 throw ( com::sun::star::uno::RuntimeException
);
141 sal_Bool SAL_CALL
EncryptorImpl_supportsService( const rtl::OUString
& ServiceName
)
142 throw ( com::sun::star::uno::RuntimeException
);
144 com::sun::star::uno::Sequence
< rtl::OUString
> SAL_CALL
EncryptorImpl_getSupportedServiceNames( )
145 throw ( com::sun::star::uno::RuntimeException
);
147 com::sun::star::uno::Reference
< com::sun::star::uno::XInterface
>
148 SAL_CALL
EncryptorImpl_createInstance(
149 const com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
>& rSMgr
)
150 throw ( com::sun::star::uno::Exception
);