HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //proc/self/root/lib/python3.6/site-packages/yubico/__pycache__/yubikey_frame.cpython-36.opt-1.pyc
3

y@�V��@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.
    �cCsR|sdd}t|�dkr"tjd��t|t�s6tjd��||_||_tj|�|_	dS)N��@z!payload must be empty or 64 byteszpayload must be a bytestring)
�lenrZ
InputError�
isinstance�bytes�payload�commandrZcrc16�crc)�selfrr�r�#/usr/lib/python3.6/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}tjd|j|j|j|�S)z7
        Return the frame as a 70 byte string.
        r	z<64sBH3s)�struct�packrrr)rZfillerrrr�	to_string4szYubiKeyFrame.to_stringFcCs�|j�}d}g}x�|r�|dd�|dd�}}|dkrl|rl|dkr�|tjtj|�7}|j|j||��n&|tjtj|�7}|j|j||��|d7}qW|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_reportscCs:|s|S|jtjtjtjtjtjgk�r2tj|d�dkrB|dfStj|d�dkr\|dfStj|d�dkrv|dfStj|d�dkr�|dfStj|d�d	kr�|d
fStj|d�dkr�|dfStj|d�d
kr�|dfStj|d�dk�r�|dfStj|d�dk�r|dfStj|d�dk�r2|dfS|dfS) z;
        Annotate a frames data, if debug is True.
        r�ZFFFFFFF��ZFFUUUUU�ZUKKKKKK�ZKKKKKKK�ZKKKAAAA�ZAAlETCr�ZrCRaaaa�Zaa�z Scr����r3r3r3r3r3r3r3r3r3)	rrZCONFIGZCONFIG2ZUPDATE1ZUPDATE2ZSWAPrZord_byte)rr"�datarrrr!]s:zYubiKeyFrame._debug_stringN)r	)F)	rr�__qualname__�__doc__rrrr'r!rrrrrs

)r6�__all__rr2rrrZyubico_versionrrrrrrr�<module>s