1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #ifndef INCLUDED_XMLSECURITY_SOURCE_HELPER_OOXMLSECPARSER_HXX
11 #define INCLUDED_XMLSECURITY_SOURCE_HELPER_OOXMLSECPARSER_HXX
13 #include <com/sun/star/xml/sax/XParser.hpp>
14 #include <com/sun/star/lang/XInitialization.hpp>
15 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
16 #include <com/sun/star/xml/sax/XAttributeList.hpp>
18 #include <cppuhelper/implbase.hxx>
20 #include <xsecctl.hxx>
22 /// Parses an OOXML digital signature.
23 class OOXMLSecParser
: public cppu::WeakImplHelper
25 css::xml::sax::XDocumentHandler
,
26 css::lang::XInitialization
29 XSecController
* m_pXSecController
;
30 css::uno::Reference
<css::xml::sax::XDocumentHandler
> m_xNextHandler
;
32 bool m_bInDigestValue
;
33 OUString m_aDigestValue
;
34 bool m_bInSignatureValue
;
35 OUString m_aSignatureValue
;
36 bool m_bInX509Certificate
;
37 OUString m_aX509Certificate
;
39 OUString m_aMdssiValue
;
40 bool m_bInSignatureComments
;
41 OUString m_aSignatureComments
;
42 bool m_bInX509IssuerName
;
43 OUString m_aX509IssuerName
;
44 bool m_bInX509SerialNumber
;
45 OUString m_aX509SerialNumber
;
47 OUString m_aCertDigest
;
48 bool m_bInValidSignatureImage
;
49 OUString m_aValidSignatureImage
;
50 bool m_bInInvalidSignatureImage
;
51 OUString m_aInvalidSignatureImage
;
52 bool m_bInSignatureLineId
;
53 OUString m_aSignatureLineId
;
55 /// Last seen <Reference URI="...">.
56 OUString m_aReferenceURI
;
57 /// Already called addStreamReference() for this reference.
58 bool m_bReferenceUnresolved
;
59 XMLSignatureHelper
& m_rXMLSignatureHelper
;
62 explicit OOXMLSecParser(XMLSignatureHelper
& rXMLSignatureHelper
, XSecController
* pXSecController
);
63 virtual ~OOXMLSecParser() override
;
66 virtual void SAL_CALL
startDocument() override
;
68 virtual void SAL_CALL
endDocument() override
;
70 virtual void SAL_CALL
startElement(const OUString
& aName
, const css::uno::Reference
<css::xml::sax::XAttributeList
>& xAttribs
) override
;
72 virtual void SAL_CALL
endElement(const OUString
& aName
) override
;
74 virtual void SAL_CALL
characters(const OUString
& aChars
) override
;
76 virtual void SAL_CALL
ignorableWhitespace(const OUString
& aWhitespaces
) override
;
78 virtual void SAL_CALL
processingInstruction(const OUString
& aTarget
, const OUString
& aData
) override
;
80 virtual void SAL_CALL
setDocumentLocator(const css::uno::Reference
<css::xml::sax::XLocator
>& xLocator
) override
;
83 virtual void SAL_CALL
initialize(const css::uno::Sequence
<css::uno::Any
>& rArguments
) override
;
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */