LCOV - code coverage report
Current view: top level - xmlsecurity/source/framework - signatureengine.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 3 33.3 %
Date: 2015-06-13 12:38:46 Functions: 1 3 33.3 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #ifndef INCLUDED_XMLSECURITY_SOURCE_FRAMEWORK_SIGNATUREENGINE_HXX
      21             : #define INCLUDED_XMLSECURITY_SOURCE_FRAMEWORK_SIGNATUREENGINE_HXX
      22             : 
      23             : #include <com/sun/star/xml/crypto/sax/XReferenceResolvedListener.hpp>
      24             : #include <com/sun/star/xml/crypto/sax/XReferenceResolvedBroadcaster.hpp>
      25             : #include <com/sun/star/xml/crypto/sax/XReferenceCollector.hpp>
      26             : #include <com/sun/star/xml/crypto/sax/XKeyCollector.hpp>
      27             : #include <com/sun/star/xml/crypto/sax/XMissionTaker.hpp>
      28             : #include <com/sun/star/xml/crypto/sax/XSAXEventKeeper.hpp>
      29             : #include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
      30             : #include <com/sun/star/xml/crypto/XXMLSignature.hpp>
      31             : #include <com/sun/star/xml/crypto/XUriBinding.hpp>
      32             : #include <com/sun/star/io/XInputStream.hpp>
      33             : #include <com/sun/star/uno/XComponentContext.hpp>
      34             : 
      35             : #include <cppuhelper/implbase2.hxx>
      36             : 
      37             : #include "securityengine.hxx"
      38             : 
      39             : #include <vector>
      40             : 
      41             : class SignatureEngine : public cppu::ImplInheritanceHelper2
      42             : <
      43             :     SecurityEngine,
      44             :     com::sun::star::xml::crypto::sax::XReferenceCollector,
      45             :     com::sun::star::xml::crypto::XUriBinding
      46             : >
      47             : /****** signatureengine.hxx/CLASS SignatureEngine *****************************
      48             :  *
      49             :  *   NAME
      50             :  *  SignatureEngine -- Base class of SignatureCreator and SignatureVerifier
      51             :  *
      52             :  *   FUNCTION
      53             :  *  Maintains common members and methods related with signature operation.
      54             :  *
      55             :  *   AUTHOR
      56             :  *  Michael Mi
      57             :  *  Email: michael.mi@sun.com
      58             :  ******************************************************************************/
      59             : {
      60             : private:
      61             :     com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext;
      62             : 
      63             : protected:
      64             : 
      65             :     /*
      66             :      * the Signature bridge component, which performs signature generation
      67             :      * and verification based on xmlsec library.
      68             :      */
      69             :     com::sun::star::uno::Reference<
      70             :         com::sun::star::xml::crypto::XXMLSignature > m_xXMLSignature;
      71             : 
      72             :     /*
      73             :      * a collection of ElementCollector's ids. Each ElementCollector
      74             :      * represents one element signed by this signature.
      75             :      */
      76             :     std::vector< sal_Int32 > m_vReferenceIds;
      77             : 
      78             :     /*
      79             :      * remembers how many references this signature has.
      80             :      */
      81             :     sal_Int32 m_nTotalReferenceNumber;
      82             : 
      83             :     /*
      84             :      * a collection of Uri binding.
      85             :      *
      86             :      * the m_vUris is used to hold the Uri strings, and the m_vXInputStreams is used
      87             :      * to hold corresponding binded XInputStream interface.
      88             :      */
      89             :     std::vector< OUString > m_vUris;
      90             :     std::vector< com::sun::star::uno::Reference<
      91             :         com::sun::star::io::XInputStream > > m_vXInputStreams;
      92             : 
      93             : protected:
      94             :     explicit SignatureEngine( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > & xContext);
      95           2 :     virtual ~SignatureEngine() {};
      96             : 
      97             :     virtual void tryToPerform( )
      98             :         throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
      99             :     virtual void clearUp( ) const SAL_OVERRIDE;
     100             :     virtual bool checkReady() const SAL_OVERRIDE;
     101             : 
     102             :     /*
     103             :      * starts the main function. This method will be implemented by any sub-class.
     104             :      * For a SignatureCreator, it performs signing operation;
     105             :      * for a SignatureVerifier, verification operation is performed.
     106             :      */
     107           0 :     virtual void startEngine( const com::sun::star::uno::Reference<
     108             :                               com::sun::star::xml::crypto::XXMLSignatureTemplate >&)
     109             :         throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
     110           0 :         {};
     111             : 
     112             : public:
     113             :     /* XReferenceCollector */
     114             :     virtual void SAL_CALL setReferenceCount( sal_Int32 count )
     115             :         throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     116             : 
     117             :     virtual void SAL_CALL setReferenceId( sal_Int32 id )
     118             :         throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     119             : 
     120             :     /* XUriBinding */
     121             :     virtual void SAL_CALL setUriBinding(
     122             :         const OUString& uri,
     123             :         const com::sun::star::uno::Reference<
     124             :             com::sun::star::io::XInputStream >& aInputStream )
     125             :         throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     126             :     virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
     127             :         SAL_CALL getUriBinding( const OUString& uri )
     128             :         throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     129             : };
     130             : 
     131             : #endif
     132             : 
     133             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11