1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _SIGSTRUCT_HXX 25 #define _SIGSTRUCT_HXX 26 27 #include <rtl/ustring.hxx> 28 #include <com/sun/star/util/DateTime.hpp> 29 30 #include <com/sun/star/xml/crypto/SecurityOperationStatus.hpp> 31 32 #ifndef INCLUDED_VECTOR 33 #include <vector> 34 #define INCLUDED_VECTOR 35 #endif 36 37 /* 38 * signature status 39 */ 40 /* 41 #define STATUS_INIT 0 42 #define STATUS_CREATION_SUCCEED 1 43 #define STATUS_CREATION_FAIL 2 44 #define STATUS_VERIFY_SUCCEED 3 45 #define STATUS_VERIFY_FAIL 4 46 */ 47 48 /* 49 * type of reference 50 */ 51 #define TYPE_SAMEDOCUMENT_REFERENCE 1 52 #define TYPE_BINARYSTREAM_REFERENCE 2 53 #define TYPE_XMLSTREAM_REFERENCE 3 54 55 struct SignatureReferenceInformation 56 { 57 sal_Int32 nType; 58 rtl::OUString ouURI; 59 rtl::OUString ouDigestValue; 60 SignatureReferenceInformationSignatureReferenceInformation61 SignatureReferenceInformation( sal_Int32 type, rtl::OUString uri ) 62 { 63 nType = type; 64 ouURI = uri; 65 } 66 }; 67 68 typedef ::std::vector< SignatureReferenceInformation > SignatureReferenceInformations; 69 70 struct SignatureInformation 71 { 72 sal_Int32 nSecurityId; 73 sal_Int32 nSecurityEnvironmentIndex; 74 ::com::sun::star::xml::crypto::SecurityOperationStatus nStatus; 75 SignatureReferenceInformations vSignatureReferenceInfors; 76 rtl::OUString ouX509IssuerName; 77 rtl::OUString ouX509SerialNumber; 78 rtl::OUString ouX509Certificate; 79 rtl::OUString ouSignatureValue; 80 ::com::sun::star::util::DateTime stDateTime; 81 82 //We also keep the date and time as string. This is done when this 83 //structure is created as a result of a XML signature being read. 84 //When then a signature is added or another removed, then the original 85 //XML signatures are written again (unless they have been removed). 86 //If the date time string is converted into the DateTime structure 87 //then information can be lost because it only holds a fractional 88 //of a second with a accuracy of one hundredth of second. 89 //If the string contains 90 //milli seconds (because the document was created by an application other than OOo) 91 //and the converted time is written back, then the string looks different 92 //and the signature is broken. 93 rtl::OUString ouDateTime; 94 rtl::OUString ouSignatureId; 95 rtl::OUString ouPropertyId; 96 SignatureInformationSignatureInformation97 SignatureInformation( sal_Int32 nId ) 98 { 99 nSecurityId = nId; 100 nStatus = ::com::sun::star::xml::crypto::SecurityOperationStatus_UNKNOWN; 101 nSecurityEnvironmentIndex = -1; 102 } 103 }; 104 105 typedef ::std::vector< SignatureInformation > SignatureInformations; 106 107 #endif 108 109