LibreOffice Module xmlsecurity (master) 1
xsecparser.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
22#include <com/sun/star/lang/XInitialization.hpp>
23#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
24
26
28
29#include <memory>
30#include <optional>
31#include <stack>
32
34class XSecController;
35
36class XSecParser: public cppu::WeakImplHelper
37<
38 css::xml::sax::XDocumentHandler,
39 css::lang::XInitialization
40>
41/****** XSecController.hxx/CLASS XSecParser ***********************************
42 *
43 * NAME
44 * XSecParser -- a SAX parser that can detect security elements
45 *
46 * FUNCTION
47 * The XSecParser object is connected on the SAX chain and detects
48 * security elements in the SAX event stream, then notifies
49 * the XSecController.
50 *
51 * NOTES
52 * This class is used when importing a document.
53 ******************************************************************************/
54{
55 friend class XSecController;
56public:
57 class Context;
58private:
59 class UnknownContext;
64 class DsPGPDataContext;
70 class DsKeyInfoContext;
88 class XadesCertContext;
94 class DcDateContext;
98 class DsObjectContext;
101
102 std::stack<std::unique_ptr<Context>> m_ContextStack;
103 std::optional<SvXMLNamespaceMap> m_pNamespaceMap;
104
105 /*
106 * the XSecController collaborating with XSecParser
107 */
109
110 /*
111 * the next XDocumentHandler on the SAX chain
112 */
113 css::uno::Reference<
114 css::xml::sax::XDocumentHandler > m_xNextHandler;
115
117
118 OUString HandleIdAttr(css::uno::Reference<css::xml::sax::XAttributeList> const& xAttrs);
119 static OUString getIdAttr(const css::uno::Reference<
120 css::xml::sax::XAttributeList >& xAttribs );
121
122public:
123 XSecParser(XMLSignatureHelper& rXMLSignatureHelper, XSecController* pXSecController);
124
125 /*
126 * XDocumentHandler
127 */
128 virtual void SAL_CALL startDocument( ) override;
129
130 virtual void SAL_CALL endDocument( ) override;
131
132 virtual void SAL_CALL startElement(
133 const OUString& aName,
134 const css::uno::Reference<
135 css::xml::sax::XAttributeList >& xAttribs ) override;
136
137 virtual void SAL_CALL endElement( const OUString& aName ) override;
138
139 virtual void SAL_CALL characters( const OUString& aChars ) override;
140
141 virtual void SAL_CALL ignorableWhitespace( const OUString& aWhitespaces ) override;
142
143 virtual void SAL_CALL processingInstruction(
144 const OUString& aTarget,
145 const OUString& aData ) override;
146
147 virtual void SAL_CALL setDocumentLocator(
148 const css::uno::Reference<
149 css::xml::sax::XLocator >& xLocator ) override;
150
151 /*
152 * XInitialization
153 */
154 virtual void SAL_CALL initialize(
155 const css::uno::Sequence< css::uno::Any >& aArguments ) override;
156};
157
158
159/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
can't be sure what is supposed to happen here because the spec is clear as mud
Definition: xsecparser.cxx:343
note: anything in ds:Object should be trusted only if there is a ds:Reference to it so it is signed (...
Definition: xsecparser.cxx:111
XMLSignatureHelper & m_rXMLSignatureHelper
Definition: xsecparser.hxx:116
static OUString getIdAttr(const css::uno::Reference< css::xml::sax::XAttributeList > &xAttribs)
XSecParser(XMLSignatureHelper &rXMLSignatureHelper, XSecController *pXSecController)
OUString HandleIdAttr(css::uno::Reference< css::xml::sax::XAttributeList > const &xAttrs)
virtual void SAL_CALL startDocument() override
virtual void SAL_CALL endDocument() override
XSecController * m_pXSecController
Definition: xsecparser.hxx:108
virtual void SAL_CALL processingInstruction(const OUString &aTarget, const OUString &aData) override
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
virtual void SAL_CALL setDocumentLocator(const css::uno::Reference< css::xml::sax::XLocator > &xLocator) override
virtual void SAL_CALL ignorableWhitespace(const OUString &aWhitespaces) override
css::uno::Reference< css::xml::sax::XDocumentHandler > m_xNextHandler
Definition: xsecparser.hxx:114
virtual void SAL_CALL endElement(const OUString &aName) override
std::optional< SvXMLNamespaceMap > m_pNamespaceMap
Definition: xsecparser.hxx:103
virtual void SAL_CALL characters(const OUString &aChars) override
virtual void SAL_CALL startElement(const OUString &aName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttribs) override
std::stack< std::unique_ptr< Context > > m_ContextStack
Definition: xsecparser.hxx:100