
    hu                        S r SSKrSSKrSSKrSSKJrJrJrJr  SSK	r	Sr
Sr   SS\\\R                  4   S\S\\\4   S	\\\\4      S
\\\\4      S\SS4S jjr SS\\\R                  4   S\S
\\\\4      S\\\4   4S jjrS\\\R                  4   S\\\\   4   4S jrSS\\\R                  4   S\\\4   4S jjr/ SQrg)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.

key_filenamebanner
public_key
secret_keymetadataencodingreturnc           	         [        U[        5      (       a  UR                  U5      n[        U[        5      (       a  UR                  U5      n[        U SSS9 nUR	                  UR                  [        R                  R                  5       5      5        UR	                  S5        U(       a}  UR                  5        Hi  u  px[        U[        5      (       a  UR                  U5      n[        U[        5      (       a  UR                  U5      nUR	                  SU SU S35        Mk     UR	                  S5        UR	                  S	U S
35        U(       a  UR	                  SU S
35        SSS5        g! , (       d  f       g= f)zCreate a certificate filewutf8)r   z	metadata
z    z = 
zcurve
z    public-key = "z"
z    secret-key = "N)	
isinstancebytesdecodeopenwriteformatdatetimenowitems)	r   r   r	   r
   r   r   fkvs	            aC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\zmq/auth/certs.py_write_key_filer      s,    *e$$&&x0
*e$$&&x0
	lC&	1Q	h//33567	 (a''*Aa''*A$qcQCr*+ ) 	
		%j\67GG)*T:;! 
2	1	1s   DE55
Fkey_dirnamec                 D   [         R                  " 5       u  p4[        R                  R	                  X5      nU S3nU S3n[
        R
                  R                  5       n[        U[        R                  U5      U5        [        U[        R                  U5      UUUS9  Xv4$ )z]Create zmq certificates.

Returns the file paths to the public and secret certificate files.
z.key_secretz.key)r
   r   )zmqcurve_keypairospathjoinr   r   r   _cert_public_bannerr   _cert_secret_banner)	r    r!   r   r	   r
   base_filenamesecret_key_filepublic_key_filer   s	            r   create_certificatesr-   =   s     !..0JGGLL/M&{3O&t,O





!CO%8%?%?%DjQ""3' ++    filenamec                 P   SnSn[         R                  R                  U 5      (       d  [        SU  35      e[	        U S5       nU H  nUR                  5       nUR                  S5      (       a  M+  UR                  S5      (       a$  UR                  SS5      S   R                  S5      nUR                  S	5      (       a$  UR                  SS5      S   R                  S5      nU(       d  M  U(       d  M    O   SSS5        Uc  [        S
U  35      eX4$ ! , (       d  f       N"= f)zLoad 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.
NzInvalid certificate file: rb   #s
   public-key   =   s    	'"s
   secret-keyzNo public key found in )	r%   r&   existsOSErrorr   strip
startswithsplit
ValueError)r/   r	   r
   r   lines        r   load_certificater<   Y   s    JJ77>>(##28*=>>	h	D::<Dt$$}--!ZZa0399)D
}--!ZZa0399)D
zjj  
 28*=>>!! 
	s   B'D.D7D
D%	directoryc                     0 n[         R                  R                  U 5      (       d  [        SU  35      e[         R                  R	                  U S5      n[
        R
                  " U5      nU H  n[        U5      u  pVU(       d  M  SX'   M     U$ )z5Load public keys from all certificates in a directoryzInvalid certificate directory: z*.keyT)r%   r&   isdirr6   r'   globr<   )r=   certsglob_string
cert_files	cert_filer	   _s          r   load_certificatesrF   |   sy    E77==##7	{CDD'',,y'2K;'J	(3
: $E   Lr.   )r-   r<   rF   )NNzutf-8)N).)__doc__r   r@   r%   typingr   r   r   r   r#   r)   r(   strPathLiker   r   r-   r<   boolrF   __all__ r.   r   <module>rO      sf   7
   	 / / 
   /3)-<R[[()<< c5j!< sEz*+	<
 tCH~&< < 
<F *.,3#$,
, tCH~&, 38_	,8 "C$% "
5(5/!" "FsBKK'7!8 4tCT   Kr.   