LCOV - code coverage report
Current view: top level - libreoffice/xmlsecurity/source/framework - securityengine.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 7 0.0 %
Date: 2012-12-27 Functions: 0 6 0.0 %
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 _SECURITYENGINE_HXX
      21             : #define _SECURITYENGINE_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/XKeyCollector.hpp>
      26             : #include <com/sun/star/xml/crypto/sax/XMissionTaker.hpp>
      27             : #include <com/sun/star/xml/crypto/sax/XSAXEventKeeper.hpp>
      28             : #include <com/sun/star/xml/crypto/XXMLSignature.hpp>
      29             : 
      30             : #include <cppuhelper/implbase3.hxx>
      31             : 
      32             : class SecurityEngine : public cppu::WeakImplHelper3
      33             : <
      34             :     com::sun::star::xml::crypto::sax::XReferenceResolvedListener,
      35             :     com::sun::star::xml::crypto::sax::XKeyCollector,
      36             :     com::sun::star::xml::crypto::sax::XMissionTaker
      37             : >
      38             : /****** securityengine.hxx/CLASS SecurityEngine *******************************
      39             :  *
      40             :  *   NAME
      41             :  *  SecurityEngine -- Base class of SignatureEngine and EncryptionEngine
      42             :  *
      43             :  *   FUNCTION
      44             :  *  Maintains common members and methods related with security engine
      45             :  *  operation.
      46             :  *
      47             :  *   AUTHOR
      48             :  *  Michael Mi
      49             :  *  Email: michael.mi@sun.com
      50             :  ******************************************************************************/
      51             : {
      52             : protected:
      53             :     com::sun::star::uno::Reference<
      54             :         com::sun::star::lang::XMultiServiceFactory > mxMSF;
      55             : 
      56             :     /*
      57             :      * A SAXEventKeeper internally maintians all resources that a security
      58             :      * operation needs. The m_xSAXEventKeeper member is used to release
      59             :      * those resources when the security operation finishes.
      60             :      */
      61             :     com::sun::star::uno::Reference<
      62             :         com::sun::star::xml::crypto::sax::XSAXEventKeeper > m_xSAXEventKeeper;
      63             : 
      64             :     /*
      65             :      * the id of ElementCollector of the template element.
      66             :      * For a signature, the template element is the Signature element,
      67             :      * for a encryption, the EncryptedData/EncryptedKey element is.
      68             :      */
      69             :     sal_Int32 m_nIdOfTemplateEC;
      70             : 
      71             :     /*
      72             :      * remembers how many referenced elements have been bufferred completely,
      73             :      * including the key element, template element, and referenced element of
      74             :      * signature.
      75             :      */
      76             :     sal_Int32 m_nNumOfResolvedReferences;
      77             : 
      78             :     /*
      79             :      * the id of ElementCollector of the key element.
      80             :      * If a Signature element or EncryptedData/EncryptedKey element has
      81             :      * an internal key sub-element, then this member should be -1
      82             :      */
      83             :     sal_Int32 m_nIdOfKeyEC;
      84             : 
      85             :     /*
      86             :      * remembers whether the current opertion has finished.
      87             :      */
      88             :     bool      m_bMissionDone;
      89             : 
      90             :     /*
      91             :      * the Id of the security entity, a signature or encryption, which is used for
      92             :      * the result listener to identify the entity.
      93             :      */
      94             :     sal_Int32 m_nSecurityId;
      95             : 
      96             :     /*
      97             :      * the status of the operation
      98             :      */
      99             :     com::sun::star::xml::crypto::SecurityOperationStatus m_nStatus;
     100             : 
     101             :     /*
     102             :      * the result listener, which will receives the security operation result.
     103             :      */
     104             :     com::sun::star::uno::Reference<
     105             :         com::sun::star::uno::XInterface >
     106             :         m_xResultListener;
     107             : 
     108             : protected:
     109             :     explicit SecurityEngine( const com::sun::star::uno::Reference<
     110             :         com::sun::star::lang::XMultiServiceFactory >& rxMSF = NULL );
     111           0 :     virtual ~SecurityEngine() {};
     112             : 
     113             :     /*
     114             :      * perform the security operation.
     115             :      * Any derived class will implement this method respectively.
     116             :      */
     117           0 :     virtual void tryToPerform( )
     118           0 :         throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException){};
     119             : 
     120             :     /*
     121             :      * clear up all resources used by this operation.
     122             :      * This method is called after the operation finishes, or a End-Your-Mission
     123             :      * message is received.
     124             :      * Any derived class will implement this method respectively.
     125             :      */
     126           0 :     virtual void clearUp( ) const {};
     127             : 
     128             :         /*
     129             :          * notifies any possible result listener.
     130             :          * When verify a signature or conduct a decryption, the operation result will
     131             :          * be transferred to a listener by this method.
     132             :      * Any derived class will implement this method respectively.
     133             :          */
     134           0 :     virtual void notifyResultListener() const
     135             :         throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
     136           0 :         {};
     137             : 
     138             :     /*
     139             :      * checks whether everything is ready.
     140             :      * Any derived class will implement this method respectively.
     141             :      */
     142           0 :     virtual bool checkReady() const { return true; };
     143             : 
     144             : public:
     145             :     /* XReferenceResolvedListener */
     146             :     virtual void SAL_CALL referenceResolved( sal_Int32 referenceId )
     147             :             throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
     148             : 
     149             :     /* XKeyCollector */
     150             :     virtual void SAL_CALL setKeyId( sal_Int32 id )
     151             :             throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
     152             : 
     153             :         /* XMissionTaker */
     154             :         virtual sal_Bool SAL_CALL endMission(  )
     155             :             throw (com::sun::star::uno::RuntimeException);
     156             : };
     157             : 
     158             : #endif
     159             : 
     160             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10