Commit Graph
610 Commits
Author SHA1 Message Date
Rafał Dobrakowski 03b00e03c2 tdf#146619 Remove unused #includes from C/C++ files
'xmlsecurity' module was cleaned.

Add some headers from xmlsec-wrapper.h in preparation
for its removal

Change-Id: Id66e6d40d4d5d980626832c0e2f6255fc31b4bcf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164639
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
2024-03-28 12:50:41 +01:00
Rafael Lima 6178387f7b tdf#159985 Warn about the need to reload file after changing macro security level
Change-Id: I191fd5d676d6d54fb0ef15652420afdceab2fc78
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164810
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
2024-03-19 14:48:34 +01:00
Gabor Kelemen f35ff76607 Remove SaveODFItem class
This is effectively unused since:
commit d22ab7b444

Change-Id: I6f646b7daf845035196fc9dde4ff270b8143d37a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164645
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2024-03-12 18:49:26 +01:00
Patrick Luby ce8d6b6836 Related: tdf#152524 eliminate UserData struct name collision
The cui module has its own UserData struct and when building with
--enable-mergelibs=more, this data collision will cause a crash
when deleting a UserData instance in the xmlsecurity module because
the cui module already has its own, unrelated UserData struct.

Change-Id: I6418b049c72a2e902c9b5076b72fd240f65a593d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164404
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-05 18:35:14 +01:00
Patrick Luby efe414c4a8 Don't reuse CertificateChooser instances
Reusing the same instance will, in the following case, lead to a
crash. It appears that the CertificateChooser is getting disposed
somewhere as mpDialogImpl in its base class ends up being null:

1. Create an empty Writer document and add a digital signature
   in the Digital Signatures dialog
2. File > Save As the document, check the "Encrypt with GPG key"
   checkbox, press Encrypt, and crash in Dialog::ImplStartExecute()

Change-Id: I9aaa1bd449622e018b502d68c53d397255a1b61a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163065
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Patrick Luby <guibomacdev@gmail.com>
2024-02-07 14:40:50 +01:00
Caolán McNamara cf4514d4e7 Resolves: tdf#156352 disable sorting while adding rows
looks like the new row gets sorted immediately when added as an empty
row into the first row, so accessing it by index later to set it text/id
get an unexpected result.

pause sorting while inserting the entries and enable it again when
finished for the easiest fix.

Change-Id: Ib028b193afbf2b9026841b19419e012b70448e39
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162993
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-02-05 13:41:00 +01:00
Patrick Luby 538f7b45c0 tdf#147291 add more default certificate manager application for macOS
Add the following applications to the macOS GUI servers list:

- Trusted Key Manager - CertEurope
- SCInterface Manager and SmartCard tools

Change-Id: Iec78171c6e82f0a072f5f06b79606560a8cc03cc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162942
Tested-by: Jenkins
Reviewed-by: Patrick Luby <guibomacdev@gmail.com>
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-05 09:03:56 +01:00
Patrick Luby 29bf86f7cb tdf#159307 add default macOS certificate manager applications
Most, if not all, of the Linux certificate manager applications are
not available on macOS so create a separate list for macOS.

Also, fix uncloseable windows due to uncaught exceptions thrown by
XSystemShellExecute::execute(). Failure to catch such exceptions
would cause the document window to be uncloseable and the application
to be unquittable.

Change-Id: I9bc6dc9c6c9d054252b634874045cb066023214a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162887
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-02 07:55:01 +01:00
Stephan Bergmann 32ef7cea77 tdf#159307 Fix GetCertificateManager
...which had always cut off an existing path ever since
92b6ffcd9f "Allow selecting a custom certificate
manager", for reasons that are unclear to me.

So if an existing setting contains at least one slash (or backslash, on
Windows), try to use it as-is; otherwise, keep searching for it in aPath.  (And,
in any case, make sure to report back the given value in sExecutable.)

