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