pyhanko.sign.beid module

Sign PDF files using a Belgian eID card.

This module defines a very thin convenience wrapper around pyhanko.sign.pkcs11 to set up a PKCS#11 session with an eID card and read the appropriate certificates on the device.

pyhanko.sign.beid.open_beid_session(lib_location, slot_no=None) Session

Open a PKCS#11 session

Parameters
  • lib_location – Path to the shared library file containing the eID PKCS#11 module. Usually, the file is named libbeidpkcs11.so, libbeidpkcs11.dylib or beidpkcs11.dll, depending on your operating system.

  • slot_no – Slot number to use. If not specified, the first slot containing a token labelled BELPIC will be used.

Returns

An open PKCS#11 session object.

class pyhanko.sign.beid.BEIDSigner(pkcs11_session: Session, use_auth_cert: bool = False, bulk_fetch: bool = False, embed_roots=True)

Bases: PKCS11Signer

Belgian eID-specific signer implementation that automatically populates the (trustless) certificate list with the relevant certificates stored on the card. This includes the government’s (self-signed) root certificate and the certificate of the appropriate intermediate CA.