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/lang/XInitialization.hpp>
14 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
16 #include <cppuhelper/implbase.hxx>
19 class XMLSignatureHelper
;
21 /// Parses an OOXML digital signature.
22 class OOXMLSecParser
: public cppu::WeakImplHelper
24 css::xml::sax::XDocumentHandler
,
25 css::lang::XInitialization
28 XSecController
* m_pXSecController
;
29 css::uno::Reference
<css::xml::sax::XDocumentHandler
> m_xNextHandler
;
31 bool m_bInDigestValue
;
32 OUString m_aDigestValue
;
33 bool m_bInSignatureValue
;
34 OUString m_aSignatureValue
;
35 bool m_bInX509Certificate
;
36 OUString m_aX509Certificate
;
38 OUString m_aMdssiValue
;
39 bool m_bInSignatureComments
;
40 OUString m_aSignatureComments
;
41 bool m_bInX509IssuerName
;
42 OUString m_aX509IssuerName
;
43 bool m_bInX509SerialNumber
;
44 OUString m_aX509SerialNumber
;
46 OUString m_aCertDigest
;
47 bool m_bInValidSignatureImage
;
48 OUString m_aValidSignatureImage
;
49 bool m_bInInvalidSignatureImage
;
50 OUString m_aInvalidSignatureImage
;
51 bool m_bInSignatureLineId
;
52 OUString m_aSignatureLineId
;
54 /// Last seen <Reference URI="...">.
55 OUString m_aReferenceURI
;
56 /// Already called addStreamReference() for this reference.
57 bool m_bReferenceUnresolved
;
58 XMLSignatureHelper
& m_rXMLSignatureHelper
;
61 explicit OOXMLSecParser(XMLSignatureHelper
& rXMLSignatureHelper
, XSecController
* pXSecController
);
62 virtual ~OOXMLSecParser() override
;
65 virtual void SAL_CALL
startDocument() override
;
67 virtual void SAL_CALL
endDocument() override
;
69 virtual void SAL_CALL
startElement(const OUString
& aName
, const css::uno::Reference
<css::xml::sax::XAttributeList
>& xAttribs
) override
;
71 virtual void SAL_CALL
endElement(const OUString
& aName
) override
;
73 virtual void SAL_CALL
characters(const OUString
& aChars
) override
;
75 virtual void SAL_CALL
ignorableWhitespace(const OUString
& aWhitespaces
) override
;
77 virtual void SAL_CALL
processingInstruction(const OUString
& aTarget
, const OUString
& aData
) override
;
79 virtual void SAL_CALL
setDocumentLocator(const css::uno::Reference
<css::xml::sax::XLocator
>& xLocator
) override
;
82 virtual void SAL_CALL
initialize(const css::uno::Sequence
<css::uno::Any
>& rArguments
) override
;
87 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */