HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberPanel/lib64/python3.10/site-packages/rsa/__pycache__/pem.cpython-310.pyc
o

��h��	@s�dZddlZddlZejeefZdedejeeffdd�Zdeded	edej	efd
d�Z
dededefdd
�Zdededefdd�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�=/usr/local/CyberPanel/lib/python3.10/site-packages/rsa/pem.py�_markerss




�r
�contents�	pem_start�pem_endccs��d}d}|��D]/}|��}|sq	||kr#|rtd|��d}d}q	|s&q	|r0||kr0d}n	d|vr5q	|Vq	|sAtd|��|rItd|��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
�in_pem_part�seen_pem_start�linerrr	�
_pem_lines&s4��rcCsJt|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_lines�pemrrr	�load_pemSs



rcCsrt|�\}}t�|��dd�}|g}tdt|�d�D]}|||d�}|�|�q|�|�|�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
�b64r�block_start�blockrrr	�save_pemns


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