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 _SIGSTRUCT_HXX
21 : : #define _SIGSTRUCT_HXX
22 : :
23 : : #include <rtl/ustring.hxx>
24 : : #include <com/sun/star/util/DateTime.hpp>
25 : : #include <com/sun/star/xml/crypto/SecurityOperationStatus.hpp>
26 : :
27 : : #include <vector>
28 : :
29 : : /*
30 : : * type of reference
31 : : */
32 : : #define TYPE_SAMEDOCUMENT_REFERENCE 1
33 : : #define TYPE_BINARYSTREAM_REFERENCE 2
34 : : #define TYPE_XMLSTREAM_REFERENCE 3
35 : :
36 : 0 : struct SignatureReferenceInformation
37 : : {
38 : : sal_Int32 nType;
39 : : rtl::OUString ouURI;
40 : : rtl::OUString ouDigestValue;
41 : :
42 : 0 : SignatureReferenceInformation( sal_Int32 type, rtl::OUString uri )
43 : 0 : {
44 : 0 : nType = type;
45 : 0 : ouURI = uri;
46 : 0 : }
47 : : };
48 : :
49 : : typedef ::std::vector< SignatureReferenceInformation > SignatureReferenceInformations;
50 : :
51 : 0 : struct SignatureInformation
52 : : {
53 : : sal_Int32 nSecurityId;
54 : : sal_Int32 nSecurityEnvironmentIndex;
55 : : ::com::sun::star::xml::crypto::SecurityOperationStatus nStatus;
56 : : SignatureReferenceInformations vSignatureReferenceInfors;
57 : : rtl::OUString ouX509IssuerName;
58 : : rtl::OUString ouX509SerialNumber;
59 : : rtl::OUString ouX509Certificate;
60 : : rtl::OUString ouSignatureValue;
61 : : ::com::sun::star::util::DateTime stDateTime;
62 : :
63 : : //We also keep the date and time as string. This is done when this
64 : : //structure is created as a result of a XML signature being read.
65 : : //When then a signature is added or another removed, then the original
66 : : //XML signatures are written again (unless they have been removed).
67 : : //If the date time string is converted into the DateTime structure
68 : : //then information can be lost because it only holds a fractional
69 : : //of a second with a accuracy of one hundredth of second.
70 : : //If the string contains
71 : : //milli seconds (because the document was created by an application other than OOo)
72 : : //and the converted time is written back, then the string looks different
73 : : //and the signature is broken.
74 : : rtl::OUString ouDateTime;
75 : : rtl::OUString ouSignatureId;
76 : : rtl::OUString ouPropertyId;
77 : :
78 : 0 : SignatureInformation( sal_Int32 nId )
79 : 0 : {
80 : 0 : nSecurityId = nId;
81 : 0 : nStatus = ::com::sun::star::xml::crypto::SecurityOperationStatus_UNKNOWN;
82 : 0 : nSecurityEnvironmentIndex = -1;
83 : 0 : }
84 : : };
85 : :
86 : : typedef ::std::vector< SignatureInformation > SignatureInformations;
87 : :
88 : : #endif
89 : :
90 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|