summaryrefslogtreecommitdiffstats
path: root/xmlsecurity
Commit message (Collapse)AuthorAgeFilesLines
* add missing deps on ui filesDavid Tardon2016-11-211-0/+4
| | | | Change-Id: I28bb2a33c02d8eadced584d3d3f2b62b2e847324
* gbuild allow unitest to run once per lang in WITH_LANG_LISTNorbert Thiebaud2016-11-201-1/+1
| | | | | | | | | | | | | | | this is motivated by the new screenshot feature the initial proposed solution involved running make screenshot once per lang which took ~6 hours for --with-lang=ALL on tb68 a reasonnably big windows slavebot. with this patch, one can run make screenshot just once and get all the screenshot the elapsed time is 36 inutes on the same box/same config a 10x improvement. Change-Id: I4339caebf915c118aa455de2a7e56e1a4e413939 Reviewed-on: https://gerrit.libreoffice.org/30970 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>
* The PDF tests require HAVE_FEATURE_PDFIMPORTTor Lillqvist2016-11-181-0/+10
| | | | Change-Id: Iac3d2206388fde23d2f3d7a05b23978851cf2800
* xmlsecurity: clean up unused mxSecurityControllerMiklos Vajna2016-11-183-10/+3
| | | | | | | Change-Id: Ife64ab3683479baf152357a6167718f13c9b6089 Reviewed-on: https://gerrit.libreoffice.org/30964 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
* Prefer to take the signature date from the XAdES SigningTime, if presentTor Lillqvist2016-11-182-4/+23
| | | | Change-Id: I15a00a8c6f8c8e735694baa25e06ed4db0875d43
* includes should be at the top of the fileNoel Grandin2016-11-181-3/+3
| | | | | | | | | | | | not randomly scattered through the code found with something like: git ls-files *.cpp | xargs grep -Pzl "(?s){.*#include" Change-Id: I9c242fa4ef99e8677f2800d7ec9f16d16e488351 Reviewed-on: https://gerrit.libreoffice.org/30952 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* xmlsecurity PDF sign: handle AdES when writing SubFilterMiklos Vajna2016-11-178-18/+22
| | | | | | | | | | | | | | Page 21 of "PAdES baseline signatures" specification from <http://www.etsi.org/deliver/etsi_en/319100_319199/31914201/01.01.01_60/en_31914201v010101p.pdf> says: "The Signature Dictionary shall contain a value of ETSI.CAdES.detached for the key SubFilter." So in case the UI has the adescompliant checkbox enabled, write that value instead of the Adobe default. Change-Id: I69e606a32fb09bebd5e9b25b32150d1b8672f544
* coverity#1394292 Unchecked return valueCaolán McNamara2016-11-171-1/+4
| | | | Change-Id: I90db6e3c69a6dc90ce1df0dbb5b9d7a81cd1bbea
* xmlsecurity: fix alignment for XAdES checkboxMiklos Vajna2016-11-163-14/+15
| | | | | | | | | | And rename it to AdES, as the PDF PAdES generation will be affected by this checkbox in the near future. Change-Id: I06121e4eb9debac7a55a737a71780c2fa5c4d084 Reviewed-on: https://gerrit.libreoffice.org/30908 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Tor Lillqvist <tml@collabora.com>
* Nothing from <tools/debug.hxx> used hereTor Lillqvist2016-11-167-7/+0
| | | | Change-Id: Ic7aa466c62eb8850d3c6b50c0e10b0575bd9b82e
* Add the Target for xd:QualifyingPropertiesTor Lillqvist2016-11-151-1/+3
| | | | Change-Id: Ic15c34c77ff24a506b59ed02db3cfbb6722d0f25
* Sign also the xd:SignedPropertiesTor Lillqvist2016-11-151-0/+6
| | | | Change-Id: If5793cd8a721ac5b4fce5280b6180f2827c72501
* Fix typosSamuel Mehrbrodt2016-11-151-1/+1
| | | | | | | Change-Id: I3e38b1d445c368c28e807202b94c603bd2b2c672 Reviewed-on: https://gerrit.libreoffice.org/30872 Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
* xsd:dateTime must use period as decimal separator, not commaTor Lillqvist2016-11-141-1/+4
| | | | Change-Id: I8ed5242a4337da2ec1568d92bebfdad4915e6128
* oox, xmlsecurity: fix recently introduced style problemsMiklos Vajna2016-11-141-1/+1
| | | | | | These files had a consistent style previously, keep them that way. Change-Id: I6347efd4a301ddd758f4661778c0dfb68585940d
* drop extra semicolonsDavid Tardon2016-11-131-1/+1
| | | | Change-Id: Ie6713d1bdf0010e5bc0bb70ca995c4dd36408673
* cid#1394298: This field was uninitialized and unusedTor Lillqvist2016-11-121-2/+0
| | | | | | Probably cid#1394297 was a fallout from that? Change-Id: I98134ccbbbe8bc0b7d3c172ffddcdc3666f436f6
* More EncapsulatedX509Certificate workTor Lillqvist2016-11-127-5/+29
| | | | Change-Id: I64239dfcfbc2383c2bf53c0cb86196d3f2c79330
* xmlsecurity: extract parts of PDFDocument::Sign() into separate functionsMiklos Vajna2016-11-112-33/+97
| | | | | | Hopefully it's easier to read this way. Change-Id: I145e00f8e57e20f2663d1c9ee494af5d93c014c7
* More XAdES workTor Lillqvist2016-11-115-1/+38
| | | | | | | Accept and store a set of EncapsulatedX509Certificate data for a signature. Change-Id: Iae69502bc8caa0287c8f6d6c352256bdda22406b
* 'make screenshot' use-after-free fixesStephan Bergmann2016-11-101-2/+2
| | | | Change-Id: I4302d0d767a1bf50fd34a78e9aa0ad6d6b0c7a22
* xmlsecurity PDF sign: support non-compressed AcroForm objectsMiklos Vajna2016-11-102-9/+28
| | | | | | | | | | This was the last problem to be able to counter-sign Acrobat-created PDF 1.6 signatures unlimited number of times. Change-Id: I24ab80c8516b6fe9c08d57c08907bec70384dc28 Reviewed-on: https://gerrit.libreoffice.org/30757 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
* xmlsecurity PDF verify: fix incremental updates vs object streamsMiklos Vajna2016-11-101-19/+18
| | | | | | | | | | | | | | | | | | | | The problem: an object stream provies obj#1 and obj#2, then an incremental updates provides an updated obj#1'. Then we look up obj#2, parse the stored objects on-demand, so at the end when later we look up the first object, we find obj#1, not obj#1'. An easy workaround would be to never update already existing objects from object streams, but that would break when an incremental update provides an object stream. Fix the problem by parsing stored objects right after tokenizing the object stream, and not later, on-demand, when we no longer have the context what objects should be ignored. This is needed (but not enough) to correctly append a signature at the end of a PDF file that has both object streams and incremental updates. Change-Id: I3c1fae5ac26804c8e8cc1984511f43cfa881c97b
* More work in progress on XAdES compliant ODF signingTor Lillqvist2016-11-1015-76/+170
| | | | | | | | | | | | | Pass an XAdES flag to a couple more functions and adapt to that. Factor out writeDigestMethod() and writeSignedProperties() from OOXMLSecExporter::Impl to DocumentSignatureHelper and use them in an additional place. Write xd:UnsignedProperties with EncapsulatedX509Certificate. Probably much more work needed. Change-Id: I2a0cd1db6dd487b9c7ba256ad29473de3d271cd8
* xmlsecurity PDF verify: fix reading multiple subsections from an xref streamMiklos Vajna2016-11-101-87/+105
| | | | | | | | | | | This is especially needed, as we don't bother compressing updated objects into sections on signing, we simply use a separate section for each updated object. Work towards supporting xref streams and incremental updates at the same time. Change-Id: Ie9759edbba816991615fafc6602cdd440141b989
* xmlsecurity PDF sign: use a predictor when compressing the xref streamMiklos Vajna2016-11-102-5/+46
| | | | | | | With this our xref stream output is close enough to Acrobat so that the existing signature verifier runs without any problems. Change-Id: I6eca7966890365759c269b465e4bf4d86d335219
* These functions don't even need to be XMLSECURITY_DLLPUBLICTor Lillqvist2016-11-091-11/+11
| | | | Change-Id: I8f2963c9b6b1c8717ea4d19453815fffa6e68484
* xmlsecurity PDF sign: compress the xref streamMiklos Vajna2016-11-091-1/+13
| | | | | | | | | | This way it's a bit smaller for large files and our output is closer to what Acrobat produces. Change-Id: Ide5f7b58a74a9d6ad7d806814eb57cb6931023cc Reviewed-on: https://gerrit.libreoffice.org/30726 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
* xmlsecurity PDF sign: improve suggested signature IDMiklos Vajna2016-11-092-2/+23
| | | | | | | | | | | So that when we have a single signature with ID="Signature2", then we use "Signature3" for the next ID, not "Signature2". (Acrobat uses that ID for the first signature.) Change-Id: I7032fbf014184da2a5be24730a92abc32a9a1258 Reviewed-on: https://gerrit.libreoffice.org/30725 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
* xmlsecurity PDF sign: conditionally write xref streamMiklos Vajna2016-11-091-61/+178
| | | | | | | | | | | In case the input document used a PDF 1.5 xref stream, not an old xref table, then write that as part of the incremental update. Acrobat seems to require this. Change-Id: I9f1f73140c26308f8720aa1ffe1b905d0e60ede0 Reviewed-on: https://gerrit.libreoffice.org/30724 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
* xmlsecurity PDF sign: handle when Catalog's AcroForm is an indirect dictionaryMiklos Vajna2016-11-091-30/+111
| | | | | | | | | | Normally it's a direct dictionary, but it's OK to have it as a reference, and then the referenced object is a dictionary. Change-Id: If09edaf23501883be68148e430c42e721ec68247 Reviewed-on: https://gerrit.libreoffice.org/30719 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
* Don't use a class for what namespaces are forTor Lillqvist2016-11-091-27/+19
| | | | | | | Sure, using a namespace means we have to decorate each function with the XMLSECURITY_DLLPUBLIC, but who cares. Change-Id: If9a364d1be9c5f4cd02f3f146e8b01bd608b373e
* loplugin:unnecessaryoverride and loplugin:overrideTor Lillqvist2016-11-091-8/+1
| | | | Change-Id: Id9daf4f5e3208eca8d3d845983b58ab056557621
* xmlsecurity PDF sign: handle when Page object's Annots is an indirect arrayMiklos Vajna2016-11-091-33/+82
| | | | | | | | | | Normally it's a direct array, but it's OK to have it as a reference, and then the referenced object is an array. Change-Id: I191150632c2d8317ee6fd8c8169a90996298faa4 Reviewed-on: https://gerrit.libreoffice.org/30718 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
* xmlsecurity PDF verify: fix handling of xref stream free objectsMiklos Vajna2016-11-082-3/+16
| | | | | | | | | | | | | | In case our xref table doesn't have an entry for "free" object types, then the table size won't provide a valid id for a next object. That resulted in creating all new objects with the same ID. With this, our verifier at least can see the new signature when appending one to a signed PDF 1.6 file. Change-Id: Iac39a400706cfcd23dd814d2b81cb8b950c69fc6 Reviewed-on: https://gerrit.libreoffice.org/30704 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
* xmlsecurity PDF sign: handle xref stream when reading trailerMiklos Vajna2016-11-081-6/+23
| | | | | | | | | | Don't give up signing just because PDF 1.4 trailer is missing, provided that PDF 1.5 xref stream is available. Change-Id: I03360d428346537583a4398aa3a94b195b428713 Reviewed-on: https://gerrit.libreoffice.org/30703 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
* xmlsecurity PDF sign: don't crash on missing trailerMiklos Vajna2016-11-081-0/+5
| | | | | | | | | | This will need cross-reference stream write support, just don't crash for now. Change-Id: Id48c131b22d4ed96174693f3e96b14c273d596a8 Reviewed-on: https://gerrit.libreoffice.org/30702 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
* xmlsecurity: move the sec context from the format helpers to the sign managerMiklos Vajna2016-11-089-95/+87
| | | | | | | | | | | | | | | | | The signature manager always creates an XML helper, and optionally creates a PDF helper as well. Both of them initialize xmlsec, and when the signature manager is deleted, there are two de-inits, leading to an assertion failure in xmlsec. Fix the problem by moving the duplicated xmlsec init to the signature manager. This has the additional benefit that general security-related code no longer has to talk to the XML helper, it can use the signature manager, which feels more natural. (What viewing a certificate had to do with XML?) Change-Id: If6a6bc433636445f3782849a367d4a7ac0be7688 Reviewed-on: https://gerrit.libreoffice.org/30695 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
* Fallout from previous commit 248dbe1de5eeea9e9173e53a0b1891f63ff73d68Tor Lillqvist2016-11-082-13/+1
| | | | | | | Remove SignatureInformation::nSecurityEnvironmentIndex as it was always -1. Change-Id: I39247e5c40ce36e394c30b450626eca533f46267
* Bin pointless (overloaded) member functionTor Lillqvist2016-11-082-21/+2
| | | | | | | | The XSecController::setX509Certificate() overload that took a sal_Int32 nSecurityEnvironmentIndex was called in just one place, and -1 was always passed for the nSecurityEnvironmentIndex. Change-Id: Ic37b7053c90a6fbb8b4e5b6485483d34c605b965
* Work in progress on supporting XAdES-compliant signatures for ODFTor Lillqvist2016-11-0818-62/+201
| | | | | | | | | | | xmlsecurity is such a mess. Too many different classes that actually have more or less identical life-time, with names that smell of delusions of grandeur. "Manager", "security framework controller" etc for stuff that actually exist only during the execution of a simple dialog. And then a "helper" class that actually in on a higher level than a "framework controller". But oh well. Change-Id: I86e461b1bc91a0d8f5b7fb9f13a5be201729df1e
* Fix typos (also in the code)Andrea Gelmini2016-11-072-4/+4
| | | | | | | Change-Id: I45d45513b102f4fdcb55e8de20b95b37f66ea463 Reviewed-on: https://gerrit.libreoffice.org/30658 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
* xmlsecurity PDF NSS verify: handle SHA1_WITH_RSAMiklos Vajna2016-11-044-2/+34
| | | | | | | | | | | SHA1_WITH_RSA is a signing algorithm, not a digest one, but let's accept it, so LO on Linux can verify a signature generated by LO on Windows. It's annoying that equivalent mapping in NSS is not part of their public API. Change-Id: I97186fcc1d118f922e5ee3cb472aa5b52bc4b5ca
* vcl: extract PDFWriter::GetDateTime() from PDFWriterImplMiklos Vajna2016-11-042-1/+17
| | | | | | | | And use it in xmlsecurity when signing an existing PDF. This is especially important on Windows, where the PKCS#7 blob doesn't have an (unsigned) timestamp. Change-Id: I4051dc19a43f8f8114d9f4d02309f28d6754e9ae
* update loplugin:unnnecessaryvirtual to handler destructorsNoel Grandin2016-11-042-4/+3
| | | | | | | | | and update modules writerfilter..xmloff with the resulting changes Change-Id: I54d19c22ddb0ff579b32e4934d266c925b19305c Reviewed-on: https://gerrit.libreoffice.org/30530 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* xmlsecurity PDF sign: enable unit tests on WindowsMiklos Vajna2016-11-033-33/+16
| | | | | | | | | | | Now that the mscrypto part of PDFDocument::ValidateSignature() is implemented it's possible to run these tests on Windows as well, provided the machine has at least one signing certificate installed. Also fix a race, where the workdir of the signing test was used by the pdfsigning test. Change-Id: I80bbfbb5dc4baa400f9a6b85961883a247b0f22b
* Bin the XSecController::m_pErrorMessage field as it was never usedTor Lillqvist2016-11-033-39/+0
| | | | | | It was only assigned to. Some follow-up simplification. Change-Id: I3b522064e946667d3a4c8fb82ee40bd0d44dd569
* Bin some useless commentsTor Lillqvist2016-11-031-15/+0
| | | | | | | | | | | | No need to have a comment saying 'write signatures' when calling a function that is called WriteSignature(). (Actually, the function name is slightly misleading, as it says 'signature' in singular while what it actually does is write multiple signatures, if present.) Also drop some leftover comments that were related to code that was commented out already in 2004 or 2007 and removed completely in 2010. Change-Id: I7a53b3eabb81fc03c66e746f78267be4c1751b0f
* Bin unused XSecuritySAXEventKeeper::cloneElementCollectorTor Lillqvist2016-11-032-38/+0
| | | | Change-Id: Icc0ead769fa0a052f7d4dfbc825c96dbb513b33f
* Bin pointless differentiated exception handlingTor Lillqvist2016-11-031-12/+0
| | | | | | | | All the catch blocks for classes derivved from uno::Exception contained the same single statement as the catch block for uno::Exception itself. Change-Id: Ic33b432416abfda7557862d25237dc7221585327