Ë
    aß-h´  ã                   ój   — d Z ddlmZmZmZ ddlmZ ddlmZ ddlmZ erddl	m
Z
 d	Z G d
„ d	e«      Zy)z&SHA256 Password Authentication Plugin.é    )ÚTYPE_CHECKINGÚAnyÚOptionalé   )Úerrors)Úloggeré   )ÚMySQLAuthPlugin)ÚMySQLSocketÚMySQLSHA256PasswordAuthPluginc                   óz   — e Zd ZdZdefd„Zedefd„«       Zede	fd„«       Z
dededee   fd„Zd	d
dededefd„Zy)r   zÆ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.
    Úreturnc                 ó<   — | j                   j                  «       dz   S )zyPrepare and return password as as clear text.

        Returns:
            password (bytes): Prepared password.
        ó    )Ú	_passwordÚencode©Úselfs    úm/var/www/core.comfia.cic-ware.com/crm/lib/python3.12/site-packages/mysql/connector/plugins/sha256_password.pyÚ_prepare_passwordz/MySQLSHA256PasswordAuthPlugin._prepare_password2   s   € ð ~‰~×$Ñ$Ó&¨Ñ0Ð0ó    c                  ó   — y)zPlugin official name.Úsha256_password© r   s    r   Únamez"MySQLSHA256PasswordAuthPlugin.name:   s   € ð !r   c                  ó   — y)z'Signals whether or not SSL is required.Tr   r   s    r   Úrequires_sslz*MySQLSHA256PasswordAuthPlugin.requires_ssl?   s   € ð r   Ú	auth_dataÚkwargsc                 ó–   — | j                   r.| j                  s"t        j                  | j                  › d«      ‚| j                  «       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)r   Ússl_enabledr   ÚInterfaceErrorr   r   )r   r   r   s      r   Úauth_responsez+MySQLSHA256PasswordAuthPlugin.auth_responseD   s@   € ð ×Ò T×%5Ò%5Ü×'Ñ'¨4¯9©9¨+°]Ð(CÓDÐDØ×%Ñ%Ó'Ð'r   Úsockr   c                 ó  —  | j                   |fi |¤Ž}|€t        j                  d«      ‚t        j                  d|t        |«      «       |j                  |«       t        |j                  «       «      }t        j                  d|«       |S )aS  Handles 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.
        zGot a NULL auth responsez# request: %s size: %sz# server response packet: %s)	r#   r   r"   r   ÚdebugÚlenÚsendÚbytesÚrecv)r   r$   r   r   ÚresponseÚpkts         r   Úauth_switch_responsez2MySQLSHA256PasswordAuthPlugin.auth_switch_responseQ   sx   € ð" &4×%Ñ% iÑ:°6Ñ:ˆØÐÜ×'Ñ'Ð(BÓCÐCä‰Ð-¨x¼¸X»ÔGØ	‰	(ÔäD—I‘I“KÓ ˆÜ‰Ð3°SÔ9àˆ
r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r)   r   ÚpropertyÚstrr   Úboolr   r   r   r#   r-   r   r   r   r   r   +   sŒ   „ ñð1 5ó 1ð ð!cò !ó ð!ð ð˜dò ó ðð( uð (¸ð (ÀÈÁó (ðØ!ðØ.3ðØ?Bðà	ôr   N)r1   Útypingr   r   r   Ú r   r   r
   Únetworkr   ÚAUTHENTICATION_PLUGIN_CLASSr   r   r   r   ú<module>r9      s3   ðñ: -ç /Ñ /å Ý Ý áÝ%à=Ð ôA Oõ Ar   