xmlsecurity: replace OOXMLSecParser implementation

This is similar to 12b15be8f4 and following
commits, but OOXMLSecParser has some differences to XSecParser, such as
using a ds:Manifest, and requires a couple extra namespaces.

Change-Id: I56e39d9609db8fcad50ca1632ff482c1f0a30ff5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113381
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
This commit is contained in:
Michael Stahl
2021-03-30 17:37:31 +02:00
committed by Miklos Vajna
parent 1fcc3d13d6
commit cc1d19f7bb
3 changed files with 1314 additions and 236 deletions

View File

@@ -76,6 +76,9 @@ constexpr sal_uInt16 XML_NAMESPACE_DSIG = 39;
constexpr sal_uInt16 XML_NAMESPACE_DS = 40;
constexpr sal_uInt16 XML_NAMESPACE_XADES132 = 41;
constexpr sal_uInt16 XML_NAMESPACE_XADES141 = 42;
// OOXML digital signature extension namespaces, also based on xmldsig-core
constexpr sal_uInt16 XML_NAMESPACE_MDSSI = 43;
constexpr sal_uInt16 XML_NAMESPACE_MSODIGSIG = 44;
// namespaces for ODF extended formats
constexpr sal_uInt16 XML_NAMESPACE_EXT_BASE = 50;

File diff suppressed because it is too large Load Diff

View File

@@ -14,6 +14,10 @@
#include <cppuhelper/implbase.hxx>
#include <xmloff/namespacemap.hxx>
#include <stack>
class XSecController;
class XMLSignatureHelper;
@@ -24,38 +28,62 @@ class OOXMLSecParser: public cppu::WeakImplHelper
css::lang::XInitialization
>
{
public:
class Context;
private:
class UnknownContext;
class ReferencedContextImpl;
class DsX509CertificateContext;
class DsX509SerialNumberContext;
class DsX509IssuerNameContext;
class DsX509IssuerSerialContext;
class DsX509DataContext;
class DsKeyInfoContext;
class DsSignatureValueContext;
class DsDigestValueContext;
class DsDigestMethodContext;
class DsTransformContext;
class DsTransformsContext;
class DsReferenceContext;
class DsSignatureMethodContext;
class DsSignedInfoContext;
class XadesEncapsulatedX509CertificateContext;
class XadesCertificateValuesContext;
class XadesUnsignedSignaturePropertiesContext;
class XadesUnsignedPropertiesContext;
class XadesCertDigestContext;
class XadesCertContext;
class XadesSigningCertificateContext;
class XadesSigningTimeContext;
class XadesSignedSignaturePropertiesContext;
class XadesSignedPropertiesContext;
class XadesQualifyingPropertiesContext;
class MdssiValueContext;
class MdssiSignatureTimeContext;
class MsodigsigSetupIDContext;
class MsodigsigSignatureCommentsContext;
class MsodigsigSignatureInfoV1Context;
class DsSignaturePropertyContext;
class DsSignaturePropertiesContext;
class DsManifestContext;
class DsObjectContext;
class DsSignatureContext;
class DsigSignaturesContext;
std::stack<std::unique_ptr<Context>> m_ContextStack;
std::unique_ptr<SvXMLNamespaceMap> m_pNamespaceMap;
XSecController* m_pXSecController;
css::uno::Reference<css::xml::sax::XDocumentHandler> m_xNextHandler;
bool m_bInDigestValue;
OUString m_aDigestValue;
bool m_bInSignatureValue;
OUString m_aSignatureValue;
bool m_bInX509Certificate;
OUString m_aX509Certificate;
bool m_bInMdssiValue;
OUString m_aMdssiValue;
bool m_bInSignatureComments;
OUString m_aSignatureComments;
bool m_bInX509IssuerName;
OUString m_aX509IssuerName;
bool m_bInX509SerialNumber;
OUString m_aX509SerialNumber;
bool m_bInCertDigest;
OUString m_aCertDigest;
bool m_bInValidSignatureImage;
OUString m_aValidSignatureImage;
bool m_bInInvalidSignatureImage;
OUString m_aInvalidSignatureImage;
bool m_bInSignatureLineId;
OUString m_aSignatureLineId;
/// Last seen <Reference URI="...">.
OUString m_aReferenceURI;
/// Already called addStreamReference() for this reference.
bool m_bReferenceUnresolved;
XMLSignatureHelper& m_rXMLSignatureHelper;
OUString HandleIdAttr(css::uno::Reference<css::xml::sax::XAttributeList> const& xAttrs);
public:
explicit OOXMLSecParser(XMLSignatureHelper& rXMLSignatureHelper, XSecController* pXSecController);
virtual ~OOXMLSecParser() override;