Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signing not possible due to error #4127

Closed
asta-tud-deploy opened this issue Dec 12, 2024 · 13 comments
Closed

Signing not possible due to error #4127

asta-tud-deploy opened this issue Dec 12, 2024 · 13 comments
Labels
feature-request New feature request

Comments

@asta-tud-deploy
Copy link

Is your feature request related to a problem? Please describe.
Same bug as in #3949 but without previous editing

Describe the solution you'd like
A working signing process

System information
Nextcloud 30.0.2
Debian 12 (6.1.0-28-amd64)
Nginx 1.22.1-9
PHP8.3 (Version: 8.3.14-3+freexian12.1+php+1, installed packages: php8.3-apcu, php8.3-bcmath, php8.3-bz2, php8.3-cli, php8.3-common, php8.3-curl, php8.3-fpm, php8.3-gd, php8.3-gmp, php8.3-igbinary, php8.3-imagick, php8.3-intl, php8.3-ldap, php8.3-mbstring, php8.3-mysql, php8.3-opcache, php8.3-phpdbg, php8.3-readline, php8.3-redis, php8.3-xml, php8.3-zip)

libresign:configure:check:


Status Resource Message Tip


success java Java version: openjdk version "21.0.2" 2024-01-16 LTS
success java Java binary: /vault/nextcloud//appdata_oc09wtjyjb8y/libresign/x86_64/linux/java/jdk-21.0.2+13-jre/bin/java
success pdftk PDFtk version: 3.3.3
success pdftk PDFtk path: /vault/nextcloud//appdata_oc09wtjyjb8y/libresign/x86_64/pdftk/pdftk.jar
success jsignpdf JSignPdf version: 2.2.2
success jsignpdf JSignPdf path: /vault/nextcloud//appdata_oc09wtjyjb8y/libresign/x86_64/jsignpdf/jsignpdf-2.2.2/JSignPdf.jar
success openssl-configure Root certificate setup is working fine.


Tested with Firefox 128.4.0esr and Chromium 130.0.6723.116

Additional context
As mentioned i get basically the same error as in bug #3949 but without editing the file.

After uploading or requesting a signing (either way) i am able to start the signing process but without a signature field.
I can see the files being created correctly in the /tmp folder. The files are even signed correctly and the link to the check is working, but the signed file is never returned to nextcloud and deleted from the folder afterwards.
The signing process is also never marked as finished (which makes sense)

@asta-tud-deploy asta-tud-deploy added the feature-request New feature request label Dec 12, 2024
@github-project-automation github-project-automation bot moved this to 0. Needs triage in Roadmap Dec 12, 2024
@asta-tud-deploy
Copy link
Author

asta-tud-deploy commented Dec 12, 2024

Unbenannt.webm

Here is a video to make it more understandable

@vitormattos
Copy link
Member

Could you check the logs of Nextcloud to idnetify if have any entry about LibreSign when you do the action that throw the issue?

@vitormattos
Copy link
Member

vitormattos commented Dec 12, 2024

Run a command like this:

tail -f data/nextcloud.log|grep libresign

And then, do the flow to sign the document to check if will put an entry of LibreSign

@asta-tud-deploy
Copy link
Author

asta-tud-deploy commented Dec 12, 2024

Thy for the quick reply.

Sorry, forgot to mention this.

Error seems to be the same as in mentioned bug.
This is the full log from clicking on signing until getting the error
signing.log

Also this time a file SignatureTest.signiert.pdf showed up in the folder of the original file. But the error persists.
These are original and signed file:
SignatureTest.pdf
SignatureTest.signiert.pdf

@vitormattos
Copy link
Member

Thanks! I will check the logs and verify if I can reproduce.

@vitormattos
Copy link
Member

vitormattos commented Dec 12, 2024

I think that I identified what's happening.

Only the last 3 rows is related to LibreSign. The most rows are internal warnings of Nextcloud not related to LibreSign, this big log quantity occurr because you put your log level to 0, don't worry, is good do this when we are debbuging an app.

Looking the last 3 rows I found this:

[
	"FEIN Default property file doesn't exists.",
	"FEIN Default property file doesn't exists.",
	"INFORMATION \\u00dcberpr\\u00fcfe PDF-Eingabe- und Ausgabepfade.",
	"INFORMATION Hole Schl\\u00fcssel Alias",
	"INFORMATION Verwendet Schl\\u00fcssel: stephan $USERNAME ($USERNAME@$DOMAIN.TLD)",
	"INFORMATION Lade privaten Schl\\u00fcssel",
	"INFORMATION Hole Zertifikatskette",
	"INFORMATION \\u00d6ffne PDF Eingabedatei: \\/tmp\\/12c1b215078f7282fc9895320260a528.pdf",
	"INFORMATION Erzeuge PDF Ausgabedatei: \\/tmp\\/12c1b215078f7282fc9895320260a528_signed.pdf",
	"INFORMATION Erzeuge Signatur",
	"INFORMATION Setze Zertifizierungsstufe",
	"INFORMATION Bearbeite (es kann ein wenig l\\u00e4nger dauern) ...",
	"INFORMATION Schlie\\u00dfe erzeugten PDF Stream",
	"INFORMATION Fertig: Signatur erfolgreich erzeugt."
]

And all message is in German. This is log messages from JSignPDF and looking the package that do the integration between JSignPDF and PHP, I found this:

            $messageSuccess = "Finished: Signature succesfully created.";
            $isSigned       = strpos($out, $messageSuccess) !== false;

            $this->throwIf(!$isSigned, "Error to sign PDF. $out");

https://github.com/JSignPdf/jsignpdf-php/blob/v1.2.5/src/Sign/JSignService.php#L30-L33

I'm checking how to solve this and don't return a false error message.

Thanks a lot by your contribution.

@asta-tud-deploy
Copy link
Author

yeah, i turned debugging on since i was debugging ;)
oh wow, it literally checks for the success string. Well sure that does not work with internationalization :D

Thanks for the quick responses and hopefully the fix :)

@vitormattos
Copy link
Member

I think that I found the solution...

I need to run:

java -Duser.language=en

I made a test here using de and returned the output in German.

@vitormattos
Copy link
Member

We don't need that JSignPDF works into a different language.

@vitormattos
Copy link
Member

Only to certify that my idea to fix will work fine... Could you change the follow file?

File: libresign/vendor/jsignpdf/jsignpdf-php/src/Sign/JSignService.php

At row 130 you will found:

return "$java -jar $jSignPdf $pdf -ksf $certificate -ksp {$password} {$params->getJSignParameters()} -d {$params->getPathPdfSigned()} 2>&1";

Change to:

return "$java -Duser.language=en -jar $jSignPdf $pdf -ksf $certificate -ksp {$password} {$params->getJSignParameters()} -d {$params->getPathPdfSigned()} 2>&1";

And then, check if will solve the issue.

@asta-tud-deploy
Copy link
Author

This solved it, thank you

@github-project-automation github-project-automation bot moved this from 0. Needs triage to 4. to release in Roadmap Dec 12, 2024
@vitormattos
Copy link
Member

I will go ahead and the fix will come at next release.

@vitormattos
Copy link
Member

If you like this project and want to help more, contact us by sponsor page or send us a recurrent sponsoring.
The funding is very important to keep alive this project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature request
Projects
Status: 4. to release
Development

No branches or pull requests

2 participants