1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _DIGESTCONTEXT_HXX
29 #define _DIGESTCONTEXT_HXX
30 
31 #include <com/sun/star/xml/crypto/XDigestContext.hpp>
32 
33 #include <cppuhelper/implbase1.hxx>
34 #include <osl/mutex.hxx>
35 
36 class ODigestContext : public cppu::WeakImplHelper1< ::com::sun::star::xml::crypto::XDigestContext >
37 {
38 private:
39     ::osl::Mutex m_aMutex;
40 
41     PK11Context* m_pContext;
42     sal_Int32 m_nDigestLength;
43     bool m_b1KData;
44     sal_Int32 m_nDigested;
45 
46     bool m_bDisposed;
47     bool m_bBroken;
48 
49 public:
50     ODigestContext( PK11Context* pContext, sal_Int32 nDigestLength, bool b1KData )
51     : m_pContext( pContext )
52     , m_nDigestLength( nDigestLength )
53     , m_b1KData( b1KData )
54     , m_nDigested( 0 )
55     , m_bDisposed( false )
56     , m_bBroken( false )
57     {}
58 
59     virtual ~ODigestContext();
60 
61 
62     // XDigestContext
63     virtual void SAL_CALL updateDigest( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aData ) throw (::com::sun::star::lang::DisposedException, ::com::sun::star::uno::RuntimeException);
64     virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL finalizeDigestAndDispose() throw (::com::sun::star::lang::DisposedException, ::com::sun::star::uno::RuntimeException);
65 };
66 
67 #endif
68 
69