Change-Id: I8b2b6ac7a449d7afd02e029ff46d4c79e6b824e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162703
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-01-30 07:38:28 +01:00
Mike Kaganski 0fa827dbb2 Drop std::as_const from css::uno::Sequence iterations
Obsoleted by commit 2484de6728 (Remove
non-const Sequence::begin()/end() in internal code, 2021-10-15) and
commit fb3c04bd19 (Drop non-const
Sequence::operator[] in internal code, 2021-11-05).

Change-Id: Idbafef5d34c0d4771cbbf75b9db9712e504164cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162640
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-01-27 12:43:48 +01:00
Michael Stahl 4eebf31e38 xmlsecurity: remove "AdES-compliant signature" checkbox
This is essentially a footgun because the user can accidentally turn it
off and get non-AdES signatures which use obsolete SHA1 hashes.

Unfortunately it turns out that the initial setting of the checkbox only
works for ODF, because OOXML have m_sODFVersion set to "1.0" due to some
defaulting code somewhere.

So what this checkbox actually did is unintentionally disable XAdES
signatures for OOXML by default.

Now that i actually test it by setting ODF version 1.1 in
Tools->Options, it turns out that signing ODF 1.1 documents isn't
possible at all, a dialog pops up that says "Signing documents
requires ODF 1.2 (OpenOffice.org 3.x)".

