%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/keyring/backends/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/keyring/backends/__pycache__/Windows.cpython-312.pyc

�

�e���L�ddlZddlmZddlmZddlmZddlmZm	Z	e	�5Z
	ddlmZddlm
Z
e
jddd�ej e�ZGd	�d
�ZGd�de�ZGd
�de�Zy#e$rddlZddl
Z
e
jY�VwxYw#1swY�[xYw)�N�)�
properties)�KeyringBackend)�SimpleCredential)�PasswordDeleteError�ExceptionRaisedContext)�
pywintypes)�	win32credc��eZdZdd�Zd�Zy)�PersistenceNc�8�t|dtj�S)N�_persist)�getattrr
�CRED_PERSIST_ENTERPRISE)�self�keyring�types   �:/usr/lib/python3/dist-packages/keyring/backends/Windows.py�__get__zPersistence.__get__s���w�
�I�,M�,M�N�N�c��t|t�r3d|jdd�j�z}t	t
|�}t
|d|�y)z�
        Set the persistence value on the Keyring. Value may be
        one of the win32cred.CRED_PERSIST_* constants or a
        string representing one of those constants. For example,
        'local machine' or 'session'.
        �
CRED_PERSIST_� �_rN)�
isinstance�str�replace�upperrr
�setattr)rr�value�attrs    r�__set__zPersistence.__set__ sD���e�S�!�"�U�]�]�3��%<�%B�%B�%D�D�D��I�t�,�E����U�+r)N)�__name__�
__module__�__qualname__rr"�rrrrs
��O�
,rrc��eZdZed��Zy)�DecodingCredentialc��|d}	|jd�S#t$r+|jd�}tjd�|cYSwxYw)zM
        Attempt to decode the credential blob as UTF-16 then UTF-8.
        �CredentialBlobzutf-16zutf-8zjRetrieved a UTF-8 encoded credential. Please be aware that this library only writes credentials in UTF-16.)�decode�UnicodeDecodeError�log�warning)r�cred�decoded_cred_utf8s   rr zDecodingCredential.value.s[��
�$�%��	%��;�;�x�(�(��!�	%� $���G� 4���K�K�B�
�%�$�
	%�s��1A�AN)r#r$r%�propertyr r&rrr(r(-s��
�
%��
%rr(c��eZdZdZe�Zejdefd��Z	e
d��Zd�Zd�Z
d�Zd�Zd	�Zd
�Zd�Zy)
�WinVaultKeyringaf
    WinVaultKeyring stores encrypted passwords using the Windows Credential
    Manager.

    Requires pywin32

    This backend does some gymnastics to simulate multi-user support,
    which WinVault doesn't support natively. See
    https://github.com/jaraco/keyring/issues/47#issuecomment-75763152
    for details on the implementation, but here's the gist:

    Passwords are stored under the service name unless there is a collision
    (another password with the same service name but different user name),
    in which case the previous password is moved into a compound name:
    {username}@{service}
    �returnc�&�trtd��y)zA
        If available, the preferred backend on Windows.
        zRequires Windows and pywin32�)�missing_deps�RuntimeError)�clss r�priorityzWinVaultKeyring.prioritySs��
��=�>�>�rc��|�d|��S)N�@r&)�username�services  r�_compound_namezWinVaultKeyring._compound_name\s����1�W�I�&�&rc��|j|�}|r|d|k7r!|j|j||��}|sy|jS�N�UserName)�
_get_passwordr?r �rr>r=�ress    r�get_passwordzWinVaultKeyring.get_password`sM��� � ��)���c�*�o��1��$�$�T�%8�%8��7�%K�L�C����y�y�rc���	tjtj|��}t|�S#tj$r)}|j
dk(r|jdk(rYd}~y�d}~wwxYw)N��Type�
TargetName��CredRead)r
rL�CRED_TYPE_GENERICr	�error�winerror�funcnamer()r�targetrE�es    rrCzWinVaultKeyring._get_passwordjsd��	��$�$��0�0�V��C�"�#�&�&��	���	��z�z�T�!�a�j�j�J�&>����	�s�%2�A.�A)�(A)�)A.c���|j|�}|r4|d}|j||�}|j|||j�|j||t	|��yrA)rCr?�
_set_passwordr r)rr>r=�password�existing_pw�existing_usernamerQs       r�set_passwordzWinVaultKeyring.set_passwordush���(�(��1��� +�J� 7���(�(�):�G�D�F�����!��!�!�
�
	
���7�H�c�(�m�<rc��ttj|||d|j��}tj|d�y)NzStored using python-keyring)rIrJrBr*�Comment�Persistr)�dictr
rM�persist�	CredWrite)rrQr=rU�
credentials     rrTzWinVaultKeyring._set_password�s:����,�,���#�1��L�L�

�
�	���J��*rc��|j||�}d}||fD]2}|j|�}|s�|d|k(s� d}|j|��4|st|��y)NFrBT)r?rC�_delete_passwordr)rr>r=�compound�deletedrQrVs       r�delete_passwordzWinVaultKeyring.delete_password�st���&�&�x��9�����x�'�	.�F��,�,�V�4�K��{�:�6�(�B����%�%�f�-�		.�
�%�g�.�.�rc���	tjtj|��y#tj$r)}|j
dk(r|jdk(rYd}~y�d}~wwxYw)NrHrK�
CredDelete)r
rfrMr	rNrOrP)rrQrRs   rraz WinVaultKeyring._delete_password�sP��	�� � �i�&A�&A�f�U�����	��z�z�T�!�a�j�j�L�&@����	�s�%(�A$�A�A�A$c��d}|r!|j|j||��}|s|j|�}|syt|d|j�SrA)rCr?rr rDs    r�get_credentialzWinVaultKeyring.get_credential�sU������$�$�T�%8�%8��7�%K�L�C���$�$�W�-�C�����J�����;�;rN)r#r$r%�__doc__rr]r�
classproperty�floatr:�staticmethodr?rFrCrXrTrdrarhr&rrr3r3?sf���"�m�G����������'��'��	'�=�	+�	/��
<rr3)�logging�_compatr�backendr�credentialsr�errorsrrr7�win32ctypes.pywin32r	r
r#�ImportError�	getLoggerr-rr\r(r3r&rr�<module>rus���� �$�*�@�����
�2�1�	���� �g����!��,�,�"%��%�$k<�n�k<��]����	���
����s(�B�A;�;B�B�B�B�B#

Zerion Mini Shell 1.0