HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/zmq/auth/__pycache__/certs.cpython-310.pyc
o

�N�g��@s2dZddlZddlZddlZddlmZmZmZmZddl	Z	dZ
dZ			ddeeej
fded	eeefd
eeeefdeeeefded
dfdd�Z	ddeeej
fdedeeeefd
eeeffdd�Zdeeej
fd
eeeeffdd�Zddeeej
fd
eeeffdd�Zgd�ZdS)z10MQ authentication related functions and classes.�N)�Dict�Optional�Tuple�Unionz�#   ****  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-8�key_filename�banner�
public_key�
secret_key�metadata�encoding�returnc		Cst|t�r
|�|�}t|t�r|�|�}t|ddd��e}|�|�tj����|�d�|rW|��D]$\}}t|t�r@|�|�}t|t�rJ|�|�}|�d|�d|�d��q2|�d�|�d	|�d
��|rx|�d|�d
��Wd�dSWd�dS1s�wYdS)
zCreate a certificate file�w�utf8)rz	metadata
z    z = �
zcurve
z    public-key = "z"
z    secret-key = "N)	�
isinstance�bytes�decode�open�write�format�datetime�now�items)	rrr	r
rr�f�k�v�r�B/opt/saltstack/salt/lib/python3.10/site-packages/zmq/auth/certs.py�_write_key_files*
	








�"�r�key_dir�namec	Csjt��\}}tj�||�}|�d�}|�d�}tj��}t|t�	|�|�t|t
�	|�|||d�||fS)zeCreate zmq certificates.

    Returns the file paths to the public and secret certificate files.
    z.key_secretz.key)r
r)�zmqZ
curve_keypair�os�path�joinrrr�_cert_public_bannerr�_cert_secret_banner)	r r!rr	r
�
base_filenameZsecret_key_fileZpublic_key_filerrrr�create_certificates>s	


�r)�filenamecCs�d}d}tj�|�std|����t|d��=}|D]2}|��}|�d�r%q|�d�r5|�dd�d�d�}|�d	�rE|�dd�d�d�}|rK|rKnqWd�n1sVwY|duretd
|��||fS)aLoad 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: �rb�#s
public-key�=�s 	'"s
secret-keyzNo public key found in %s)	r#r$�exists�OSErrorr�strip�
startswith�split�
ValueError)r*r	r
r�linerrr�load_certificateZs(


��r6�.�	directorycCs\i}tj�|�std|����tj�|d�}t�|�}|D]}t|�\}}|r+d||<q|S)z5Load public keys from all certificates in a directoryzInvalid certificate directory: z*.keyT)r#r$�isdirr0r%�globr6)r8�certsZglob_stringZ
cert_files�	cert_filer	�_rrr�load_certificates}s
�r>)r)r6r>)NNr)N)r7)�__doc__rr:r#�typingrrrrr"r'r&�str�PathLikerrr)r6�boolr>�__all__rrrr�<module>sV
���
����
�#����

��
�&#