summaryrefslogtreecommitdiff
path: root/xmlsecurity/source/helper
AgeCommit message (Collapse)Author
2021-03-25do same set error state as ReadAndVerifySignature doesCaolán McNamara
this function is nearly exactly the same as ReadAndVerifySignature except it doesn't set error-state on exception during parse Change-Id: Ife881f639a11d3185920ca62cc2cd22812fae36d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112366 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112412 (cherry picked from commit 52a23d595b820cab27d76d0e7c129f2757c762d6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113050 Tested-by: Michael Stahl <michael.stahl@allotropia.de>
2020-12-03xmlsecurity: handle MDP permission during PDF verifyMiklos Vajna
(cherry picked from commit 586f6abee92af3cdabdce034b607b9a046ed3946) Conflicts: include/vcl/filter/PDFiumLibrary.hxx vcl/source/pdf/PDFiumLibrary.cxx xmlsecurity/source/helper/pdfsignaturehelper.cxx Change-Id: I626fca7c03079fb0374c577dcfe024e7db6ed5b3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105785 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 00479937dc071246cc27f33fd6397668448a7ed9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107062 Tested-by: Michael Stahl <michael.stahl@cib.de> Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-07-30xmlsecurity: detect unsigned incremental update between signaturesMiklos Vajna
(cherry picked from commit 7468d5df5ec79783eae84b62bdc5ecf12f0ca255) Conflicts: vcl/source/filter/ipdf/pdfdocument.cxx xmlsecurity/source/pdfio/pdfdocument.cxx Change-Id: I269ed858852ee7d1275adf340c8cc1565fc30693 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99382 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2019-10-09tdf#114441 changed some sal_uLong to better fitting typesChristian Barth
Change-Id: I114a6b028eb59a1ae38c31bc20439a35643fe972 Reviewed-on: https://gerrit.libreoffice.org/80159 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2019-09-28loplugin:constmethod in xmlsecurityNoel Grandin
Change-Id: I7892b4819fd7491882e6ca995bf2ce5c65230609 Reviewed-on: https://gerrit.libreoffice.org/79791 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-10Fix typosAndrea Gelmini
Change-Id: Id62178a1a8b2e05d13c47f1ac4798578f140dbae Reviewed-on: https://gerrit.libreoffice.org/78794 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2019-09-06Fixing '....' and '..'Andrea Gelmini
Change-Id: I926069d6c1f2712e5020d930f7ff6c62fd00e912 Reviewed-on: https://gerrit.libreoffice.org/78667 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-08-16new loplugin:sequenceloopNoel Grandin
look for places we should be using std::as_const on for-range loops over uno::Sequence, to avoid triggering a copy Change-Id: I7efb641bf09d37c87946f03428ee4eec90298c8a Reviewed-on: https://gerrit.libreoffice.org/77441 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-07-31Fix typosAndrea Gelmini
Change-Id: I69e5c6d82fddd1da1e414e7764f3a5d90351a43d Reviewed-on: https://gerrit.libreoffice.org/76377 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-07-31Improved loplugin:stringconstant (now that GCC 7 supports it): xmlsecurityStephan Bergmann
Change-Id: I47c93247b9a34abf4b95966833664e63eb57f133 Reviewed-on: https://gerrit.libreoffice.org/76621 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-07-24Fix typosAndrea Gelmini
Change-Id: Ib778a6598f3797fe871a25b56b7b4b7761889296 Reviewed-on: https://gerrit.libreoffice.org/76269 Tested-by: Jenkins Reviewed-by: Andrea Gelmini <andrea.gelmini@gelma.net>
2019-07-21loplugin:referencecasting in xmlsecurityNoel Grandin
Change-Id: Ic3daba9e6e94516ea4d80f25f73e9e46a50edb5c Reviewed-on: https://gerrit.libreoffice.org/76035 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-06-18loplugin:logexceptionnicely in xmlhelp..xmlsecurityNoel Grandin
Change-Id: Idbf0de3f953b08f98144241346533ad30f49269e Reviewed-on: https://gerrit.libreoffice.org/74285 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-05-29Removed duplicated includeAndrea Gelmini
In any case is included a few lines after, so I guess it can be removed the check (if it's not ready also for future other includes). Change-Id: Id603022092a60b71a5b35ec57930146d23c6544a Reviewed-on: https://gerrit.libreoffice.org/73093 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-05-27xmlsecurity: add missing includeMiklos Vajna
Broke the build on Ubuntu 18.04: In file included from /home/tinderbox/core-master/workdir/UnoApiHeadersTarget/udkapi/normal/com/sun/star/uno/XInterface.hpp:10:0, from /home/tinderbox/core-master/workdir/UnoApiHeadersTarget/udkapi/normal/com/sun/star/uno/Exception.hpp:8, from /home/tinderbox/core-master/workdir/UnoApiHeadersTarget/udkapi/normal/com/sun/star/uno/RuntimeException.hpp:8, from /home/tinderbox/core-master/include/com/sun/star/uno/Any.hxx:37, from /home/tinderbox/core-master/include/com/sun/star/uno/genfunc.hxx:27, from /home/tinderbox/core-master/include/com/sun/star/uno/Sequence.hxx:35, from /home/tinderbox/core-master/include/svl/sigstruct.hxx:27, from /home/tinderbox/core-master/xmlsecurity/inc/xsecctl.hxx:23, from /home/tinderbox/core-master/xmlsecurity/source/helper/xsecctl.cxx:22: /home/tinderbox/core-master/include/com/sun/star/uno/Reference.hxx: In instantiation of ‘static com::sun::star::uno::XInterface* com::sun::star::uno::Reference< <template-parameter-1-1> >::iquery(com::sun::star::uno::XInterface*) [with interface_type = com::sun::star::xml::crypto::XXMLSignature]’: /home/tinderbox/core-master/include/com/sun/star/uno/Reference.hxx:279:42: required from ‘bool com::sun::star::uno::Reference< <template-parameter-1-1> >::set(const com::sun::star::uno::BaseReference&, com::sun::star::uno::UnoReference_Query) [with interface_type = com::sun::star::xml::crypto::XXMLSignature]’ /home/tinderbox/core-master/xmlsecurity/source/helper/xsecctl.cxx:190:124: required from here /home/tinderbox/core-master/include/com/sun/star/uno/Reference.hxx:70:73: error: incomplete type ‘com::sun::star::xml::crypto::XXMLSignature’ used in nested name specifier return BaseReference::iquery(pInterface, interface_type::static_type()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~ /home/tinderbox/core-master/solenv/gbuild/LinkTarget.mk:290: recipe for target '/home/tinderbox/core-master/workdir/CxxObject/xmlsecurity/source/helper/xsecctl.o' failed make[1]: *** [/home/tinderbox/core-master/workdir/CxxObject/xmlsecurity/source/helper/xsecctl.o] Error 1 Change-Id: I864da5bd6d163a3de35280bff367e6b51aced23d Reviewed-on: https://gerrit.libreoffice.org/73035 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2019-05-20writerfilter: make RTFParserState members private, part 1Miklos Vajna
Change-Id: Iae4d454e0b160ee7f5b39d252505748c693a9c9e Reviewed-on: https://gerrit.libreoffice.org/72554 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-05-13fix wrong SET/QUERY flags passed to uno::ReferenceNoel Grandin
By creating deleted methods for the wrong calls. Avoids the compiler needing to construct a temporary Change-Id: I3b8c648d6bb22d22827bf74f21ea5a2a17fc0f6a Reviewed-on: https://gerrit.libreoffice.org/72103 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-05-09Simplify Sequence iterations in xmlscript, xmlsecurityArkadiy Illarionov
Use range-based loops or replace with comphelper or STL functions Change-Id: I3d63811caf80c87a9d560087e1f0d933ebcc0d55 Reviewed-on: https://gerrit.libreoffice.org/72040 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-05-09tdf#42949 Fix IWYU warnings in xmlsecurity/*cxxGabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: I89c77656ea4021cb16bd122cb1dd1cd803390c3d Reviewed-on: https://gerrit.libreoffice.org/71765 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-05-02Use hasElements to check Sequence emptiness in [v-x]*Arkadiy Illarionov
Similar to clang-tidy readability-container-size-empty Change-Id: I71e7af4ac3043d8d40922e99f8a4798f0993294c Reviewed-on: https://gerrit.libreoffice.org/71603 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-04-29xmlsecurity: fix the Android buildMiklos Vajna
Change-Id: Ib04060ee4dc2a4ece2858548690e8ef182bf00b1
2019-04-29tdf#42949 Fix IWYU warnings in xmlsecurity/*hxxGabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. All hxx cleaned except the ones in xmlsecurity/source/xmlsec/mscrypt Change-Id: I651f53c9d339208b3132f9078a5c3829ff9c5dc8 Reviewed-on: https://gerrit.libreoffice.org/71448 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-04-15loplugin:sequentialassign in writerfilter..xmlsecurityNoel Grandin
Change-Id: I41028c704eca08b71746c3c87e38926b95449775 Reviewed-on: https://gerrit.libreoffice.org/70735 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-04-09tdf#123747 xmlsecurity, ODF sign roundtrip: preserve invalid reference typeMiklos Vajna
Only add the correct type to new signatures to avoid breaking the hash of old ones. Change-Id: I30f892b292f84a0575a3d4ef5ccf3eddbe0090ca Reviewed-on: https://gerrit.libreoffice.org/70424 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-02-11new loplugin indentationNoel Grandin
look for mixed indentation in compound statements, which makes them hard to read, and sometimes makes it look like a statement is associated with a nearby if/for Change-Id: Ic8429cee1f9a86d938097a4a8769a2bce97b3361 Reviewed-on: https://gerrit.libreoffice.org/63283 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-01-13Avoid OUString temporaries, simplifyMatteo Casalin
Change-Id: I85b3cc9684673a204c3bf7428940d8efb8082fb6 Reviewed-on: https://gerrit.libreoffice.org/66223 Tested-by: Jenkins Reviewed-by: Matteo Casalin <matteo.casalin@yahoo.com>
2019-01-11o3tl::make_unique -> std::make_unique in xmlsecurity/Gabor Kelemen
Since it is now possible to use C++14, it's time to replace the temporary solution with the standard one Change-Id: Ie15220b53c6687e1d4891df668b2dedeae5e4750 Reviewed-on: https://gerrit.libreoffice.org/65795 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-12-31Remove some useless whitespacesTomaž Vajngerl
Change-Id: Iebf7add3dd937afb6dad07a10ecbe768c0a79d36 Reviewed-on: https://gerrit.libreoffice.org/65764 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2018-12-24Fix signing empty Configurations2/accelerator/current.xmlTomaž Vajngerl
When determining if a file is an XML file for siging, we need to read the manifest file to get an accurate detection. In case when we were signing in the GUI the manifest file was read when the storage was set. When we didn't sign over the GUI, the manifest was never read: the code was only present in the GUI code - "documentsignaturesdialog.cxx" so the detection was wrong and isXML returned "true" for current.xml. With this we move the manifest reading to DigitalSignatureManager, where the manifest is read when needed. Change-Id: If45a32af6410bc5f7c5afdb976b182bd69ab7d6b Reviewed-on: https://gerrit.libreoffice.org/65600 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2018-12-01convert to range forTomaž Vajngerl
Change-Id: I3558010129eaafdab94ca3f8a63abeda32318fbb Reviewed-on: https://gerrit.libreoffice.org/64336 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2018-11-14xmlsecurity: make members of OOXMLSecExporter::Impl privateMiklos Vajna
Change-Id: I456d9b53fd1168b382a2220716d010556eabbd22 Reviewed-on: https://gerrit.libreoffice.org/63344 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2018-10-29xmlsignaturehelper: fix comments, no changeTomaž Vajngerl
Change-Id: Ibfdf92712264ad37aafed53db0fe8e8c4fea4699 Reviewed-on: https://gerrit.libreoffice.org/61913 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2018-10-26tdf#42949 Fix IWYU warnings in include/unotools/*Gabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: I444c43b9d549977039f25bec2b5bf666c3e15e0e Reviewed-on: https://gerrit.libreoffice.org/62041 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-10-25use "range for" to iterate through certificatesTomaž Vajngerl
Change-Id: Ife206ab29f2f8eaa2358f45e6bae2290d95fd4d6 Reviewed-on: https://gerrit.libreoffice.org/61779 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2018-10-15add SvStream::TellEndNoel Grandin
and simplify callsites to use it instead of the current "seek to end, find pos, seek back to original pos" pattern Change-Id: Ib5828868f73c341891efc759af8bd4695ae2f33c Reviewed-on: https://gerrit.libreoffice.org/61738 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-19tdf#118567 Signature Line: Fix ooxml signingSamuel Mehrbrodt
Change-Id: Ie2467db7ab209f10e92b6db1f5680e7a9be614ab Reviewed-on: https://gerrit.libreoffice.org/60676 Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2018-09-19SignatureType should be "2" for ooxml signaturesSamuel Mehrbrodt
This is what recent MS Office writes and means XmlDsig Change-Id: I053f4a3261d7925142666c7d1e2e7dbb51eaff57 Reviewed-on: https://gerrit.libreoffice.org/60675 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2018-09-17New loplugin:externalStephan Bergmann
...warning about (for now only) functions and variables with external linkage that likely don't need it. The problems with moving entities into unnamed namespacs and breaking ADL (as alluded to in comments in compilerplugins/clang/external.cxx) are illustrated by the fact that while struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } returns 1, both moving just the struct S2 into an nunnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { namespace { struct S2: S1 { int f() { return 1; } }; } int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } as well as moving just the function f overload into an unnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; namespace { int f(S2 s) { return s.f(); } } } int main() { return f(N::S2()); } would each change the program to return 0 instead. Change-Id: I4d09f7ac5e8f9bcd6e6bde4712608444b642265c Reviewed-on: https://gerrit.libreoffice.org/60539 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-09-13loplugin:simplifyconstruct in writerfilter..xmlsecurityNoel Grandin
Change-Id: Ic2d901ca0dbc2d6fa96611d260c1572da8a783c0 Reviewed-on: https://gerrit.libreoffice.org/60398 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-12Simplify containers iterations in xmlsecurityArkadiy Illarionov
Use range-based loop or replace with functions from std algorithm. Change-Id: I0146186b7c42405076dfce7de7805be4228cc6d3 Reviewed-on: https://gerrit.libreoffice.org/60360 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-29Replace find_if with proper quantifier algorithmsArkadiy Illarionov
Change-Id: Icc820a47ac891c358883f9c01224f676c58fdd11 Reviewed-on: https://gerrit.libreoffice.org/59744 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-27tdf#119309 xmlsecurity xades: missing XML attribute on idSignedProperties refMiklos Vajna
The AdES validator at <https://ec.europa.eu/cefdigital/DSS/webapp-demo/validation> recently learned to deal with ODF files, this improves its output, so that "Qualification Signature" section is no longer just a red "N/A" but an orange "Indeterminate QESig". Change-Id: I5f47b935f1dbfa4e2eee4654db31403479cb571d Reviewed-on: https://gerrit.libreoffice.org/59633 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-08-20Simplify containers iterations, tdf#96099 follow-upArkadiy Illarionov
Use range-based loop or replace with std::any_of, std::find and std::find_if where applicable. Change-Id: I2f80788c49d56094c29b102eb96a7a7c079567c6 Reviewed-on: https://gerrit.libreoffice.org/59143 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-01forcepoint#57 sanity check stream signature sizeCaolán McNamara
Change-Id: I5ae459e159a64f32c62278a87e37deb08ab9d6ac Reviewed-on: https://gerrit.libreoffice.org/58389 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-08-01flatten conditionalsCaolán McNamara
Change-Id: I3b3e45a20c41e538849b7b0b4cdf112d8fac8fe7 Reviewed-on: https://gerrit.libreoffice.org/58388 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-07-23Fix typosAndrea Gelmini
Change-Id: Iebc31a53404da41f35eed7338662365d7efbd7a2 Reviewed-on: https://gerrit.libreoffice.org/57810 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2018-07-20writerfilter, xmlsecurity: various small cleanupsMiklos Vajna
That call in the RTFSprms copy ctor to the parent non-copy ctor was a bit odd. Change-Id: Ic219ec22c0b63472766a668406585dbbeebae2f7 Reviewed-on: https://gerrit.libreoffice.org/57763 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins
2018-07-12Add missing sal/log.hxx headersGabor Kelemen
rtl/string.hxx and rtl/ustring.hxx both unnecessarily #include <sal/log.hxx> (and don't make use of it themselves), but many other files happen to depend on it. This is a continuation of commit 6ff2d84ade299cb3d14d4110e4cf1a4b8070c030 to be able to remove those unneeded includes. This commit adds missing headers to every file found by: grep -FwL sal/log.hxx $(git grep -Elw 'SAL_INFO|SAL_INFO_IF|SAL_WARN|SAL_WARN_IF|SAL_DETAIL_LOG_STREAM|SAL_WHERE|SAL_STREAM|SAL_DEBUG') to directories w* x* Change-Id: I27bff44da3d34d24262031c7489e755311599bc5 Reviewed-on: https://gerrit.libreoffice.org/57307 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-07-05tdf#117901 Write signature line images as emf to ooxmlSamuel Mehrbrodt
Change-Id: Idbf60be3cef2d9dde454da0279d2810488b1e157 Reviewed-on: https://gerrit.libreoffice.org/56871 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2018-06-15tdf#96099 Remove some trivial std::vector iterator typedefsArkadiy Illarionov
Change-Id: Iced10ed59c475dff4d33ff06151b2015a27a860b Reviewed-on: https://gerrit.libreoffice.org/55715 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com>