HEX
Server: LiteSpeed
System: Linux shams.tasjeel.ae 5.14.0-611.5.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Nov 11 08:09:09 EST 2025 x86_64
User: infowars (1469)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //lib/python3.9/site-packages/yubico/__pycache__/yubikey_frame.cpython-39.opt-1.pyc
a

�w\��@s`dZdgZddlZddlmZddlmZddlmZddlmZdd	lm	Z	Gd
d�d�Z
dS)zB
module for creating frames of data that can be sent to a YubiKey
�YubiKeyFrame�N�)�yubico_util)�yubikey_defs)�yubico_exception)�__version__)�SLOTc@s<eZdZdZddd�Zdd�Zdd�Zdd
d�Zdd
�ZdS)ra
    Class containing an YKFRAME (as defined in ykdef.h).

    A frame is basically 64 bytes of data. When this is to be sent
    to a YubiKey, it is put inside 10 USB HID feature reports. Each
    feature report is 7 bytes of data plus 1 byte of sequencing and
    flags.
    �cCsN|sd}t|�dkrt�d��t|t�s2t�d��||_||_t�|�|_	dS)Ns@�@z!payload must be empty or 64 byteszpayload must be a bytestring)
�lenrZ
InputError�
isinstance�bytes�payload�commandrZcrc16�crc)�selfrr�r�8/usr/lib/python3.9/site-packages/yubico/yubikey_frame.py�__init__!s


zYubiKeyFrame.__init__cCs"d|jj|jjtt|��|jfS)Nz<%s.%s instance at %s: %s>)�	__class__�
__module__�__name__�hex�idr)rrrr�__repr__,s
�zYubiKeyFrame.__repr__cCsd}t�d|j|j|j|�S)z7
        Return the frame as a 70 byte string.
        r	z<64sBH3s)�struct�packrrr)rZfillerrrr�	to_string4s�zYubiKeyFrame.to_stringFcCs�|��}d}g}|r�|dd�|dd�}}|dkrj|rj|dkr�|t�tj|�7}|�|�||��n&|t�tj|�7}|�|�||��|d7}q|S)z^
        Return the frame as an array of 8-byte parts, ready to be sent to a YubiKey.
        rN�sr)rrZchr_byterZSLOT_WRITE_FLAG�append�
_debug_string)r�debug�rest�seq�out�thisrrr�to_feature_reportsFs
zYubiKeyFrame.to_feature_reportscCs8|s|S|jtjtjtjtjtjfv�r0t�|d�dkrB|dfSt�|d�dkr\|dfSt�|d�dkrv|dfSt�|d�dkr�|dfSt�|d�d	kr�|d
fSt�|d�dkr�|dfSt�|d�d
kr�|dfSt�|d�dkr�|dfSt�|d�dk�r|dfSt�|d�dk�r0|dfS|dfS)z;
        Annotate a frames data, if debug is True.
        ����ZFFFFFFF��ZFFUUUUU�ZUKKKKKK�ZKKKKKKK�ZKKKAAAA�ZAAlETCr�ZrCRaaaa�Zaa�z Scr�)	rrZCONFIGZCONFIG2ZUPDATE1ZUPDATE2ZSWAPrZord_byte)rr!�datarrrr ]s<�zYubiKeyFrame._debug_stringN)r	)F)	rr�__qualname__�__doc__rrrr&r rrrrrs	

)r5�__all__rr2rrrZyubico_versionrrrrrrr�<module>s
