Server IP : 192.158.238.246 / Your IP : 3.23.59.187 Web Server : LiteSpeed System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64 User : jenniferflocom ( 1321) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /opt/alt/python37/lib/python3.7/site-packages/asn1crypto/__pycache__/ |
Upload File : |
B �rV� � @ s� d Z ddlmZmZmZmZ ddlZddlZddlZddl m Z ddlmZm Z mZ ejdk rlddlmZ ndd lmZ d d� Zddd �Zdd� Zddd�ZdS )zq Encoding DER to PEM and decoding PEM to DER. Exports the following items: - armor() - detect() - unarmor() � )�unicode_literals�division�absolute_import�print_functionN� )�unwrap)� type_name�str_cls�byte_cls)� )�StringIO)�BytesIOc C s8 t | t�sttdt| ����| �d�dkp6| �d�dkS )z� Detect if a byte string seems to contain a PEM-encoded block :param byte_string: A byte string to look through :return: A boolean, indicating if a PEM-encoded block is contained in the byte string zC byte_string must be a byte string, not %s s -----BEGIN���s ---- BEGIN)� isinstancer � TypeErrorr r �find)Zbyte_string� r �?/opt/alt/python37/lib/python3.7/site-packages/asn1crypto/pem.py�detect s r c C s4 t |t�sttd| |� ���t | t�s:ttd| | ����| �� �d�} t� }|�d� |�| � |�d� |r�xD|D ]<}|�|�d�� |�d� |�|| �d�� |�d� qvW |�d� t � |�}t|�}d}x6||k �r|�|||d � � |�d� |d 7 }q�W |�d � |�| � |�d� |�� S )a Armors a DER-encoded byte string in PEM :param der_bytes: A byte string to be armored :param type_name: A unicode string that will be capitalized and placed in the header and footer of the block. E.g. "CERTIFICATE", "PRIVATE KEY", etc. This will appear as "-----BEGIN CERTIFICATE-----" and "-----END CERTIFICATE-----". :param headers: An OrderedDict of the header lines to write after the BEGIN line :return: A byte string of the PEM block zA der_bytes must be a byte string, not %s zD type_name must be a unicode string, not %s �asciis -----BEGIN s ----- s : � r �@ s -----END ) r r r r r �upper�encoder �write�base64� b64encode�len�getvalue)r � der_bytes�headers�output�keyZ b64_bytesZb64_len�ir r r �armor2 s<