
    f&                     T    d Z ddlmZmZmZ ddlmZ ddlmZ d Z	d Z
d Zd	 Zg d
Zy)z miscellaneous zmq_utils wrapping    )InterruptedSystemCall	_check_rc_check_version   )ffi)libc                     t        dd       t        | t              r| j                  d      } t	        t        j                  |             S )zxCheck for zmq capability by name (e.g. 'ipc', 'curve')

    .. versionadded:: libzmq-4.1
    .. versionadded:: 14.1
    )   r   zzmq.hasutf8)r   
isinstancestrencodeboolCzmq_has)
capabilitys    Q/var/www/cvtools/html/venv/lib/python3.12/site-packages/zmq/backend/cffi/utils.pyhasr      s<     69%*c"&&v.
		*%&&    c                     t        dd       t        j                  d      } t        j                  d      }t        j                  | |      }t        |       t        j                  |       dd t        j                  |      dd fS )u  generate a Z85 key pair for use with zmq.CURVE security

    Requires libzmq (≥ 4.0) to have been built with CURVE support.

    Returns
    -------
    (public, secret) : two bytestrings
        The public and private key pair as 40 byte z85-encoded bytestrings.
    )      curve_keypairchar[64]N(   )r   r   newr   zmq_curve_keypairr   buffer)publicprivatercs      r   r   r      sn     6?+WWZ Fggj!G	
		VW	-BbM::fcr"CJJw$7$<<<r   c                     t        | t              r| j                  d      } t        dd       t	        j
                  d      }t        j                  ||       }t        |       t	        j                  |      dd S )un  Compute the public key corresponding to a private key for use
    with zmq.CURVE security

    Requires libzmq (≥ 4.2) to have been built with CURVE support.

    Parameters
    ----------
    private
        The private key as a 40 byte z85-encoded bytestring
    Returns
    -------
    bytestring
        The public key as a 40 byte z85-encoded bytestring.
    r   )r
   r   curve_publicr   Nr   )
r   r   r   r   r   r   r   zmq_curve_publicr   r   )r    r   r!   s      r   r#   r#   *   sc     '3..(6>*WWZ F	
		FG	,BbM::fcr""r   c                 F    	  | | }	 t        |       y# t        $ r Y w xY w)z/make a call, retrying if interrupted with EINTRN)r   r   )fargskwargsr!   s       r   _retry_sys_callr)   B   s3    
X	bM  % 		s    	  )r   r   r#   N)__doc__	zmq.errorr   r   r   _cffir   r   r   r   r   r#   r)   __all__ r   r   <module>r/      s2    &
 G F  	'=$#0	 3r   