U
    cl                     @   sJ   d Z ddlmZ ddlmZ ddgZdedd	dZG d
d dejZdS )z
Sign PDF files using a Belgian eID card.

This module defines a very thin convenience wrapper around
:mod:`.pyhanko.sign.pkcs11` to set up a PKCS#11 session with an eID card and
read the appropriate certificates on the device.
    )Session   )pkcs11open_beid_session
BEIDSignerN)returnc                 C   s   t j| |ddS )a  
    Open a PKCS#11 session

    :param 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.
    :param slot_no:
        Slot number to use. If not specified, the first slot containing a token
        labelled ``BELPIC`` will be used.
    :return:
        An open PKCS#11 session object.
    ZBELPIC)slot_noZtoken_label)sign_pkcs11Zopen_pkcs11_session)Zlib_locationr    r
   5/tmp/pip-unpacked-wheel-0kb_yl26/pyhanko/sign/beid.pyr      s
      c                       s,   e Zd ZdZdeeed fddZ  ZS )r   a+  
    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.
    FT)pkcs11_sessionuse_auth_cert
bulk_fetchc                    s"   t  j||rdndd||d d S )NZAuthentication	Signature)ZRootCA)r   Z
cert_labelZother_certs_to_pullr   embed_roots)super__init__)selfr   r   r   r   	__class__r
   r   r   /   s    
 zBEIDSigner.__init__)FFT)__name__
__module____qualname____doc__r   boolr   __classcell__r
   r
   r   r   r   &   s       )N)	r   r   r    r	   __all__r   ZPKCS11Signerr   r
   r
   r
   r   <module>   s
   