Change-Id: I0eaf590c290b2c0ee0ff890ed73f0dbea4cf0ce3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160785
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-12-15 10:52:04 +01:00
Michael Stahl 53c64cce13 xmlsecurity: fix assert in CertificateChooser::ImplInitialize()
gtk3/gtkinst.cxx:15371: virtual void (anonymous namespace)::GtkInstanceTreeView::select(int): Assertion `gtk_tree_view_get_model(m_pTreeView) && "don't select when frozen, select after thaw. Note selection doesn't survive a freeze"' failed.

(regression from commit ad6f23d2a3)

Change-Id: I8c0639e755188731bdd211f9d71a830d7afeeaa6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160786
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-12-15 10:51:22 +01:00
Arnaud VERSINI 0c4913e03e xmlsecurity : simplify DigitalSignature
Change-Id: I05777731f1d69b5714942411401afb5fd605d726
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155668
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-09-19 11:29:49 +02:00
TokieSan fb9874231f Caching Certificates in the CertificateChooser dialog session-wise
Added the functionality of caching certificates per session using a
single instance with internal memoization. Added Reload Certificates
button in case of certificate changes in-session. Updated all instances
of certifcate chooser in the codebase to work with the new change.

Change-Id: Icb25a2b2e9787b029fa6189f70bd4ba3b6806f60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155373
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2023-08-26 00:59:48 +02:00
TokieSan 9f327102c4 Removed Type and Usage Columns from Certificate Chooser
Both columns are irrelevant in the main dialog's view, can be viewed
through viewing certificate's details.

Change-Id: I265a7e125c2679f3a05dba4414f4104f3a5cac2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155746
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
2023-08-23 08:42:27 +02:00
Arnaud VERSINI 127a55391c xmlsecurity : simplify DigitalSignaturesDialog
Change-Id: I460d56a5a13dde1bd77f21e0bb6467dd00cb3f40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154498
Tested-by: Jenkins
Reviewed-by: Arnaud Versini <arnaud.versini@libreoffice.org>
2023-08-07 11:28:40 +02:00
Noel Grandin a66b9c9adf loplugin:unusedfields
Change-Id: Ic2e9de67a00bb9ca8ab4d0f7528b22c58d0cc360
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154721
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-07-21 22:16:34 +02:00
TokieSan ad6f23d2a3 Added searching and filtering features to certificate chooser dialog
Added a new search box in the certificate chooser dialog, introduced
local caching for certificates to allow instantaneous filtering and
searching. Modified viewing signatures function to allow searching
functionality.

Change-Id: I361a47da7bd5d24efcbfc17065935851db951c44
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154630
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2023-07-20 13:05:14 +02:00
Arnaud VERSINI d22ab7b444 xmlsecurity : simplify DigitalSignaturesDialog::canAddRemove.
(!a && b) || (a && b) => b

Change-Id: Iee9ae38d9dc5f6aa94eaff61b3937633f5da7af1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154285
Tested-by: Jenkins
Reviewed-by: Arnaud Versini <arnaud.versini@libreoffice.org>
2023-07-17 10:58:27 +02:00
Miklos Vajna a0471ec6e9 xmlsecurity: fix deadlock on preloading libsdlo.so
The trouble is that calling into the configmgr would require recursive
access to the service manager, but that's protected by a non-recursive
mutex.

See
<https://gerrit.libreoffice.org/c/core/+/153798/24#message-b04c747da2cb73230d88ec65cc8207ac8b124dda>
for details.

Change-Id: If75779a995c2ad8855073bd6538832a18953d4cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154356
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-07-12 15:41:26 +02:00
TokieSan 92b6ffcd9f Allow selecting a custom certificate manager
Added a new option in Tools>Options>Security that allows choosing the
path of a different certificate manager.

Made Certificate Manager Button be disabled instead of hidden in case no
certificate manager is detected. Added a box notifying that the
certificate manager is opened (or not working in case it failed for some
reason).

Change-Id: I64a901766d4fb05c59c0f85fdf94c08a3ca4bdab
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153798
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2023-07-11 16:30:59 +02:00
Arnaud VERSINI f57bb8bbad xmlsecurity : remove deadcode and usage of array template
Change-Id: I282e2af395471aa4818bfb4586ac06c7850c8a61
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153862
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Arnaud Versini <arnaud.versini@libreoffice.org>
Tested-by: Arnaud Versini <arnaud.versini@libreoffice.org>
2023-07-07 07:59:51 +02:00
Arnaud VERSINI 66e25cfe4f xmlsecurity : remove unneccessary static variables
Change-Id: Ie7ecba234f33cc09ebd4cf5a390919acb4bc7e08
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153567
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-06-26 07:56:01 +02:00
TokieSan 17ba20e132 Certificate Manager button is hidden in case no manager exists.
A new function is implemented to check for that in
digitalsignaturesdialog.cxx

Change-Id: I4cf1c710e6a145e8f0d10716cb81394bdcf7a74f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153367
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2023-06-24 18:19:18 +02:00
Mike Kaganski 8de1bf3674 Introduce sal::systools::CoTaskMemAllocated to use RAII for CoTaskMemFree
Change-Id: I5553138bfc8dd989e68b8bcc2be981746e8c1e84
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150783
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-04-22 17:45:40 +02:00
Mike Kaganski 116b9d6ddf Avoid conversions between OUString and OString in VCL
Standardize on OUString, which is the main internal string class.
Convert from/to OUString only when communicating with respective
external APIs.

Removes about 200 conversions from the code.

Change-Id: I96ecee7c6fd271bb76639220e96d69d2964bed26
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149930
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-04-02 18:46:47 +02:00
Stephan Bergmann 91ba9654ba Move tools/diagnose_ex.h to comphelper/diagnose_ex.hxx
...so that its TOOLS_WARN_EXCEPTION can be used in
comphelper/source/misc/logging.cxx in a follow-up commit.  (And while at it,
rename from diangose_ex.h to the more appropriate diagnose_ex.hxx.  The
comphelper module is sufficiently low-level for this immediate use case, so use
that at least for now; o3tl might be even more suitable but doesn't have a
Library until now.  Also, for the immediate use case it would have sufficed to
only break DbgGetCaughtException, exceptionToString, TOOLS_WARN_EXCEPTION,
TOOLS_WARN_EXCEPTION_IF, and TOOLS_INFO_EXCEPTION out of
include/tools/diagnose_ex.h into an additional new
include/comphelper/diagnose_ex.hxx, but its probably easier overall to just move
the complete include file as is.)

Change-Id: I9f3222d4ccf1a9ac29d7eb9ba1530d53e2affaee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138451
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-08-18 17:10:19 +02:00
Noel Grandin 44a11bb8c9 clang-tidy modernize-pass-by-value in xml*
Change-Id: I9bd5f6adfd138c391d76aebfe08ba01e6b3ab3bf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137550
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-07-28 10:42:37 +02:00
Caolán McNamara e00032ba6a add toId/fromId to tidy up some ugly casting
Change-Id: I70f34ac5e9b5d2f2d6c0375e823908eaa2e540b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129487
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-02-04 15:02:03 +01:00
Szymon Kłos 1da258a626 Make Certificate not found dialog async
Change-Id: I8da2a2dc763cffd13659b61966a954a6e1ef06a4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124269
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128841
Tested-by: Jenkins
2022-01-24 13:46:57 +01:00
Szymon Kłos 98d2c965ac Make View Certificate sub-dialog async
Change-Id: I0e1a6a59d856ab266511fc3d6be87fe04c5afdfc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124143
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128840
Tested-by: Jenkins
2022-01-24 13:46:42 +01:00
Szymon Kłos c13ec26f6a Make View Certificate dialog async
Change-Id: Id93145ecf6be3cb558f0ce8d3cc340bbc67095e0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124061
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128839
Tested-by: Jenkins
2022-01-24 09:44:19 +01:00
Szymon Kłos 71a8bad4b9 jsdialog: enable Digital Signatures dialog
In LOK case run it in the readonly mode.
In readonly mode we can run it asynchronously.

Change-Id: I721dd14fa23d4e30255dd976e0cc2a4f30470a3b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124058
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128838
Tested-by: Jenkins
2022-01-24 09:43:53 +01:00
Julien Nabet 4af72419f3 Simplify vector initialization in xmlsecurity
Change-Id: Ia19ffa1213d578c30f35545bcca515669e7ff7a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123710
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2021-10-17 12:30:15 +02:00
Noel Grandin 13fa6834c9 loplugin:moveparam in xmlsecurity
Change-Id: I3ce77ab82529f13c5e55ea30c813f66cb5180877
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123369
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-11 12:58:41 +02:00
Noel Grandin 64937ff98a loplugin:moveparam in unotools
Change-Id: Idd014c93e2e85d2ffc7a2535a9c65cffc8a9d403
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123348
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-11 10:39:38 +02:00
Noel Grandin 6cc1ee9035 clang-tidy:readability-redundant-member-init
Change-Id: Iede70151af052505b780c6ce708aa74d97da5c75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121545
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-03 12:44:22 +02:00
Noel Grandin 14cfff500e Pass context and resource string down to boost::locale separately
because this is often on a hot path, and we can avoid the splitting and
joining of strings like this.

Change-Id: Ia36047209368ca53431178c2e8723a18cfe8260a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119220
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-05 09:39:11 +02:00
Noel Grandin 6ed8c5a0f1 use officecfg for security options
Change-Id: I9d91fd5b260b82e05aac6567143386742953ecf6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119486
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-26 14:25:35 +02:00
Caolán McNamara a8f97e5fca bundle the FolderPicker instantiations behind a single call
in prep to add parent support

Change-Id: I2aa4b9343f895ae866f600dd3260b7fdc4e1efec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117579
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-06-21 15:29:59 +02:00
Caolán McNamara 9940f077fd add Toggleable as a separate thing to a Button
and inherit ToggleButton from both it and Button

Change-Id: If0e500aca8d0ffa087cb5e2bfc1786372fbff4eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115921
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-05-21 18:19:58 +02:00
Caolán McNamara eb510f2157 gtk4: reenable button
rename label_line_wrap to label_wrap while I'm at it

Change-Id: I3964c4b40d86fb6ef1fd3733088ffd80e57415ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115714
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-05-17 20:36:25 +02:00
Caolán McNamara 512649f2fb unused include line
Change-Id: I6a41cfa184a653f1b84cf6f33c391ccd531ffc2c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115494
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-05-12 20:46:31 +02:00
Michael Stahl 90b725675c xmlsecurity: avoid exception in DigitalSignaturesDialog::getCertificate()
Fallback to PGP if there's no X509 signing certificate because
CheckX509Data() failed prevents the dialog from popping up.

To avoid confusing the user in this situation, the dialog should
show no certificate, which is already the case.

Change-Id: I7f382165657f50723ac65a60309567e5b6c5ae1b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111664
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2021-03-03 12:47:30 +01:00
Michael Stahl 5af5ea893b xmlsecurity: improve handling of multiple certificates per X509Data
It turns out that an X509Data element can contain an arbitrary number of
each of its child elements.

How exactly certificates of an issuer chain may or should be distributed
across multiple X509Data elements isn't terribly obvious.

One thing that is clear is that any element that refers to or contains
one particular certificate has to be a child of the same X509Data
element, although in no particular order, so try to match the 2 such
elements that the parser supports in XSecController::setX509Data().

Presumably the only way it makes sense to have multiple signing
certificates is if they all contain the same key but are signed by
different CAs. This case isn't handled currently; CheckX509Data() will
complain there's not a single chain and validation of the certificates
will fail.

Change-Id: I9633a980b0c18d58dfce24fc59396a833498a77d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111500
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2021-03-03 12:47:04 +01:00
Michael Stahl 9e82509b09 xmlsecurity: improve handling of multiple X509Data elements
Combine everything related to a certificate in a new struct X509Data.

The CertDigest is not actually written in the X509Data element but in
xades:Cert, so try to find the matching entry in
XSecController::setX509CertDigest().

There was a confusing interaction with PGP signatures, where ouGpgKeyID
was used for import, but export wrote the value from ouCertDigest
instead - this needed fixing.

The main point of this is enforcing a constraint from xmldsig-core 4.5.4:

  All certificates appearing in an X509Data element MUST relate to the
  validation key by either containing it or being part of a certification
  chain that terminates in a certificate containing the validation key.

Change-Id: I5254aa393f8e7172da59709923e4bbcd625ec713
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111254
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2021-03-03 12:46:43 +01:00
Noel Grandin 46c5de8328 make *String(string_view) constructors explicit
to make it more obvious when we are constructing heap OUStrings
code and potentially inadvertently throwing away performance.

And fix a handful of places so revealed.

Change-Id: I0cf390f78026f8a670aaab53424cd31510633051
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107923
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-19 17:53:06 +01:00
Stephan Bergmann 35e471bb4d Adapt the remaining OUString functions to std string_view
...for LIBO_INTERNAL_ONLY.  These had been missed by
1b43cceaea "Make many OUString functions take
std::u16string_view parameters" because they did not match the multi-overload
pattern that was addressed there, but they nevertheless benefit from being
changed just as well (witness e.g. the various resulting changes from copy() to
subView()).

This showed a conversion from OStringChar to std::string_view to be missing
(while the corresponding conversion form OUStringChar to std::u16string_view was
already present).

The improvement to loplugin:stringadd became necessary to fix

> [CPT] compilerplugins/clang/test/stringadd.cxx
> error: 'error' diagnostics expected but not seen:
>   File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 43 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:42): simplify by merging with the preceding assignment [loplugin:stringadd]
>   File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 61 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:60): simplify by merging with the preceding assignment [loplugin:stringadd]
> 2 errors generated.

Change-Id: Ie40de0616a66e60e289c1af0ca60aed6f9ecc279
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107602
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-12-11 21:25:10 +01:00
Noel d7ddc292b9 use proper struct for trusted authors
instead of passing around a Sequence<String>, there is no need
to use UNO types here.

Change-Id: I1b9a1b6919f830d8ce29139b4362b979a669d505
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107396
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-08 11:57:24 +01:00
Noel d6d80c4e17 OSL_FAIL.*exception -> TOOLS_WARN_EXCEPTION
Change-Id: I6800e23ead2767d245d5da71d2d40e0f8a6d7e1f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106859
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-01 09:28:52 +01:00