Cannot decrypt PDF with passwords containing special characters [åäö!"§$%&]
Summary
Evince v3.28.4 and apparently also Okular does not open AES-256 encrypted PDF with password containing characters [åäö!"§$%&].
Description
Evince Document Viewer v3.28.4 (standard on Ubuntu 18.04LTS) and apparently also Okular, both apparently using libpoppler
, does not open AES-256 encrypted PDF with password containing characters [åäö!"§$%&]. Firefox (and Foxit Reader) does open it. See this and this post about the issues that have been found. Suggestion was made to file the bug here.
Here is an output of what versions of libpoppler
and cups-pdf
are on the Ubuntu 18.04.3 LTS (latest) currently.
$ apt list --installed | grep poppler
libpoppler-glib8/bionic-updates,bionic-security,now 0.62.0-2ubuntu2.10 amd64
libpoppler73/bionic-updates,bionic-security,now 0.62.0-2ubuntu2.10 amd64
poppler-data/bionic,bionic,now 0.4.8-2 all
poppler-utils/bionic-updates,bionic-security,now 0.62.0-2ubuntu2.10 amd64
$ apt list --installed | grep cups-pdf
printer-driver-cups-pdf/bionic,now 3.0.1-5 amd64
Package info printer-driver-cups-pdf 3.0.1-5
Test script [test_case_01.sh] provided here to reproduce the issue:
#!/bin/bash
# test_case_01.sh
#
# Tested on GNU bash v4.4.20 on Ubuntu 18.04LTS.
# May also work on other linux releases.
# Script requires: qpdf poppler-utils printer-driver-cups-pdf cups-filters
# If not present, install it:
# sudo apt-get install qpdf poppler-utils printer-driver-cups-pdf cups-filters
# Generate a random text like lorem ipsum.
# Put the contents in a text file.
cd /tmp # directory where the three files will be created
filenametxt="foo.txt"
tr -dc a-z1-4 </dev/urandom | tr 1-2 ' \n' | awk 'length==0 || length>50' | tr 3-4 ' ' | sed 's/^ *//' | cat -s | sed 's/ / /g' | fmt | head -30 > $filenametxt
# Create a PDF file from the text file:
filenamepdf=$(basename -s .txt $filenametxt).pdf
cupsfilter -e $filenametxt > $filenamepdf
# Encrypt the PDF file and change the extension to [*_encrypted.pdf] :
userpassvar="ä" # "åäö"
ownerpassvar="å" # "åäö"
encryptedfilenamepdf=$(basename -s .txt $filenametxt)_encrypted.pdf
qpdf --encrypt $userpassvar $ownerpassvar 256 --use-aes=y -- $filenamepdf $encryptedfilenamepdf
# Show the info of the encrypted PDF:
pdfinfo -upw $userpassvar -opw $ownerpassvar $encryptedfilenamepdf
# Open the encrypted PDF with Evince and Firefox with the user/owner password.
evince $encryptedfilenamepdf &
firefox $encryptedfilenamepdf &
exit 0
Result
Evince v3.28.4 does not accept any of the passwords containing [åäö!"§$%&].
Firefox (and Foxit Reader) accepts both passwords containing [åäö!"§$%&].