HEX
Server: Apache
System: Linux srv1.prosuiteplus.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: prosuiteplus (1001)
PHP: 8.3.20
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/rsa/__pycache__/pem.cpython-38.pyc
U

	+�[�
�@s8dZddlZddlmZmZdd�Zdd�Zdd	�ZdS)
z0Functions that load and write PEM-encoded files.�N)�is_bytes�rangecCs*t|�s|�d�}d|dd|dfS)z:
    Returns the start and end PEM markers, as bytes.
    �asciis-----BEGIN s-----s	-----END )r�encode)�
pem_marker�r�)/usr/lib/python3/dist-packages/rsa/pem.py�_markerss



�r	cCs�t|�s|�d�}t|�\}}g}d}|��D]^}|��}|s@q.||kr^|rXtd|��d}q.|sdq.|rx||krxd}q�d|kr�q.|�|�q.|s�td|��|r�td|��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.

    rFzSeen start marker "%s" twiceT�:zNo PEM start marker "%s" foundzNo PEM end marker "%s" found�)
rrr	�
splitlines�strip�
ValueError�append�join�base64Zstandard_b64decode)�contentsr�	pem_start�pem_end�	pem_linesZin_pem_part�lineZpemrrr�load_pem$s8

rcCsrt|�\}}t�|��dd�}|g}tdt|�d�D]}|||d�}|�|�q4|�|�|�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	rZstandard_b64encode�replacer�lenrr)rrrrZb64rZblock_start�blockrrr�save_pemfs

r)�__doc__rZrsa._compatrrr	rrrrrr�<module>s
B