HEX
Server: LiteSpeed
System: Linux srv146.niagahoster.com 4.18.0-553.30.1.lve.el8.x86_64 #1 SMP Tue Dec 3 01:21:19 UTC 2024 x86_64
User: kodi1989 (1633)
PHP: 8.1.34
Disabled: symlink,shell_exec,exec,popen,system,dl,passthru,escapeshellarg,escapeshellcmd,show_source,pcntl_exec
Upload Files
File: //opt/alt/python37/lib/python3.7/site-packages/rsa/__pycache__/pem.cpython-37.pyc
B

��f�@s~dZddlZddlZejeefZeejeefd�dd�Zeeeej	ed�dd�Z
eeed	�d
d�Zeeed	�dd
�ZdS)z0Functions that load and write PEM-encoded files.�N)�
pem_marker�returncCs,t|t�s|�d�}d|dd|dfS)z:
    Returns the start and end PEM markers, as bytes.
    �asciis-----BEGIN s-----s	-----END )�
isinstance�bytes�encode)r�r�8/opt/alt/python37/lib/python3.7/site-packages/rsa/pem.py�_markerss


r
)�contents�	pem_start�pem_endrccs�d}d}xh|��D]\}|��}|s$q||krF|r<td|��d}d}q|sLq|r^||kr^d}Pd|krhq|VqW|s�td|��|r�td|��dS)z7Generator over PEM lines between pem_start and pem_end.FzSeen start marker "%r" twiceT�:zNo PEM start marker "%r" foundzNo PEM end marker "%r" foundN)�
splitlines�strip�
ValueError)rrr
Zin_pem_partZseen_pem_start�linerrr	�
_pem_lines&s0
r)rrrcCsJt|t�s|�d�}t|�\}}dd�t|||�D�}d�|�}t�|�S)a�Loads a PEM file.

    :param contents: the contents of the file to interpret
    :param pem_marker: the marker of the PEM content, such as 'RSA PRIVATE KEY'
        when your file has '-----BEGIN RSA PRIVATE KEY-----' and
        '-----END RSA PRIVATE KEY-----' markers.

    :return: the base64-decoded content between the start and end markers.

    @raise ValueError: when the content is invalid, for example when the start
        marker cannot be found.

    rcSsg|]}|�qSrr)�.0rrrr	�
<listcomp>gszload_pem.<locals>.<listcomp>�)rrrr
r�join�base64�standard_b64decode)rrrr
�	pem_linesZpemrrr	�load_pemSs


rcCsvt|�\}}t�|��dd�}|g}x2tdt|�d�D]}|||d�}|�|�q6W|�|�|�d�d�|�S)ajSaves a PEM file.

    :param contents: the contents to encode in PEM format
    :param pem_marker: the marker of the PEM content, such as 'RSA PRIVATE KEY'
        when your file has '-----BEGIN RSA PRIVATE KEY-----' and
        '-----END RSA PRIVATE KEY-----' markers.

    :return: the base64-encoded content between the start and end markers, as bytes.

    �
rr�@)r
r�standard_b64encode�replace�range�len�appendr)rrrr
Zb64rZblock_start�blockrrr	�save_pemns

r$)
�__doc__r�typing�Union�strrZ	FlexiText�Tupler
�Iteratorrrr$rrrr	�<module>s-