Giter Club home page Giter Club logo

simple-signer's Introduction

Simple Signer

Simple Signer allows you to sign PDF files using a simple GUI.

Screenshot

But why?

On current Ubuntu versions, it is not possible to import personal certificates into the certificate management application called "Seahorse" (see here). This prevents LibreOffice from signing PDF documents. That's why I created this workaround.

As additional features, Simple Signer allows you to certify documents (which, in contrast to signing, locks the document so no further signature is allowed) and draw stamps corresponding to your signature as known from the Adobe Reader.

Installation

Debian Package

You can download and install the .deb package from the latest release on GitHub.

Note: if you are on Debian 12, install python3-oscrypto via apt before installing the Simple Signer Debian package (the PIP oscrypto version is buggy).

Manual Installation

# install system-wide dependencies from Debian/Ubuntu repos
apt install python3-pip python3-pyqt5 python3-pil python3-venv swig

# if you are on Debian 12, install this too
apt install python3-oscrypto

# create a new Python venv dir
python3 -m venv --system-site-packages venv

# install it with requirements which are not available in Debian/Ubuntu repos in the venv
venv/bin/pip3 install .

# start manually
venv/bin/simple-signer

# install launcher shortcut
cp assets/simple-signer.desktop /usr/local/share/applications
sudo update-desktop-database

Dark Mode

Qt applications automatically adopt the system theme on Linux Mint (Cinnamon desktop) due to the preinstalled qt5-gtk2-platformtheme. For plain Ubuntu/Debian using the Gnome desktop, you need to install this package and set the environment variable QT_QPA_PLATFORMTHEME=gtk2 before starting the app. Alternatively, you can use the package qgnomeplatform-qt5 with the environment variable QT_QPA_PLATFORMTHEME=gnome (only on newer Ubuntu versions).

Usage

  • Start the script and choose PDF and cert file using the buttons in the GUI.

or

  • Right-click on a PDF file in your file manager -> "Open With" -> "Simple Signer".

then

  • Enter the path to your certificate file and your certificate's passphrase, then click:
    • Sign: allows multiple users to place their signature
    • Certify: places your signature and locks the document - after that, no further signature can be added
    • Draw Stamp: you can optionally place a visual stamp on the document which is linked to your signature

Stamp Manifest File

Simple Signer allows to load a stamp configuration file (extension .stampinfo with JSON content), which contains the position and size of the stamp to draw. This feature is intended for visually impaired people who cannot draw the stamp rect themselves. Another person can create this stamp configuration file in advance, so they can sign documents of a certain type with without further help. The resulting stamp config is shown on the command line when drawing the stamp rect manually. This config can then simply be copied into a .stampinfo file for further use.

Example .stampinfo file:

{"rect":[216.84396666666666, 273.77105369127514, 319.76990476190474, 312.738466442953], "page":0}

Advanced Usage / Signature Customization

You can add the following (additional) settings to the config file ~/.config/Simple-Signer/settings.ini:

[settings]
cert-path = /path/to/my/cert.p12
stamp-path = 
draw-stamp = 1

signature-contact = Schorschii
signature-location = Sieber Systems HQ
signature-reason = Weil's geht!
stamp-background = 255,255,255
stamp-outline = 255,0,0
stamp-border = 2
stamp-labels = CN,DN,date,contact,reason,location

Development

I18n

# 1. create translation files from code
pylupdate5 simple-signer.py -ts lang/de.ts

# 2. use Qt Linguist to translate the file

