%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/nacl/bindings/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/nacl/bindings/__pycache__/crypto_kx.cpython-312.pyc

�

�fC�
�h�UddlmZddlmZddlmZmZddlm	Z	gd�Z
	ej�Ze
ed<ej�Ze
ed<ej"�Ze
ed<ej&�Ze
ed	<d
eeeffd�Zded
eeeffd
�Zdededed
eeeffd�Zdededed
eeeffd�Zy)�)�Tuple)�
exceptions)�ffi�lib)�ensure)�crypto_kx_keypair�crypto_kx_client_session_keys�crypto_kx_server_session_keys�crypto_kx_PUBLIC_KEY_BYTES�crypto_kx_SECRET_KEY_BYTES�crypto_kx_SEED_BYTES�crypto_kx_SESSION_KEY_BYTESrrr
r�returnc�H�tjdt�}tjdt�}t	j
||�}t
|dk(dtj��tj|t�ddtj|t�ddfS)z�
    Generate a keypair.
    This is a duplicate crypto_box_keypair, but
    is included for api consistency.
    :return: (public_key, secret_key)
    :rtype: (bytes, bytes)
    �unsigned char[]r�Key generation failed.��raisingN)
r�newrrrrr�exc�CryptoError�buffer)�
public_key�
secret_key�ress   �9/usr/lib/python3/dist-packages/nacl/bindings/crypto_kx.pyrr's������*�,F�G�J����*�,F�G�J�

�
�
�
�J�
7�C�
�3�!�8�-�s���G�	�
�
�:�9�:�1�=��
�
�:�9�:�1�=����seedc���tjdt�}tjdt�}t	t|t�xrt|�tk(djt�tj��tj|||�}t	|dk(dtj��tj|t�ddtj|t�ddfS)ag
    Generate a keypair with a given seed.
    This is functionally the same as crypto_box_seed_keypair, however
    it uses the blake2b hash primitive instead of sha512.
    It is included mainly for api consistency when using crypto_kx.
    :param seed: random seed
    :type seed: bytes
    :return: (public_key, secret_key)
    :rtype: (bytes, bytes)
    rz*Seed must be a {} byte long bytes sequencerrrN)rrrrr�
isinstance�bytes�lenr
�formatr�	TypeErrorr�crypto_kx_seed_keypairrr)rrrrs    rr%r%:s������*�,F�G�J����*�,F�G�J�
��4���E�C��I�1E�$E�4�;�;� �	
��
�
���
$�
$�Z��T�
B�C�
�3�!�8�-�s���G�	�
�
�:�9�:�1�=��
�
�:�9�:�1�=��r�client_public_key�client_secret_key�server_public_keyc�4�tt|t�xrt|�tk(djt�tj��tt|t�xrt|�tk(djt�tj��tt|t�xrt|�tk(djt�tj��tjdt�}tjdt�}tj|||||�}t|dk(dtj��tj|t�ddtj|t�ddfS)	a+
    Generate session keys for the client.
    :param client_public_key:
    :type client_public_key: bytes
    :param client_secret_key:
    :type client_secret_key: bytes
    :param server_public_key:
    :type server_public_key: bytes
    :return: (rx_key, tx_key)
    :rtype: (bytes, bytes)
    �8Client public key must be a {} bytes long bytes sequencerz8Client secret key must be a {} bytes long bytes sequence�8Server public key must be a {} bytes long bytes sequencerrz%Client session key generation failed.N)rr r!r"rr#rr$rrrrrr	rr)r&r'r(�rx_key�tx_keyrs      rr	r	W�a�� ��$�e�,�	A��!�"�&@�@�B�I�I�&�	
��
�
�
���$�e�,�	A��!�"�&@�@�B�I�I�&�	
��
�
�
���$�e�,�	A��!�"�&@�@�B�I�I�&�	
��
�
�
��W�W�&�(C�
D�F�
�W�W�&�(C�
D�F�

�
+�
+���)�+<�>O��C���q��/�����	�
�
�6�6�7��:��
�
�6�6�7��:��r�server_secret_keyc�4�tt|t�xrt|�tk(djt�tj��tt|t�xrt|�tk(djt�tj��tt|t�xrt|�tk(djt�tj��tjdt�}tjdt�}tj|||||�}t|dk(dtj��tj|t�ddtj|t�ddfS)	a+
    Generate session keys for the server.
    :param server_public_key:
    :type server_public_key: bytes
    :param server_secret_key:
    :type server_secret_key: bytes
    :param client_public_key:
    :type client_public_key: bytes
    :return: (rx_key, tx_key)
    :rtype: (bytes, bytes)
    r+rz8Server secret key must be a {} bytes long bytes sequencer*rrz%Server session key generation failed.N)rr r!r"rr#rr$rrrrrr
rr)r(r/r&r,r-rs      rr
r
�r.rN)�typingr�naclrr�nacl._sodiumrr�nacl.exceptionsr�__all__�crypto_kx_publickeybytesr�int�__annotations__�crypto_kx_secretkeybytesr�crypto_kx_seedbytesr
�crypto_kx_sessionkeybytesrr!rr%r	r
�rr�<module>r=s���"�!�"����#?�#�">�">�"@��C�@�">�#�">�">�"@��C�@�3�C�3�3�5��c�5�#@�3�#@�#@�#B��S�B��5����.��&���5����+>��:7��7��7��7��5�%�<��	7�t7��7��7��7��5�%�<��	7r

Zerion Mini Shell 1.0