Bump version to 6.0-36
[LibreOffice.git] / xmlsecurity / source / helper / xsecparser.hxx
blobe1c4515ce941f56cf095b6bfe2e752aabccc4ad8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_XMLSECURITY_SOURCE_HELPER_XSECPARSER_HXX
21 #define INCLUDED_XMLSECURITY_SOURCE_HELPER_XSECPARSER_HXX
23 #include <xsecctl.hxx>
25 #include <com/sun/star/xml/sax/XParser.hpp>
26 #include <com/sun/star/lang/XInitialization.hpp>
27 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
28 #include <com/sun/star/xml/sax/XAttributeList.hpp>
30 #include <cppuhelper/implbase.hxx>
32 class XSecParser: public cppu::WeakImplHelper
34 css::xml::sax::XDocumentHandler,
35 css::lang::XInitialization
37 /****** XSecController.hxx/CLASS XSecParser ***********************************
39 * NAME
40 * XSecParser -- a SAX parser that can detect security elements
42 * FUNCTION
43 * The XSecParser object is connected on the SAX chain and detects
44 * security elements in the SAX event stream, then notifies
45 * the XSecController.
47 * NOTES
48 * This class is used when importing a document.
49 ******************************************************************************/
51 friend class XSecController;
52 private:
54 * the following members are used to reserve the signature information,
55 * including X509IssuerName, X509SerialNumber, and X509Certificate,etc.
57 OUString m_ouX509IssuerName;
58 OUString m_ouX509SerialNumber;
59 OUString m_ouX509Certificate;
60 OUString m_ouGpgCertificate;
61 OUString m_ouGpgKeyID;
62 OUString m_ouGpgOwner;
63 OUString m_ouCertDigest;
64 OUString m_ouEncapsulatedX509Certificate;
65 OUString m_ouDigestValue;
66 OUString m_ouSignatureValue;
67 OUString m_ouDate;
68 /// Characters of a <dc:description> element, as just read from XML.
69 OUString m_ouDescription;
70 OUString m_ouSignatureLineId;
73 * whether inside a particular element
75 bool m_bInX509IssuerName;
76 bool m_bInX509SerialNumber;
77 bool m_bInX509Certificate;
78 bool m_bInGpgCertificate;
79 bool m_bInGpgKeyID;
80 bool m_bInGpgOwner;
81 bool m_bInCertDigest;
82 bool m_bInEncapsulatedX509Certificate;
83 bool m_bInSigningTime;
84 bool m_bInDigestValue;
85 bool m_bInSignatureValue;
86 bool m_bInDate;
87 bool m_bInDescription;
88 bool m_bInSignatureLineId;
91 * the XSecController collaborating with XSecParser
93 XSecController* m_pXSecController;
96 * the next XDocumentHandler on the SAX chain
98 css::uno::Reference<
99 css::xml::sax::XDocumentHandler > m_xNextHandler;
102 * this string is used to remember the current handled reference's URI,
104 * because it can be decided whether a stream reference is xml based or binary based
105 * only after the Transforms element is read in, so we have to reserve the reference's
106 * URI when the startElement event is met.
108 OUString m_currentReferenceURI;
109 bool m_bReferenceUnresolved;
111 // Relevant for ODF. The digest algorithm selected by the current DigestMethod element's
112 // Algorithm attribute in the current Reference element. From css::xml::crypto::DigestID.
113 sal_Int32 m_nReferenceDigestID;
114 XMLSignatureHelper& m_rXMLSignatureHelper;
116 private:
117 static OUString getIdAttr(const css::uno::Reference<
118 css::xml::sax::XAttributeList >& xAttribs );
120 public:
121 XSecParser(XMLSignatureHelper& rXMLSignatureHelper, XSecController* pXSecController);
124 * XDocumentHandler
126 virtual void SAL_CALL startDocument( ) override;
128 virtual void SAL_CALL endDocument( ) override;
130 virtual void SAL_CALL startElement(
131 const OUString& aName,
132 const css::uno::Reference<
133 css::xml::sax::XAttributeList >& xAttribs ) override;
135 virtual void SAL_CALL endElement( const OUString& aName ) override;
137 virtual void SAL_CALL characters( const OUString& aChars ) override;
139 virtual void SAL_CALL ignorableWhitespace( const OUString& aWhitespaces ) override;
141 virtual void SAL_CALL processingInstruction(
142 const OUString& aTarget,
143 const OUString& aData ) override;
145 virtual void SAL_CALL setDocumentLocator(
146 const css::uno::Reference<
147 css::xml::sax::XLocator >& xLocator ) override;
150 * XInitialization
152 virtual void SAL_CALL initialize(
153 const css::uno::Sequence< css::uno::Any >& aArguments ) override;
156 #endif
159 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */