1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: documentdigitalsignatures.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _XMLSECURITY_DOCUMENTDIGITALSIGNATURES_HXX
32 #define _XMLSECURITY_DOCUMENTDIGITALSIGNATURES_HXX
34 #include <cppuhelper/implbase2.hxx>
36 #include "com/sun/star/lang/XInitialization.hpp"
37 #include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
38 #include <com/sun/star/io/XStream.hpp>
39 #include <com/sun/star/io/XInputStream.hpp>
40 #include <xmlsecurity/documentsignaturehelper.hxx>
42 namespace com
{ namespace sun
{ namespace star
{
45 class XComponentContext
;
49 class DocumentDigitalSignatures
: public cppu::WeakImplHelper2
51 com::sun::star::security::XDocumentDigitalSignatures
,
52 com::sun::star::lang::XInitialization
56 com::sun::star::uno::Reference
< com::sun::star::uno::XComponentContext
> mxCtx
;
57 // will be set by XInitialization. If not we assume true. false means an earlier version.
58 ::rtl::OUString m_sODFVersion
;
59 //The number of arguments which were passed in XInitialization::initialize
60 int m_nArgumentsCount
;
61 //Indicates if the document already contains a document signature
62 bool m_bHasDocumentSignature
;
64 sal_Bool
ImplViewSignatures( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& rxStorage
, const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
>& xSignStream
, DocumentSignatureMode eMode
, bool bReadOnly
) throw (::com::sun::star::uno::RuntimeException
);
65 sal_Bool
ImplViewSignatures( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& rxStorage
, const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& xSignStream
, DocumentSignatureMode eMode
, bool bReadOnly
) throw (::com::sun::star::uno::RuntimeException
);
66 com::sun::star::uno::Sequence
< ::com::sun::star::security::DocumentSignatureInformation
> ImplVerifySignatures( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& rxStorage
, const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& xSignStream
, DocumentSignatureMode eMode
) throw (::com::sun::star::uno::RuntimeException
);
69 DocumentDigitalSignatures( const com::sun::star::uno::Reference
< com::sun::star::uno::XComponentContext
>& rxCtx
);
71 // for service registration...
72 static ::rtl::OUString
GetImplementationName() throw (com::sun::star::uno::RuntimeException
);
73 static ::com::sun::star::uno::Sequence
< ::rtl::OUString
> GetSupportedServiceNames() throw (com::sun::star::uno::RuntimeException
);
76 void SAL_CALL
initialize( const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& aArguments
)
77 throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
);
79 // XDocumentDigitalSignatures
80 ::sal_Bool SAL_CALL
signDocumentContent( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xStorage
, const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
>& xSignStream
) throw (::com::sun::star::uno::RuntimeException
);
81 ::com::sun::star::uno::Sequence
< ::com::sun::star::security::DocumentSignatureInformation
> SAL_CALL
verifyDocumentContentSignatures( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xStorage
, const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& xSignInStream
) throw (::com::sun::star::uno::RuntimeException
);
82 void SAL_CALL
showDocumentContentSignatures( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xStorage
, const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& xSignInStream
) throw (::com::sun::star::uno::RuntimeException
);
83 ::rtl::OUString SAL_CALL
getDocumentContentSignatureDefaultStreamName( ) throw (::com::sun::star::uno::RuntimeException
);
84 ::sal_Bool SAL_CALL
signScriptingContent( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xStorage
, const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
>& xSignStream
) throw (::com::sun::star::uno::RuntimeException
);
85 ::com::sun::star::uno::Sequence
< ::com::sun::star::security::DocumentSignatureInformation
> SAL_CALL
verifyScriptingContentSignatures( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xStorage
, const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& xSignInStream
) throw (::com::sun::star::uno::RuntimeException
);
86 void SAL_CALL
showScriptingContentSignatures( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xStorage
, const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& xSignInStream
) throw (::com::sun::star::uno::RuntimeException
);
87 ::rtl::OUString SAL_CALL
getScriptingContentSignatureDefaultStreamName( ) throw (::com::sun::star::uno::RuntimeException
);
88 ::sal_Bool SAL_CALL
signPackage( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& Storage
, const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
>& xSignStream
) throw (::com::sun::star::uno::RuntimeException
);
89 ::com::sun::star::uno::Sequence
< ::com::sun::star::security::DocumentSignatureInformation
> SAL_CALL
verifyPackageSignatures( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& Storage
, const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& xSignInStream
) throw (::com::sun::star::uno::RuntimeException
);
90 void SAL_CALL
showPackageSignatures( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xStorage
, const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& xSignInStream
) throw (::com::sun::star::uno::RuntimeException
);
91 ::rtl::OUString SAL_CALL
getPackageSignatureDefaultStreamName( ) throw (::com::sun::star::uno::RuntimeException
);
92 void SAL_CALL
showCertificate( const ::com::sun::star::uno::Reference
< ::com::sun::star::security::XCertificate
>& Certificate
) throw (::com::sun::star::uno::RuntimeException
);
93 void SAL_CALL
manageTrustedSources( ) throw (::com::sun::star::uno::RuntimeException
);
94 ::sal_Bool SAL_CALL
isAuthorTrusted( const ::com::sun::star::uno::Reference
< ::com::sun::star::security::XCertificate
>& Author
) throw (::com::sun::star::uno::RuntimeException
);
95 ::sal_Bool SAL_CALL
isLocationTrusted( const ::rtl::OUString
& Location
) throw (::com::sun::star::uno::RuntimeException
);
96 void SAL_CALL
addAuthorToTrustedSources( const ::com::sun::star::uno::Reference
< ::com::sun::star::security::XCertificate
>& Author
) throw (::com::sun::star::uno::RuntimeException
);
97 void SAL_CALL
addLocationToTrustedSources( const ::rtl::OUString
& Location
) throw (::com::sun::star::uno::RuntimeException
);
101 com::sun::star::uno::Reference
< com::sun::star::uno::XInterface
> SAL_CALL
DocumentDigitalSignatures_CreateInstance(
102 const com::sun::star::uno::Reference
< com::sun::star::uno::XComponentContext
>& rCtx
) throw ( com::sun::star::uno::Exception
);
104 #endif // _XMLSECURITY_DOCUMENTDIGITALSIGNATURES_HXX