You are not logged in.
pdftk (version: 3.3.3-3) errors out when trying to add a password to a file. I have tried reinstalling both bcprov and java-commons-lang but I keep getting the same error. I think this might be a dependency issue for this package. Does anybody know how to solve this problem? Should I report it as a bug?
When running this command I get the following error:
> pdftk sample.pdf output sample_w_password.pdf user_pw PROMPT
Please enter the user password to use on the output PDF.
It can be empty, or have a maximum of 32 characters:
EXAMPLE_PASSWORD
Error: could not load a required library for this operation.
java.lang.NoClassDefFoundError: org/bouncycastle/crypto/BlockCipher
Make sure that bcprov and commons-lang3 are installed and included in the
classpath. See also https://gitlab.com/pdftk-java/pdftk/issues/2.
No output created.
Last edited by RLado (2024-08-03 14:58:41)
Offline
Did you make sure bcprov and commons-lang3 are included in the classpath? Did you follow that link?
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I have not, I am not familiar with Java. But I am not building from source, do I have to set a classpath anyway? Shouldn't the package configure that for me?
Offline
I just tried pdftk - I've never used it before but I can confirm the error and can also confirm that the class paths appear to be properly exported in the pdftk script.
So I went looking for the BlockCipher class specifically and found this:
$ ls -l /usr/share/java/bcprov/
total 7472
-rw-r--r-- 1 root root 7647387 Jul 11 07:08 bcprov-jdk18on-17801.jar
lrwxrwxrwx 1 root root 20 Jul 11 07:08 bcprov.jar -> bcprov-jdk18on-*.jar
That bcprov.jar is not only a "broken" link, it's completely invalid and is almost certainly meant to point to the other jar file. I suspect the link name was improperly quoted in a build or install script resulting in the broken link.
I manually fixed the symlink on my system, then retried the pdftk command to add a password to a pdf and it seems to have been successful (no error). So this looks like a bug in bcprov - and I traced it to line 45 of the PKGBUILD. That's not quoting failure, but an improper way to make a symlink as it was not in the proper directory: so the glob didn't match anything and became the literal link target.
You can temporarily fix the link yourself to get your system working properly. But you should probably report this as a bug to get it fixed in the package.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Thank you! Fixing the symlink resolved the issue for me as well. I will now report the bug.
Offline
Hello,
@Trilby: thank you!
Best regards,
Offline