Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/zmq/auth/__pycache__/certs.cpython-39.pyc
Ðазад
a a�hS � @ s� d Z ddlZddlZddlZddlZddlZddlmZmZm Z m Z e d�Ze d�Zddd�Z dd d �Zdd� Zddd�Zg d�ZdS )z10MQ authentication related functions and classes.� N)�bytes�unicode�b�uz�# **** Generated on {0} by pyzmq **** # ZeroMQ CURVE **Secret** Certificate # DO NOT PROVIDE THIS FILE TO OTHER USERS nor change its permissions. a # **** Generated on {0} by pyzmq **** # ZeroMQ CURVE Public Certificate # Exchange securely, or use a secure mechanism to verify the contents # of this file after exchange. Store public certificates in your home # directory, in the .curve subdirectory. �utf-8c C s t |t�r|�|�}t |t�r(|�|�}tj| ddd���}|�|�tj�� �� |�t d�� |r�|� � D ]F\}}t |t�r�|�|�}t |t�r�|�|�}|�t d��||�� qj|�t d�� |�t d��|�� |r�|�t d��|�� W d � n1 �s0 Y d S ) zCreate a certificate file�w�utf8)�encodingz metadata z {0} = {1} zcurve z public-key = "{0}" z secret-key = "{0}" N)� isinstancer �decode�io�open�write�format�datetime�nowr �items) Zkey_filenameZbanner� public_key� secret_key�metadatar �f�k�v� r �~/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/zmq/auth/certs.py�_write_key_file s$ r c C sj t �� \}}tj�| |�}d�|�}d�|�}tj�� }t|t �|�|� t|t �|�|||d� ||fS )ziCreate zmq certificates. Returns the file paths to the public and secret certificate files. z{0}.key_secretz{0}.key)r r )�zmqZ curve_keypair�os�path�joinr r r r �_cert_public_banner�_cert_secret_banner) Zkey_dir�namer r r � base_filenameZsecret_key_fileZpublic_key_filer r r r �create_certificates6 s ��r$ c C s� d}d}t j�| �s"td�| ���t| d��z}|D ]d}|�� }|�d�rJq2|�d�rj|�dd�d �d�}|�d �r�|�dd�d �d�}|r2|r2 q�q2W d � n1 s�0 Y |du r�t d | ��||fS )a Load public and secret key from a zmq certificate. Returns (public_key, secret_key) If the certificate file only contains the public key, secret_key will be None. If there is no public key found in the file, ValueError will be raised. NzInvalid certificate file: {0}�rb� #s public-key� =� s '"s secret-keyzNo public key found in %s) r r �exists�IOErrorr r �strip� startswith�split� ValueError)�filenamer r r �liner r r �load_certificateN s$ $r1 �.c C s\ i }t j�| �std�| ���t j�| d�}t�|�}|D ]}t|�\}}|r:d||<