HEX
Server: Apache
System: Linux 185.122.168.184.host.secureserver.net 5.14.0-570.60.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Nov 5 05:00:59 EST 2025 x86_64
User: barbeatleanalyti (1024)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //var/opt/nydus/ops/mysql/connector/plugins/__pycache__/sha256_password.cpython-39.pyc
a

�,�h��@sddZddlmZmZmZddlmZddlmZddlmZerLddl	m
Z
d	ZGd
d	�d	e�ZdS)z&SHA256 Password Authentication Plugin.�)�
TYPE_CHECKING�Any�Optional�)�errors)�logger�)�MySQLAuthPlugin)�MySQLSocket�MySQLSHA256PasswordAuthPluginc@sleZdZdZed�dd�Zeed�dd��Zee	d�dd��Z
eeeed	�d
d�Z
deeed
�dd�ZdS)rz�Class implementing the MySQL SHA256 authentication plugin

    Note that encrypting using RSA is not supported since the Python
    Standard Library does not provide this OpenSSL functionality.
    )�returncCs|j��dS)zyPrepare and return password as as clear text.

        Returns:
            password (bytes): Prepared password.
        �)Z	_password�encode��self�r�Z/opt/nydus/tmp/pip-target-wkfpz8uv/lib64/python/mysql/connector/plugins/sha256_password.py�_prepare_password2sz/MySQLSHA256PasswordAuthPlugin._prepare_passwordcCsdS)zPlugin official name.Zsha256_passwordrrrrr�name:sz"MySQLSHA256PasswordAuthPlugin.namecCsdS)z'Signals whether or not SSL is required.Trrrrr�requires_ssl?sz*MySQLSHA256PasswordAuthPlugin.requires_ssl)�	auth_data�kwargsrcKs&|jr|jst�|j�d���|��S)z�Return the prepared password to send to MySQL.

        Raises:
            InterfaceError: When SSL is required by not enabled.

        Returns:
            str: The prepared password.
        z
 requires SSL)rZssl_enabledr�InterfaceErrorrr)rrrrrr�
auth_responseDs	z+MySQLSHA256PasswordAuthPlugin.auth_responser
)�sockrrrcKs\|j|fi|��}|dur$t�d��t�d|t|��|�|�t|���}t�d|�|S)aSHandles server's `auth switch request` response.

        Args:
            sock: Pointer to the socket connection.
            auth_data: Plugin provided data (extracted from a packet
                       representing an `auth switch request` response).
            kwargs: Custom configuration to be passed to the auth plugin
                    when invoked. The parameters defined here will override the ones
                    defined in the auth plugin itself.

        Returns:
            packet: Last server's response after back-and-forth
                    communication.
        NzGot a NULL auth responsez# request: %s size: %sz# server response packet: %s)	rrrr�debug�len�send�bytes�recv)rrrr�responseZpktrrr�auth_switch_responseQs

z2MySQLSHA256PasswordAuthPlugin.auth_switch_responseN)�__name__�
__module__�__qualname__�__doc__rr�property�strr�boolrrrrr!rrrrr+s�N)
r%�typingrrr�rrr	�networkr
ZAUTHENTICATION_PLUGIN_CLASSrrrrr�<module>s