Branch data 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 _XMLSECURITY_DOCUMENTSIGNATUREHELPER_HXX
21 : : #define _XMLSECURITY_DOCUMENTSIGNATUREHELPER_HXX
22 : :
23 : : #include <com/sun/star/uno/Reference.h>
24 : : #include <rtl/ustring.hxx>
25 : : #include "xmlsecurity/sigstruct.hxx"
26 : :
27 : : #ifndef _STLP_VECTOR
28 : : #include <vector>
29 : : #endif
30 : :
31 : :
32 : : namespace com {
33 : : namespace sun {
34 : : namespace star {
35 : : namespace io {
36 : : class XStream; }
37 : : namespace embed {
38 : : class XStorage; }
39 : : }}}
40 : :
41 : : namespace css = com::sun::star;
42 : :
43 : :
44 : : /**********************************************************
45 : : DocumentSignatureHelper
46 : :
47 : : Helper class for signing and verifieng document signatures
48 : :
49 : : Functions:
50 : : 1. help to create a list of content to be signed/verified
51 : :
52 : : **********************************************************/
53 : :
54 : : enum DocumentSignatureMode { SignatureModeDocumentContent, SignatureModeMacros, SignatureModePackage };
55 : :
56 : : enum DocumentSignatureAlgorithm
57 : : {
58 : : OOo2Document,
59 : : OOo3_0Document,
60 : : OOo3_2Document
61 : : };
62 : :
63 : 540 : struct SignatureStreamHelper
64 : : {
65 : : css::uno::Reference < css::embed::XStorage > xSignatureStorage;
66 : : css::uno::Reference < css::io::XStream > xSignatureStream;
67 : : };
68 : :
69 : :
70 : : class DocumentSignatureHelper
71 : : {
72 : : public:
73 : :
74 : : static SignatureStreamHelper OpenSignatureStream(
75 : : const css::uno::Reference < css::embed::XStorage >& rxStore, sal_Int32 nOpenMode,
76 : : DocumentSignatureMode eDocSigMode );
77 : : static std::vector< rtl::OUString > CreateElementList(
78 : : const css::uno::Reference < css::embed::XStorage >& rxStore,
79 : : const ::rtl::OUString rRootStorageName, DocumentSignatureMode eMode,
80 : : const DocumentSignatureAlgorithm mode);
81 : : static bool isODFPre_1_2(const ::rtl::OUString & sODFVersion);
82 : : static bool isOOo3_2_Signature(const SignatureInformation & sigInfo);
83 : : static DocumentSignatureAlgorithm getDocumentAlgorithm(
84 : : const ::rtl::OUString & sODFVersion, const SignatureInformation & sigInfo);
85 : : static bool checkIfAllFilesAreSigned( const ::std::vector< ::rtl::OUString > & sElementList,
86 : : const SignatureInformation & sigInfo, const DocumentSignatureAlgorithm alg);
87 : : static bool equalsReferenceUriManifestPath(
88 : : const ::rtl::OUString & rUri, const ::rtl::OUString & rPath);
89 : : static ::rtl::OUString GetDocumentContentSignatureDefaultStreamName();
90 : : static ::rtl::OUString GetScriptingContentSignatureDefaultStreamName();
91 : : static ::rtl::OUString GetPackageSignatureDefaultStreamName();
92 : :
93 : : };
94 : :
95 : : #endif // _XMLSECURITY_XMLSIGNATUREHELPER_HXX
96 : :
97 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|