Digitally Sign with a USB Token

A USB Token or Smart Card holds a digital certificate issued by a certification authority. With it, a signer embeds a legally verifiable signature into a PDF directly from Viindoo, while the certificate and the PIN never leave the signer’s computer.

This article will provide you with guidance on the following subjects:

  • Preparing the signer’s computer;

  • Installing Viindoo Sign Client;

  • Signing with the Windows certificate store or a PKCS#11 library;

  • Customizing the signature appearance;

  • Solving common errors.

Requirements

This tutorial requires the installation of the following applications/modules:

How signing with a USB Token works

Signing happens on the signer’s computer. The browser cannot talk to a USB Token by itself, so a small desktop application, Viindoo Sign Client, runs on the signer’s computer and connects the Sign app to the token. When the signer presses Sign, Viindoo Sign Client reads the certificate from the token, signs the PDF locally, and sends the signed file back to Viindoo.

The signer’s computer needs:

  • A valid USB Token or Smart Card, plugged in when signing;

  • The token driver and management software from the token provider;

  • Viindoo Sign Client, running whenever the signer signs;

  • A web browser logged in to Viindoo, with a user that has access to the Sign app.

Viindoo Sign Client runs on Windows, macOS and Linux.

Installing Viindoo Sign Client

Install Viindoo Sign Client once on each signer’s computer. Download the latest release from the Viindoo Sign Client repository, in its Releases section, and extract the ZIP file into a permanent folder.

On Windows

The installation needs administrator rights on the computer.

  1. Install Python 3.10 for Windows, 64-bit, from python.org. During the installation, check Add Python to PATH.

  2. Install Microsoft C++ Build Tools from the Visual Studio downloads page, with the Desktop development with C++ workload, the MSVC v143 - VS 2022 C++ x64/x86 build tools component and the latest Windows 11 SDK.

  3. Open the install_script folder of the extracted release and run windows.bat.

  4. Start Viindoo Sign Client from its desktop shortcut or the Start menu.

On macOS and Linux

Open the install_script folder of the extracted release and run bash macos.sh on macOS, or bash linux.sh on Ubuntu and Debian. Then start Viindoo Sign Client from the Applications folder or the applications menu.

Viindoo Sign Client listens on port 8169 of the signer’s own computer. If a firewall or antivirus blocks it, allow the application.

Setting up the signing method

The Sign app ships with the USB Token/Local Certificates signing method, so there is usually nothing to set up. To check it, navigate to Sign > Settings > Signing Methods and make sure the method is in the list. If it is not, search the archived methods and restore it.

On macOS and Linux, Viindoo Sign Client needs the location of the token’s PKCS#11 library, a file installed by the token driver. Administrators manage the shared library paths in Sign > Settings > PKCS11 Path. Signers can also add their own path while signing, see Signing with a PKCS#11 library.

Signing a document with a USB Token

Before signing, plug in the token and start Viindoo Sign Client.

  1. Upload the PDF and place the signature field as described in Sign Documents and Set Up Signing Methods.

  2. In the Edit Signature Field dialog, set Signature Type to Digital Signature and Signing Method to USB Token/Local Certificates.

  3. Press Sign now.

Edit Signature Field dialog with Digital Signature and the USB Token/Local Certificates signing method

The Digital Sign dialog opens. Its Signing Method list depends on the operating system:

  • Windows: USB Token/Smart Card (Windows Certificate Store) and USB Token/Smart Card (PKCS#11 path);

  • macOS and Linux: USB Token/Smart Card (PKCS#11 path).

If the dialog shows a warning asking you to install and open Viindoo Sign Client, start the application, close the dialog and sign again.

Digital Sign dialog with the Viindoo Sign Client warning, the PKCS#11 signing method and the library path list

Signing with the Windows certificate store

  1. Select USB Token/Smart Card (Windows Certificate Store).

  2. The dialog lists the certificates available on the computer, with their name and owner details. Select your certificate. An expired certificate is greyed out with the date it expired.

  3. Adjust the signature appearance if needed, see Customizing the signature appearance.

  4. Press Sign.

  5. If the token software asks for the token PIN, enter it.

If the list shows “No Windows certificates found.” although the token is plugged in, unplug and plug the token again, wait until the token software detects it, then reopen the dialog. If your certificate still does not appear, sign with the PKCS#11 library instead.

Signing with a PKCS#11 library

  1. Select USB Token/Smart Card (PKCS#11 path).

  2. Under “Select a PKCS#11 library to sign”, select the library path of your token. If it is missing, press Add new path, enter a Name and the Path to the PKCS#11 library file installed by your token driver, then press Create. A path you add is visible only to you.

  3. Press Sign.

  4. The certificate dialog shows the Token Info (label, model and serial number) and the certificates stored on the token. Select your certificate.

  5. Enter the token PIN in Enter PIN:.

  6. Press Sign.

Warning

Enter the PIN carefully. When the token has one attempt left, the dialog shows a red warning. Entering a wrong PIN at that point locks the token, and only the token provider can unlock it.

When signing finishes, the dialog closes and the signature appears on the page. Keep Viindoo Sign Client running and the token plugged in until then: closing Viindoo Sign Client closes the signing dialog, and you have to sign again.

Customizing the signature appearance

The lower part of the Digital Sign dialog sets how the signature looks on the page, with a live Preview:

  • Signature Type: Image and text, Image or Text;

  • Upload Image: An image of your handwritten signature or stamp shown in the field;

  • Border: A frame around the signature field;

  • Timestamp Server: Certifies the signing time with the timestamp server in Timestamp Server URL, filled in from the Sign settings.

The text part shows “Signed by” with the name on the selected certificate, and “Signed on” with the signing time. This appearance is only visual: the legal value lies in the digital signature embedded in the file.

Signature appearance options with Signature Type, Upload Image, Border, Timestamp Server and the Preview

Solving common errors

  • You need to install and open Viindoo Sign Client: Viindoo Sign Client is not installed or not running. Start it, then reopen the signing dialog;

  • The minimum version requirement of Viindoo Sign Client is …: The installed Viindoo Sign Client is too old. Install the latest release;

  • No Windows certificates found.: The token is not plugged in, or Windows does not list its certificate. Plug the token in again, or sign with the PKCS#11 library;

  • No PKCS#11 Path found, please add a new path.: No library path exists yet. Press Add new path;

  • Please select a certificate first.: Select a certificate before pressing Sign;

  • Please select a PKCS#11 path first.: Select a library path before pressing Sign;

  • This token has been locked, please contact the token service provider.: The PIN was entered wrongly too many times. Contact your token provider;

  • Invalid signature data uploaded.: The file returned by Viindoo Sign Client does not contain the expected signature. Reload the page and sign again. If it happens again, send the data_dir/log.txt log file of Viindoo Sign Client to your support team.