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 _XSEC_CTL_PARSER_HXX
29 #define _XSEC_CTL_PARSER_HXX
31 #include <xsecctl.hxx>
33 #include <com/sun/star/xml/sax/XParser.hpp>
34 #include <com/sun/star/lang/XInitialization.hpp>
35 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
36 #include <com/sun/star/xml/sax/XAttributeList.hpp>
38 #include <cppuhelper/implbase2.hxx>
40 class XSecParser
: public cppu::WeakImplHelper2
42 com::sun::star::xml::sax::XDocumentHandler
,
43 com::sun::star::lang::XInitialization
45 /****** XSecController.hxx/CLASS XSecParser ***********************************
48 * XSecParser -- a SAX parser that can detect security elements
51 * The XSecParser object is connected on the SAX chain and detects
52 * security elements in the SAX event stream, then notifies
56 * 05.01.2004 - Interface supported: XDocumentHandler, XInitialization
59 * This class is used when importing a document.
63 * Email: michael.mi@sun.com
64 ******************************************************************************/
66 friend class XSecController
;
69 * the following members are used to reserve the signature information,
70 * including X509IssuerName, X509SerialNumber, and X509Certificate,etc.
72 rtl::OUString m_ouX509IssuerName
;
73 rtl::OUString m_ouX509SerialNumber
;
74 rtl::OUString m_ouX509Certificate
;
75 rtl::OUString m_ouDigestValue
;
76 rtl::OUString m_ouSignatureValue
;
77 rtl::OUString m_ouDate
;
78 //rtl::OUString m_ouTime;
81 * whether inside a particular element
83 bool m_bInX509IssuerName
;
84 bool m_bInX509SerialNumber
;
85 bool m_bInX509Certificate
;
86 bool m_bInDigestValue
;
87 bool m_bInSignatureValue
;
92 * the XSecController collaborating with XSecParser
94 XSecController
* m_pXSecController
;
97 * the next XDocumentHandler on the SAX chain
99 com::sun::star::uno::Reference
<
100 com::sun::star::xml::sax::XDocumentHandler
> m_xNextHandler
;
103 * this string is used to remember the current handled reference's URI,
105 * because it can be decided whether a stream reference is xml based or binary based
106 * only after the Transforms element is read in, so we have to reserve the reference's
107 * URI when the startElement event is met.
109 rtl::OUString m_currentReferenceURI
;
110 bool m_bReferenceUnresolved
;
113 rtl::OUString
getIdAttr(const com::sun::star::uno::Reference
<
114 com::sun::star::xml::sax::XAttributeList
>& xAttribs
);
117 XSecParser( XSecController
* pXSecController
,
118 const com::sun::star::uno::Reference
<
119 com::sun::star::xml::sax::XDocumentHandler
>& xNextHandler
);
125 virtual void SAL_CALL
startDocument( )
126 throw (com::sun::star::xml::sax::SAXException
, com::sun::star::uno::RuntimeException
);
128 virtual void SAL_CALL
endDocument( )
129 throw (com::sun::star::xml::sax::SAXException
, com::sun::star::uno::RuntimeException
);
131 virtual void SAL_CALL
startElement(
132 const rtl::OUString
& aName
,
133 const com::sun::star::uno::Reference
<
134 com::sun::star::xml::sax::XAttributeList
>& xAttribs
)
135 throw (com::sun::star::xml::sax::SAXException
, com::sun::star::uno::RuntimeException
);
137 virtual void SAL_CALL
endElement( const rtl::OUString
& aName
)
138 throw (com::sun::star::xml::sax::SAXException
, com::sun::star::uno::RuntimeException
);
140 virtual void SAL_CALL
characters( const rtl::OUString
& aChars
)
141 throw (com::sun::star::xml::sax::SAXException
, com::sun::star::uno::RuntimeException
);
143 virtual void SAL_CALL
ignorableWhitespace( const rtl::OUString
& aWhitespaces
)
144 throw (com::sun::star::xml::sax::SAXException
, com::sun::star::uno::RuntimeException
);
146 virtual void SAL_CALL
processingInstruction(
147 const rtl::OUString
& aTarget
,
148 const rtl::OUString
& aData
)
149 throw (com::sun::star::xml::sax::SAXException
, com::sun::star::uno::RuntimeException
);
151 virtual void SAL_CALL
setDocumentLocator(
152 const com::sun::star::uno::Reference
<
153 com::sun::star::xml::sax::XLocator
>& xLocator
)
154 throw (com::sun::star::xml::sax::SAXException
, com::sun::star::uno::RuntimeException
);
159 virtual void SAL_CALL
initialize(
160 const com::sun::star::uno::Sequence
< com::sun::star::uno::Any
>& aArguments
)
161 throw(com::sun::star::uno::Exception
, com::sun::star::uno::RuntimeException
);