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: xsecparser.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 _XSEC_CTL_PARSER_HXX
32 #define _XSEC_CTL_PARSER_HXX
34 #include <xsecctl.hxx>
36 #include <com/sun/star/xml/sax/XParser.hpp>
37 #include <com/sun/star/lang/XInitialization.hpp>
38 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
39 #include <com/sun/star/xml/sax/XAttributeList.hpp>
41 #include <cppuhelper/implbase2.hxx>
43 class XSecParser
: public cppu::WeakImplHelper2
45 com::sun::star::xml::sax::XDocumentHandler
,
46 com::sun::star::lang::XInitialization
48 /****** XSecController.hxx/CLASS XSecParser ***********************************
51 * XSecParser -- a SAX parser that can detect security elements
54 * The XSecParser object is connected on the SAX chain and detects
55 * security elements in the SAX event stream, then notifies
59 * 05.01.2004 - Interface supported: XDocumentHandler, XInitialization
62 * This class is used when importing a document.
66 * Email: michael.mi@sun.com
67 ******************************************************************************/
69 friend class XSecController
;
72 * the following members are used to reserve the signature information,
73 * including X509IssuerName, X509SerialNumber, and X509Certificate,etc.
75 rtl::OUString m_ouX509IssuerName
;
76 rtl::OUString m_ouX509SerialNumber
;
77 rtl::OUString m_ouX509Certificate
;
78 rtl::OUString m_ouDigestValue
;
79 rtl::OUString m_ouSignatureValue
;
80 rtl::OUString m_ouDate
;
81 //rtl::OUString m_ouTime;
84 * whether inside a particular element
86 bool m_bInX509IssuerName
;
87 bool m_bInX509SerialNumber
;
88 bool m_bInX509Certificate
;
89 bool m_bInDigestValue
;
90 bool m_bInSignatureValue
;
95 * the XSecController collaborating with XSecParser
97 XSecController
* m_pXSecController
;
100 * the next XDocumentHandler on the SAX chain
102 com::sun::star::uno::Reference
<
103 com::sun::star::xml::sax::XDocumentHandler
> m_xNextHandler
;
106 * this string is used to remember the current handled reference's URI,
108 * because it can be decided whether a stream reference is xml based or binary based
109 * only after the Transforms element is read in, so we have to reserve the reference's
110 * URI when the startElement event is met.
112 rtl::OUString m_currentReferenceURI
;
113 bool m_bReferenceUnresolved
;
116 rtl::OUString
getIdAttr(const com::sun::star::uno::Reference
<
117 com::sun::star::xml::sax::XAttributeList
>& xAttribs
);
120 XSecParser( XSecController
* pXSecController
,
121 const com::sun::star::uno::Reference
<
122 com::sun::star::xml::sax::XDocumentHandler
>& xNextHandler
);
128 virtual void SAL_CALL
startDocument( )
129 throw (com::sun::star::xml::sax::SAXException
, com::sun::star::uno::RuntimeException
);
131 virtual void SAL_CALL
endDocument( )
132 throw (com::sun::star::xml::sax::SAXException
, com::sun::star::uno::RuntimeException
);
134 virtual void SAL_CALL
startElement(
135 const rtl::OUString
& aName
,
136 const com::sun::star::uno::Reference
<
137 com::sun::star::xml::sax::XAttributeList
>& xAttribs
)
138 throw (com::sun::star::xml::sax::SAXException
, com::sun::star::uno::RuntimeException
);
140 virtual void SAL_CALL
endElement( const rtl::OUString
& aName
)
141 throw (com::sun::star::xml::sax::SAXException
, com::sun::star::uno::RuntimeException
);
143 virtual void SAL_CALL
characters( const rtl::OUString
& aChars
)
144 throw (com::sun::star::xml::sax::SAXException
, com::sun::star::uno::RuntimeException
);
146 virtual void SAL_CALL
ignorableWhitespace( const rtl::OUString
& aWhitespaces
)
147 throw (com::sun::star::xml::sax::SAXException
, com::sun::star::uno::RuntimeException
);
149 virtual void SAL_CALL
processingInstruction(
150 const rtl::OUString
& aTarget
,
151 const rtl::OUString
& aData
)
152 throw (com::sun::star::xml::sax::SAXException
, com::sun::star::uno::RuntimeException
);
154 virtual void SAL_CALL
setDocumentLocator(
155 const com::sun::star::uno::Reference
<
156 com::sun::star::xml::sax::XLocator
>& xLocator
)
157 throw (com::sun::star::xml::sax::SAXException
, com::sun::star::uno::RuntimeException
);
162 virtual void SAL_CALL
initialize(
163 const com::sun::star::uno::Sequence
< com::sun::star::uno::Any
>& aArguments
)
164 throw(com::sun::star::uno::Exception
, com::sun::star::uno::RuntimeException
);