
    Zd&                     V    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dS )z miscellaneous zmq_utils wrapping    )InterruptedSystemCall	_check_rc_check_version   )ffi)libc                     t          dd           t          | t                    r|                     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    6lib/python3.11/site-packages/zmq/backend/cffi/utils.pyhasr      sQ     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      s     6?+++WZ  Fgj!!G	
	VW	-	-BbMMM:fcrc"CJw$7$7$<<<r   c                    t          | t                    r|                     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#   *   s|     '3 )..((6>***WZ  F	
	FG	,	,BbMMM:fcrc""r   c                 R    	  | | }	 t          |           dS # t          $ r Y $w xY w)z/make a call, retrying if interrupted with EINTRTN)r   r   )fargskwargsr!   s       r   _retry_sys_callr)   B   sK    QX	bMMM E % 	 	 	H	s    
&&)r   r   r#   N)__doc__	zmq.errorr   r   r   _cffir   r   r   r   r   r#   r)   __all__ r   r   <module>r/      s    & &
 G F F F F F F F F F            	' 	' 	'= = =$# # #0	 	 	 3
2
2r   