2010-10-27 12:45:03 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-21 14:30:25 +01:00
|
|
|
/*
|
|
|
|
* 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/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2004-07-12 12:15:31 +00:00
|
|
|
|
2016-11-24 08:24:29 +01:00
|
|
|
#ifndef INCLUDED_XMLSECURITY_INC_FRAMEWORK_SIGNATUREENGINE_HXX
|
|
|
|
#define INCLUDED_XMLSECURITY_INC_FRAMEWORK_SIGNATUREENGINE_HXX
|
2004-07-12 12:15:31 +00:00
|
|
|
|
|
|
|
#include <com/sun/star/xml/crypto/sax/XReferenceResolvedListener.hpp>
|
|
|
|
#include <com/sun/star/xml/crypto/sax/XReferenceResolvedBroadcaster.hpp>
|
|
|
|
#include <com/sun/star/xml/crypto/sax/XReferenceCollector.hpp>
|
|
|
|
#include <com/sun/star/xml/crypto/sax/XKeyCollector.hpp>
|
|
|
|
#include <com/sun/star/xml/crypto/sax/XMissionTaker.hpp>
|
|
|
|
#include <com/sun/star/xml/crypto/sax/XSAXEventKeeper.hpp>
|
|
|
|
#include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
|
|
|
|
#include <com/sun/star/xml/crypto/XXMLSignature.hpp>
|
|
|
|
#include <com/sun/star/xml/crypto/XUriBinding.hpp>
|
|
|
|
#include <com/sun/star/io/XInputStream.hpp>
|
2013-06-05 11:32:31 +02:00
|
|
|
#include <com/sun/star/uno/XComponentContext.hpp>
|
2004-07-12 12:15:31 +00:00
|
|
|
|
2015-09-14 10:19:13 +09:00
|
|
|
#include <cppuhelper/implbase.hxx>
|
2017-08-10 09:04:03 +02:00
|
|
|
#include <rtl/ref.hxx>
|
2004-07-12 12:15:31 +00:00
|
|
|
|
2016-11-24 08:24:29 +01:00
|
|
|
#include "xsecfwdllapi.h"
|
2004-07-12 12:15:31 +00:00
|
|
|
#include "securityengine.hxx"
|
2017-08-10 09:04:03 +02:00
|
|
|
#include "xmlsignaturetemplateimpl.hxx"
|
2004-07-12 12:15:31 +00:00
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
2016-11-24 08:24:29 +01:00
|
|
|
class XSECFW_DLLPUBLIC SignatureEngine : public cppu::ImplInheritanceHelper
|
2004-07-12 12:15:31 +00:00
|
|
|
<
|
|
|
|
SecurityEngine,
|
2015-11-26 09:49:00 +02:00
|
|
|
css::xml::crypto::sax::XReferenceCollector,
|
|
|
|
css::xml::crypto::XUriBinding
|
2004-07-12 12:15:31 +00:00
|
|
|
>
|
|
|
|
/****** signatureengine.hxx/CLASS SignatureEngine *****************************
|
|
|
|
*
|
|
|
|
* NAME
|
|
|
|
* SignatureEngine -- Base class of SignatureCreator and SignatureVerifier
|
|
|
|
*
|
|
|
|
* FUNCTION
|
|
|
|
* Maintains common members and methods related with signature operation.
|
|
|
|
******************************************************************************/
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
|
|
|
|
/*
|
|
|
|
* the Signature bridge component, which performs signature generation
|
|
|
|
* and verification based on xmlsec library.
|
|
|
|
*/
|
2015-11-26 09:49:00 +02:00
|
|
|
css::uno::Reference< css::xml::crypto::XXMLSignature > m_xXMLSignature;
|
2004-07-12 12:15:31 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* a collection of ElementCollector's ids. Each ElementCollector
|
|
|
|
* represents one element signed by this signature.
|
|
|
|
*/
|
|
|
|
std::vector< sal_Int32 > m_vReferenceIds;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* remembers how many references this signature has.
|
|
|
|
*/
|
|
|
|
sal_Int32 m_nTotalReferenceNumber;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* a collection of Uri binding.
|
|
|
|
*
|
|
|
|
* the m_vUris is used to hold the Uri strings, and the m_vXInputStreams is used
|
|
|
|
* to hold corresponding binded XInputStream interface.
|
|
|
|
*/
|
2013-04-07 12:06:47 +02:00
|
|
|
std::vector< OUString > m_vUris;
|
2015-11-26 09:49:00 +02:00
|
|
|
std::vector< css::uno::Reference< css::io::XInputStream > > m_vXInputStreams;
|
2004-07-12 12:15:31 +00:00
|
|
|
|
|
|
|
protected:
|
2017-01-09 09:22:34 +02:00
|
|
|
explicit SignatureEngine();
|
2016-09-13 13:09:01 +02:00
|
|
|
virtual ~SignatureEngine() override {};
|
2004-07-12 12:15:31 +00:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void tryToPerform( ) override;
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void clearUp( ) const override;
|
|
|
|
virtual bool checkReady() const override;
|
2004-07-12 12:15:31 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* starts the main function. This method will be implemented by any sub-class.
|
|
|
|
* For a SignatureCreator, it performs signing operation;
|
|
|
|
* for a SignatureVerifier, verification operation is performed.
|
|
|
|
*/
|
2017-01-19 17:46:45 +01:00
|
|
|
/// @throws css::uno::Exception
|
|
|
|
/// @throws css::uno::RuntimeException
|
2017-08-10 09:04:03 +02:00
|
|
|
virtual void startEngine( const rtl::Reference<XMLSignatureTemplateImpl>&)
|
2004-07-12 12:15:31 +00:00
|
|
|
{};
|
|
|
|
|
|
|
|
public:
|
|
|
|
/* XReferenceCollector */
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void SAL_CALL setReferenceCount( sal_Int32 count ) override;
|
2004-07-12 12:15:31 +00:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void SAL_CALL setReferenceId( sal_Int32 id ) override;
|
2004-07-12 12:15:31 +00:00
|
|
|
|
|
|
|
/* XUriBinding */
|
|
|
|
virtual void SAL_CALL setUriBinding(
|
2013-04-07 12:06:47 +02:00
|
|
|
const OUString& uri,
|
2017-01-26 12:28:58 +01:00
|
|
|
const css::uno::Reference< css::io::XInputStream >& aInputStream ) override;
|
2015-11-26 09:49:00 +02:00
|
|
|
virtual css::uno::Reference< css::io::XInputStream >
|
2017-01-26 12:28:58 +01:00
|
|
|
SAL_CALL getUriBinding( const OUString& uri ) override;
|
2004-07-12 12:15:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2010-10-27 12:45:03 +01:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|