# 3.a. compile translation files for usage
lrelease lang/*.ts
# 3.b. or use make to compile all
make

Compiling (on Windows)

Create a venv as described in "Manual Installation", install Simple Signer and PyInstaller into the venv, then you can build the executable.

python3 -m venv venv
venv\Scripts\pip install . pyinstaller
venv\Scripts\pyinstaller.exe simple-signer.windows.spec

simple-signer's People

Contributors

henning-gerhardt avatar schorschii avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

simple-signer's Issues

Cannot sign with P256 self-signed key

I generated a nist p256 key and self signed certificate using openssl, however I cannot use it in simple signer due to error at the last step:

<class 'TypeError'>: _EllipticCurvePrivateKey.sign() takes 3 positional arguments but 4 were given

Using python 3.10, Linux Mint 21 based on Ubuntu 22.04

The same certificate can be used in Thunderbird or Firefox NSS and then used in LibreOffice to sign ODT or PDF exported from Libreoffice.

When I created a certificate based on RSA2048 using Actalis it is able to perform the signing without error.

Environment problems with Debian Trixie and endesive

When trying to install on Debian Trixie there is a problem with the new way the pip packages are handled.
To my understanding system wide installation with pip is not possible anymore.

Way to reproduce:

  1. download the .deb
  2. install sudo apt-get install ./Downloads/simple-signer.deb
  3. run simple-signer

Output

$ sudo apt-get install ./Downloads/simple-signer.deb 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'simple-signer' instead of './Downloads/simple-signer1.deb'
The following package was automatically installed and is no longer required:
  libnfs13
Use 'sudo apt autoremove' to remove it.
The following NEW packages will be installed:
  simple-signer
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 0 B/8.236 B of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 /home/ba4my2/Downloads/simple-signer1.deb simple-signer all 1.5.0-2 [8.236 B]
Selecting previously unselected package simple-signer.
(Reading database ... 656287 files and directories currently installed.)
Preparing to unpack .../Downloads/simple-signer1.deb ...
Unpacking simple-signer (1.5.0-2) ...
Setting up simple-signer (1.5.0-2) ...
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.
    
    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.
    
    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.
    
    See /usr/share/doc/python3.11/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
dpkg: error processing package simple-signer (--configure):
 installed simple-signer package post-installation script subprocess returned error exit status 1
Processing triggers for desktop-file-utils (0.26-1) ...
Processing triggers for mailcap (3.70+nmu1) ...
Errors were encountered while processing:
 simple-signer
E: Sub-process /usr/bin/dpkg returned an error code (1)

So right now Simple signer is installed but can't run missing endesive.

$ simple-signer 
Traceback (most recent call last):
  File "/usr/bin/simple-signer", line 15, in <module>
    from endesive.pdf import cms
ModuleNotFoundError: No module named 'endesive'

Certification fails

If do certification insted of the sign. cert check fails, because the date was written when date was parsed, and the write file date is written later in the system, which lead that file was rewritten after certification

Certificate Validation Check possible?

Dear developers,

would it be possible to implement a validation check of the certificate which is used for signing?

Thanks for your attention,
Ciao
Veit

Mass certifying

Discussed in #16

Originally posted by SirLouen April 19, 2024
If thinking about a new feature, mass certifying would be very great. Asking for a folder, the certificate file and password, and running for each PDF file in the directory, the same process as it's currently doing for just one file.

In windows doesnt draw stamps

If I use draw stamps it doesnt fails in [AttributeError: module 'PIL.ImageQt' has no attribute 'ImageQt']
Inside python it can use it

Trying to compile with Windows, but fails

I'm trying to compile following the README notes that say:

pyinstaller.exe -F --noconsole simple-signer.py --add-data="lang/de.qm;lang" --add-data="C:\Users\vm2\AppData\Roaming\Python\Python38\site-packages\endesive\pdf\PyPDF2_annotate\fonts\Helvetica.ttf;endesive/pdf/PyPDF2_annotate/fonts"
  1. First, I've supposed that simply-signer.py has to be switched by setup.py. If I run the command with simple-signer.py both in the root folder or inside the simple-signer folder, it returns a not found error
  2. I have installed via pip the libraries endesive and PyMuPDF and PyQt5
  3. I also changed de.qm to de.ts because there is no de.qm file there.

So with these, I have run the compiler and these are the results.

pyinstaller.exe -F --noconsole setup.py --add-data="lang/de.ts;lang" --add-data="C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\endesive\pdf\PyPDF2_annotate\fonts\Helvetica.ttf;endesive/pdf/PyPDF2_annotate/fonts"
213 INFO: PyInstaller: 6.3.0
213 INFO: Python: 3.11.7
219 INFO: Platform: Windows-10-10.0.22631-SP0
219 INFO: wrote C:\Users\user\Simple-Signer\setup.spec
221 INFO: Extending PYTHONPATH with paths
['C:\\Users\\user\\Desarrollo\\Learning\\Simple-Signer']
384 INFO: Appending 'datas' from .spec
384 INFO: checking Analysis
385 INFO: Building Analysis because Analysis-00.toc is non existent
385 INFO: Initializing module dependency graph...
386 INFO: Caching module graph hooks...
404 INFO: Analyzing base_library.zip ...
1320 INFO: Loading module hook 'hook-encodings.py' from 'C:\\Users\\user\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\PyInstaller\\hooks'...
2151 INFO: Loading module hook 'hook-pickle.py' from 'C:\\Users\\user\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\PyInstaller\\hooks'...
2828 INFO: Loading module hook 'hook-heapq.py' from 'C:\\Users\\user\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\PyInstaller\\hooks'...
3049 INFO: Caching module dependency graph...
3103 INFO: Running Analysis Analysis-00.toc
3103 INFO: Looking for Python shared library...
3103 INFO: Using Python shared library: C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2032.0_x64__qbz5n2kfra8p0\python311.dll
3103 INFO: Analyzing C:\Users\user\Simple-Signer\setup.py
3104 INFO: Processing pre-safe import module hook distutils from 'C:\\Users\\user\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module\\hook-distutils.py'.
3108 INFO: Processing pre-find module path hook distutils from 'C:\\Users\\user\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
3467 INFO: Loading module hook 'hook-distutils.py' from 'C:\\Users\\user\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\PyInstaller\\hooks'...
3507 INFO: Loading module hook 'hook-distutils.util.py' from 'C:\\Users\\user\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\PyInstaller\\hooks'...
3542 INFO: Loading module hook 'hook-sysconfig.py' from 'C:\\Users\\user\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\PyInstaller\\hooks'...
3656 INFO: Loading module hook 'hook-setuptools.py' from 'C:\\Users\\user\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\PyInstaller\\hooks'...
4870 INFO: Loading module hook 'hook-pkg_resources.py' from 'C:\\Users\\user\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\PyInstaller\\hooks'...
5620 INFO: Loading module hook 'hook-platform.py' from 'C:\\Users\\user\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\PyInstaller\\hooks'...
5653 INFO: Loading module hook 'hook-xml.py' from 'C:\\Users\\user\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\PyInstaller\\hooks'...
5765 INFO: Loading module hook 'hook-packaging.py' from 'C:\\Users\\user\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\PyInstaller\\hooks'...
6241 INFO: Processing module hooks...
6250 INFO: Processing pre-safe import module hook win32com from 'C:\\Users\\user\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\pre_safe_import_module\\hook-win32com.py'.
6835 INFO: Loading module hook 'hook-multiprocessing.util.py' from 'C:\\Users\\user\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\PyInstaller\\hooks'...
7024 INFO: Loading module hook 'hook-setuptools.msvc.py' from 'C:\\Users\\user\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\PyInstaller\\hooks'...
7381 INFO: Loading module hook 'hook-difflib.py' from 'C:\\Users\\user\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\PyInstaller\\hooks'...
7742 INFO: Loading module hook 'hook-setuptools._distutils.command.check.py' from 'C:\\Users\\user\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\PyInstaller\\hooks'...
7928 INFO: Performing binary vs. data reclassification (4 entries)
7933 INFO: Looking for ctypes DLLs
7968 INFO: Analyzing run-time hooks ...
7971 INFO: Including run-time hook 'C:\\Users\\user\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_inspect.py'
7976 INFO: Including run-time hook 'C:\\Users\\user\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_setuptools.py'
7981 INFO: Including run-time hook 'C:\\Users\\user\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_pkgutil.py'
7986 INFO: Processing pre-find module path hook _pyi_rth_utils from 'C:\\Users\\user\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-_pyi_rth_utils.py'.
7993 INFO: Loading module hook 'hook-_pyi_rth_utils.py' from 'C:\\Users\\user\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\PyInstaller\\hooks'...
7995 INFO: Including run-time hook 'C:\\Users\\user\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_multiprocessing.py'
8000 INFO: Including run-time hook 'C:\\Users\\user\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_pkgres.py'
8010 INFO: Looking for dynamic libraries
8274 INFO: Extra DLL search directories (AddDllDirectory): []
8274 INFO: Extra DLL search directories (PATH): []
8371 INFO: Warnings written to C:\Users\user\Simple-Signer\build\setup\warn-setup.txt
8401 INFO: Graph cross-reference written to C:\Users\user\Simple-Signer\build\setup\xref-setup.html
8434 INFO: checking PYZ
8434 INFO: Building PYZ because PYZ-00.toc is non existent
8434 INFO: Building PYZ (ZlibArchive) C:\Users\user\Simple-Signer\build\setup\PYZ-00.pyz
8900 INFO: Building PYZ (ZlibArchive) C:\Users\user\Simple-Signer\build\setup\PYZ-00.pyz completed successfully.
8907 INFO: checking PKG
8907 INFO: Building PKG because PKG-00.toc is non existent
8907 INFO: Building PKG (CArchive) setup.pkg
10267 INFO: Building PKG (CArchive) setup.pkg completed successfully.
10268 INFO: Bootloader C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\PyInstaller\bootloader\Windows-64bit-intel\runw.exe
10268 INFO: checking EXE
10269 INFO: Building EXE because EXE-00.toc is non existent
10269 INFO: Building EXE from EXE-00.toc
10269 INFO: Copying bootloader EXE to C:\Users\user\Simple-Signer\dist\setup.exe
10272 INFO: Copying icon to EXE
10275 INFO: Copying 0 resources to EXE
10275 INFO: Embedding manifest in EXE
10278 INFO: Appending PKG archive to EXE
10284 INFO: Fixing EXE headers
10345 INFO: Building EXE from EXE-00.toc completed successfully.

Then I run /dist/setup.exe

And here is the result:

Rv7q03p 1

What I could be missing?

Arch Package (AUR)

Hi,

First of all I have to thank you for the great application!
It does exactly what it is supposed to do.

Are there any plans to maintain an AUR package for Arch-based Linux distributions?

I think this would make it easier for more people to use the application.

Thanks in advance and best regards!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.