U
    <gC                     @   s   d dl mZ d dlmZmZ d dlmZ d dlmZ d dl	m
Z
 ddgZedd	G d
d dejZedd	G dd dejZdS )    )	dataclass)ListOptional)x509)api)load_certs_from_pemderPKCS12SignatureConfigPemDerSignatureConfigT)frozenc                       sl   e Zd ZU dZeed< dZeee	j
  ed< dZee ed< dZeed< dZeed	< e fd
dZ  ZS )r   zf
    Configuration for a signature using key material on disk, contained
    in a PKCS#12 bundle.
    Zpfx_fileNother_certspfx_passphraseTprompt_passphraseF
prefer_pssc                    st   t  | |dd}t|tr(|f}tt||d< z"|d }|d k	rX|d|d< W n tk
rn   Y nX d S )Nr    r   utf8	superprocess_entriesget
isinstancestrlistr   encodeKeyErrorclsZconfig_dictr   
passphrase	__class__r   =/tmp/pip-unpacked-wheel-w101_d3s/pyhanko/config/local_keys.pyr   ,   s    
z%PKCS12SignatureConfig.process_entries)__name__
__module____qualname____doc__r   __annotations__r   r   r   r   Certificater   bytesr   boolr   classmethodr   __classcell__r   r   r   r   r      s   
c                       st   e Zd ZU dZeed< eed< dZeee	j
  ed< dZee ed< dZeed< d	Zeed
< e fddZ  ZS )r	   zV
    Configuration for a signature using PEM or DER-encoded key material on disk.
    key_file	cert_fileNr   key_passphraseTr   Fr   c                    st   t  | |dd}t|tr(|f}tt||d< z"|d }|d k	rX|d|d< W n tk
rn   Y nX d S )Nr   r   r,   r   r   r   r   r   r   r   \   s    
z%PemDerSignatureConfig.process_entries)r    r!   r"   r#   r   r$   r   r   r   r   r%   r,   r&   r   r'   r   r(   r   r)   r   r   r   r   r	   =   s   
N)dataclassesr   typingr   r   Z
asn1cryptor   Zpyhanko.configr   Zpyhanko.keysr   __all__ZConfigurableMixinr   r	   r   r   r   r   <module>   s   -