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 :
42 : /**********************************************************
43 : DocumentSignatureHelper
44 :
45 : Helper class for signing and verifieng document signatures
46 :
47 : Functions:
48 : 1. help to create a list of content to be signed/verified
49 :
50 : **********************************************************/
51 :
52 : enum DocumentSignatureMode { SignatureModeDocumentContent, SignatureModeMacros, SignatureModePackage };
53 :
54 : enum DocumentSignatureAlgorithm
55 : {
56 : OOo2Document,
57 : OOo3_0Document,
58 : OOo3_2Document
59 : };
60 :
61 350 : struct SignatureStreamHelper
62 : {
63 : css::uno::Reference < css::embed::XStorage > xSignatureStorage;
64 : css::uno::Reference < css::io::XStream > xSignatureStream;
65 : };
66 :
67 :
68 : class DocumentSignatureHelper
69 : {
70 : public:
71 :
72 : static SignatureStreamHelper OpenSignatureStream(
73 : const css::uno::Reference < css::embed::XStorage >& rxStore, sal_Int32 nOpenMode,
74 : DocumentSignatureMode eDocSigMode );
75 : static std::vector< OUString > CreateElementList(
76 : const css::uno::Reference < css::embed::XStorage >& rxStore,
77 : const OUString rRootStorageName, DocumentSignatureMode eMode,
78 : const DocumentSignatureAlgorithm mode);
79 : static bool isODFPre_1_2(const OUString & sODFVersion);
80 : static bool isOOo3_2_Signature(const SignatureInformation & sigInfo);
81 : static DocumentSignatureAlgorithm getDocumentAlgorithm(
82 : const OUString & sODFVersion, const SignatureInformation & sigInfo);
83 : static bool checkIfAllFilesAreSigned( const ::std::vector< OUString > & sElementList,
84 : const SignatureInformation & sigInfo, const DocumentSignatureAlgorithm alg);
85 : static bool equalsReferenceUriManifestPath(
86 : const OUString & rUri, const OUString & rPath);
87 : static OUString GetDocumentContentSignatureDefaultStreamName();
88 : static OUString GetScriptingContentSignatureDefaultStreamName();
89 : static OUString GetPackageSignatureDefaultStreamName();
90 :
91 : };
92 :
93 : #endif // _XMLSECURITY_XMLSIGNATUREHELPER_HXX
94 :
95 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|