1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _DIGESTCONTEXT_HXX
25 #define _DIGESTCONTEXT_HXX
26 
27 #include <com/sun/star/xml/crypto/XDigestContext.hpp>
28 
29 #include <cppuhelper/implbase1.hxx>
30 #include <osl/mutex.hxx>
31 
32 class ODigestContext : public cppu::WeakImplHelper1< ::com::sun::star::xml::crypto::XDigestContext >
33 {
34 private:
35     ::osl::Mutex m_aMutex;
36 
37     PK11Context* m_pContext;
38     sal_Int32 m_nDigestLength;
39     bool m_b1KData;
40     sal_Int32 m_nDigested;
41 
42     bool m_bDisposed;
43     bool m_bBroken;
44 
45 public:
ODigestContext(PK11Context * pContext,sal_Int32 nDigestLength,bool b1KData)46     ODigestContext( PK11Context* pContext, sal_Int32 nDigestLength, bool b1KData )
47     : m_pContext( pContext )
48     , m_nDigestLength( nDigestLength )
49     , m_b1KData( b1KData )
50     , m_nDigested( 0 )
51     , m_bDisposed( false )
52     , m_bBroken( false )
53     {}
54 
55     virtual ~ODigestContext();
56 
57 
58     // XDigestContext
59     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);
60     virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL finalizeDigestAndDispose() throw (::com::sun::star::lang::DisposedException, ::com::sun::star::uno::RuntimeException);
61 };
62 
63 #endif
64 
65