xref: /trunk/main/xmlsecurity/source/helper/xmlsignaturehelper2.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
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 #include <tools/link.hxx>
25 #include <rtl/ustring.hxx>
26 
27 #include <cppuhelper/implbase1.hxx>
28 #include <cppuhelper/implbase3.hxx>
29 
30 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
31 #include <com/sun/star/xml/crypto/sax/XSignatureCreationResultListener.hpp>
32 #include <com/sun/star/xml/crypto/sax/XSignatureVerifyResultListener.hpp>
33 
34 namespace com {
35 namespace sun {
36 namespace star {
37 namespace io {
38     class XStream;
39     class XOutputStream;
40     class XInputStream; }
41 namespace embed {
42     class XStorage; }
43 }}}
44 
45 
46 // MT: Not needed any more, remove later...
47 
48 class ImplXMLSignatureListener : public cppu::WeakImplHelper3
49 <
50     com::sun::star::xml::crypto::sax::XSignatureCreationResultListener,
51     com::sun::star::xml::crypto::sax::XSignatureVerifyResultListener,
52     com::sun::star::xml::sax::XDocumentHandler
53 >
54 {
55 private:
56     Link        maCreationResultListenerListener;
57     Link        maVerifyResultListenerListener;
58     Link        maStartVerifySignatureElementListener;
59 
60     com::sun::star::uno::Reference<
61         com::sun::star::xml::sax::XDocumentHandler > m_xNextHandler;
62 
63 public:
64     ImplXMLSignatureListener( const Link& rCreationResultListenerListener, const Link rVerifyResultListenerListener, const Link rStartVerifySignatureElement );
65     ~ImplXMLSignatureListener();
66 
67     void setNextHandler(com::sun::star::uno::Reference<
68         com::sun::star::xml::sax::XDocumentHandler > xNextHandler);
69 
70     // com::sun::star::xml::crypto::sax::XSignatureCreationResultListener
71     virtual void SAL_CALL signatureCreated( sal_Int32 securityId, com::sun::star::xml::crypto::SecurityOperationStatus creationResult );
72 
73     // com::sun::star::xml::crypto::sax::XSignatureVerifyResultListener
74     virtual void SAL_CALL signatureVerified( sal_Int32 securityId, com::sun::star::xml::crypto::SecurityOperationStatus verifyResult );
75 
76     // com::sun::star::xml::sax::XDocumentHandler
77     virtual void SAL_CALL startElement( const rtl::OUString& aName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttribs );
78 
79     virtual void SAL_CALL startDocument(  );
80 
81     virtual void SAL_CALL endDocument(  );
82 
83     virtual void SAL_CALL endElement( const rtl::OUString& aName );
84 
85     virtual void SAL_CALL characters( const rtl::OUString& aChars );
86 
87     virtual void SAL_CALL ignorableWhitespace( const rtl::OUString& aWhitespaces );
88 
89     virtual void SAL_CALL processingInstruction( const rtl::OUString& aTarget, const rtl::OUString& aData );
90 
91     virtual void SAL_CALL setDocumentLocator( const com::sun::star::uno::Reference< com::sun::star::xml::sax::XLocator >& xLocator );
92 };
93 
94 
95 // ---------------------------------------------------------------------------------
96 // XUriBinding
97 // ---------------------------------------------------------------------------------
98 
99 class UriBindingHelper : public cppu::WeakImplHelper1
100 <
101     com::sun::star::xml::crypto::XUriBinding
102 >
103 {
104 private:
105     com::sun::star::uno::Reference < com::sun::star::embed::XStorage > mxStorage;
106 
107 
108 public:
109     UriBindingHelper();
110     UriBindingHelper( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rxStorage );
111 
112     void SAL_CALL setUriBinding( const rtl::OUString& uri, const com::sun::star::uno::Reference< com::sun::star::io::XInputStream >& aInputStream );
113 
114     com::sun::star::uno::Reference< com::sun::star::io::XInputStream > SAL_CALL getUriBinding( const rtl::OUString& uri );
115 
116     static com::sun::star::uno::Reference < com::sun::star::io::XInputStream > OpenInputStream( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rxStore, const rtl::OUString& rURI );
117 };
118