The signature is OK, but the certificate could not be validated.

I am able to sign documents with bEID identity card certificate:
and software
Linux eID software installation | eID software

But when viewing the signed document it displays:

"The signature is OK, but the certificate could not be validated."

I tried to resolve this by downloading the belgium rootcertificates from here

and installing them like this

sudo cp Downloads/belgiumrca*.crt /usr/share/ca-certificates/extra
sudo dpkg-reconfigure ca-certificates

And the ca-certificates package shows the new certificates, but even after reboot libreoffice seems unable to use them.

I tried to import them via seahorse, I can see the contents with seahorse but was not able to import the certificates.

Apparantly This has to do with how certificates are used by libreoffice: libreoffice uses the firefox CA store:

  1. First import a certificate in the firefox CA store
    Open Firefox preferences: “about:preferences” → Privacy & Security → Security → Certificates → View Certificates → Import->

    Enable both for “websites” and “mail users”

  2. Then select the correct mozilla CA store in libre-office
    Tools → options → Security -Certificate Path → certificate

Here is more info on that

Here is an alternative method to use chromium or chrome instead of firefox

Another guide that also explains howto export the root CA from the eID card