2016-01-12 18:54:29 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef INCLUDED_XMLSECURITY_SOURCE_HELPER_OOXMLSECPARSER_HXX
|
|
|
|
#define INCLUDED_XMLSECURITY_SOURCE_HELPER_OOXMLSECPARSER_HXX
|
|
|
|
|
|
|
|
#include <com/sun/star/xml/sax/XParser.hpp>
|
|
|
|
#include <com/sun/star/lang/XInitialization.hpp>
|
|
|
|
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
|
|
|
|
#include <com/sun/star/xml/sax/XAttributeList.hpp>
|
|
|
|
|
|
|
|
#include <cppuhelper/implbase.hxx>
|
|
|
|
|
|
|
|
#include "xsecctl.hxx"
|
|
|
|
|
|
|
|
/// Parses an OOXML digital signature.
|
|
|
|
class OOXMLSecParser: public cppu::WeakImplHelper
|
|
|
|
<
|
|
|
|
css::xml::sax::XDocumentHandler,
|
|
|
|
css::lang::XInitialization
|
|
|
|
>
|
|
|
|
{
|
|
|
|
XSecController* m_pXSecController;
|
2016-01-14 09:25:06 +01:00
|
|
|
css::uno::Reference<css::xml::sax::XDocumentHandler> m_xNextHandler;
|
2016-01-12 18:54:29 +01:00
|
|
|
|
2016-01-14 09:24:13 +01:00
|
|
|
bool m_bInDigestValue;
|
|
|
|
OUString m_aDigestValue;
|
2016-01-14 09:26:06 +01:00
|
|
|
bool m_bInSignatureValue;
|
|
|
|
OUString m_aSignatureValue;
|
2016-01-14 09:27:30 +01:00
|
|
|
bool m_bInX509Certificate;
|
|
|
|
OUString m_aX509Certificate;
|
2016-01-19 17:18:04 +01:00
|
|
|
bool m_bInMdssiValue;
|
|
|
|
OUString m_aMdssiValue;
|
2016-01-20 10:01:00 +01:00
|
|
|
bool m_bInSignatureComments;
|
|
|
|
OUString m_aSignatureComments;
|
2016-02-11 14:57:17 +01:00
|
|
|
bool m_bInX509IssuerName;
|
|
|
|
OUString m_aX509IssuerName;
|
2016-02-11 15:14:50 +01:00
|
|
|
bool m_bInX509SerialNumber;
|
|
|
|
OUString m_aX509SerialNumber;
|
2016-02-12 09:49:37 +01:00
|
|
|
bool m_bInCertDigest;
|
|
|
|
OUString m_aCertDigest;
|
2016-02-11 14:57:17 +01:00
|
|
|
|
2016-01-25 15:34:38 +01:00
|
|
|
/// Last seen <Reference URI="...">.
|
|
|
|
OUString m_aReferenceURI;
|
|
|
|
/// Already called addStreamReference() for this reference.
|
|
|
|
bool m_bReferenceUnresolved;
|
2016-01-14 09:24:13 +01:00
|
|
|
|
2016-01-12 18:54:29 +01:00
|
|
|
public:
|
2016-02-08 10:33:02 +00:00
|
|
|
explicit OOXMLSecParser(XSecController* pXSecController);
|
2016-09-13 13:09:01 +02:00
|
|
|
virtual ~OOXMLSecParser() override;
|
2016-01-12 18:54:29 +01:00
|
|
|
|
|
|
|
// XDocumentHandler
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void SAL_CALL startDocument() override;
|
2016-01-12 18:54:29 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void SAL_CALL endDocument() override;
|
2016-01-12 18:54:29 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void SAL_CALL startElement(const OUString& aName, const css::uno::Reference<css::xml::sax::XAttributeList>& xAttribs) override;
|
2016-01-12 18:54:29 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void SAL_CALL endElement(const OUString& aName) override;
|
2016-01-12 18:54:29 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void SAL_CALL characters(const OUString& aChars) override;
|
2016-01-12 18:54:29 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void SAL_CALL ignorableWhitespace(const OUString& aWhitespaces) override;
|
2016-01-12 18:54:29 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void SAL_CALL processingInstruction(const OUString& aTarget, const OUString& aData) override;
|
2016-01-12 18:54:29 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void SAL_CALL setDocumentLocator(const css::uno::Reference<css::xml::sax::XLocator>& xLocator) override;
|
2016-01-12 18:54:29 +01:00
|
|
|
|
|
|
|
// XInitialization
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArguments) override;
|
2016-01-12 18:54:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|