o
    .j%                     @  s   U d dl mZ d dlZd dlZd dlmZ d dlmZ dZde	d< da
de	d	< g d
Zde	d< ddgZde	d< h dZde	d< dddZefdddZdS )    )annotationsN)Path)PEM_cert_to_DER_certiint#STALE_TRUST_STORE_THRESHOLD_SECONDSzfloat | None_LAST_NEWEST_MTIME)z/var/sslz/usr/share/sslz/usr/local/sslz/usr/local/opensslz/usr/local/etc/opensslz/usr/local/share/certsz/usr/lib/sslz/usr/sslz/etc/opensslz/etc/pki/ca-trust/extracted/pemz/etc/pki/tlsz/etc/sslz
/etc/certsz/opt/etc/sslz/system/etc/security/cacertsz/boot/system/data/sslz	list[str]BUNDLE_TRUST_STORE_DIRECTORIESpemcrtKNOWN_TRUST_STORE_EXTENSIONS>   ocspemailtrustobjsigncodesign	timestamp	untrustedzset[str]BANNED_KEYWORD_NOT_TLSreturnlist[bytes]c                    s  g } d}t  }tD ]}tj|sq	t|dD ]̉ z  s"W q j	d
 }|tvr6| du r6W qt fddtD rCW qz  }W n
 tyS   Y W qw |j|jf}|jdkrj||v reW q|| |j|krr|j}t dd	}| }W d    n1 sw   Y  | sW qd
|vrdnd}	d|	 }
||
D ]5}|r|d|	 }|dkr n%d||d  |
g}zt|}W n	 ty   Y qw || vr| | qW q ttfy   Y qw q	|dkr|a| S d a| S )Ng        *.Fc                 3  s     | ]}|t   v V  qd S )N)strlower).0kwfilepath G/home/thesage/.local/lib/python3.10/site-packages/wassima/_os/_linux.py	<genexpr>M   s    z(root_der_certificates.<locals>.<genexpr>r   zutf-8)encodingz-----END CERTIFICATE-----

z
z-----END CERTIFICATE-----z-----BEGIN CERTIFICATE----- ) setr   ospathexistsr   rglobis_filesuffixlstripr   r   isdigitanyr   statOSErrorst_devst_inoaddst_mtimeopenreadstripsplitfindjoinr   
ValueErrorappendUnicodeDecodeErrorr   )certificatesnewest_mtimeseen_inodes	directory	extensionst	inode_keyfbundleline_endingboundarychunkstart_markerpem_reconstructedder_certificater   r   r   root_der_certificates3   sp   




<rM   threshold_secondsboolc                 C  s   t du rdS t t  | kS )a/  Return True if the system trust store has not been updated for longer than
    ``threshold_seconds``.

    The decision relies on the most recent modification time observed during
    the last call to :func:`root_der_certificates`. If no modification time has
    been collected yet, returns False.
    NF)r   time)rN   r   r   r   is_trust_store_stale   s   rQ   )r   r   )rN   r   r   rO   )
__future__r   r&   rP   pathlibr   sslr   r   __annotations__r   r   r   r   rM   rQ   r   r   r   r   <module>   s    
Q