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_base.cpython-39.pyc
a

�w\��@srdZddlmZddlmZGdd�dej�ZGdd�de�ZGdd	�d	e�ZGd
d�de	�Z
Gdd
�d
e	�ZdS)z!
module for Yubikey base classes
�)�__version__)�yubico_exceptioncs"eZdZdZd�fdd�	Z�ZS)�YubiKeyErrorzu
    Exception raised concerning YubiKey operations.

    Attributes:
        reason -- explanation of the error
    �
no detailscstt|��|�dS�N)�superr�__init__��self�reason��	__class__��7/usr/lib/python3.9/site-packages/yubico/yubikey_base.pyrszYubiKeyError.__init__)r��__name__�
__module__�__qualname__�__doc__r�
__classcell__rrrrr
srcs"eZdZdZd�fdd�	Z�ZS)�YubiKeyTimeoutzz
    Exception raised when a YubiKey operation timed out.

    Attributes:
        reason -- explanation of the error
    rcstt|��|�dSr)rrrr	rrrrszYubiKeyTimeout.__init__)rrrrrrrsrcs"eZdZdZd�fdd�	Z�ZS)�YubiKeyVersionErrorz�
    Exception raised when the YubiKey is not capable of something requested.

    Attributes:
        reason -- explanation of the error
    rcstt|��|�dSr)rrrr	rrrr%szYubiKeyVersionError.__init__)rrrrrrrsrc@s�eZdZdZdZdZdZdZd,dd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd-dd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�ZdS).�YubiKeyCapabilitiesa�
    Class expressing the functionality of a YubiKey.

    This base class should be the superset of all sub-classes.

    In this base class, we lie and say 'yes' to all capabilities.

    If the base class is used (such as when creating a YubiKeyConfig()
    before getting a YubiKey()), errors must be handled at runtime
    (or later, when the user is unable to use the YubiKey).
    ZUnknown)�rrrTNcCsF||_|dur||_|durB||_|\}}}|d>|d>B|B|_dS)N��)�model�default_answer�version�version_num)r
rrr�major�minorZbuildrrrr;s
zYubiKeyCapabilities.__init__cCs$d|jjtt|��|j|j|jfS)Nz/<%s instance at %s: Device %s %s (default: %s)>)r
r�hex�idrrr�r
rrr�__repr__Fs
�zYubiKeyCapabilities.__repr__cCs|jSr�rr$rrr�have_yubico_OTPOsz#YubiKeyCapabilities.have_yubico_OTPcCs|jSrr&�r
�moderrr�	have_OATHRszYubiKeyCapabilities.have_OATHcCs|jSrr&r(rrr�have_challenge_responseUsz+YubiKeyCapabilities.have_challenge_responsecCs|jSrr&r$rrr�have_serial_numberXsz&YubiKeyCapabilities.have_serial_numbercCs|jSrr&�r
�flagrrr�have_ticket_flag[sz$YubiKeyCapabilities.have_ticket_flagcCs|jSrr&r-rrr�have_config_flag^sz$YubiKeyCapabilities.have_config_flagcCs|jSrr&r-rrr�have_extended_flagasz&YubiKeyCapabilities.have_extended_flagcCs|jSrr&r$rrr�have_extended_scan_code_modedsz0YubiKeyCapabilities.have_extended_scan_code_modecCs|jSrr&r$rrr�have_shifted_1_modegsz'YubiKeyCapabilities.have_shifted_1_modercCs|jSrr&)r
�slotrrr�
have_nfc_ndefjsz!YubiKeyCapabilities.have_nfc_ndefcCs|jSrr&r$rrr�have_configuration_slotmsz+YubiKeyCapabilities.have_configuration_slotcCs|jSrr&r$rrr�have_device_configpsz&YubiKeyCapabilities.have_device_configcCs|jSrr&r(rrr�
have_usb_modessz!YubiKeyCapabilities.have_usb_modecCs|jSrr&r$rrr�have_scanmapvsz YubiKeyCapabilities.have_scanmapcCs|jSrr&r$rrr�have_capabilitiesysz%YubiKeyCapabilities.have_capabilitiescCs|jSrr&)r
Z
capabilityrrr�have_capability|sz#YubiKeyCapabilities.have_capability)NNN)r)rrrrrrrrrr%r'r*r+r,r/r0r1r2r3r5r6r7r8r9r:r;rrrrr)s.
	
rc@sNeZdZdZdZdZddd�Zdd�Zddd	�Zddd
�Z	dd�Z
dd�ZdS)�YubiKeyz+
    Base class for accessing YubiKeys
    NcCs&||_|durtdd�|_n||_dS)NFr&)�debugr�capabilities)r
r=r>rrrr�s
zYubiKey.__init__cCsdS)z2 Get the connected YubiKey's version as a string. Nrr$rrrr�szYubiKey.versionTcCsdS)a�
        Get the connected YubiKey's serial number.

        Note that since version 2.?.? this requires the YubiKey to be
        configured with the extended flag SERIAL_API_VISIBLE.

        If the YubiKey is configured with SERIAL_BTN_VISIBLE set to True,
        it will start blinking and require a button press before revealing
        the serial number, with a 15 seconds timeout. Set `may_block'
        to False to abort if this is the case.
        Nr)r
�	may_blockrrr�serial�szYubiKey.serial�HMACrcCsdS)a�
        Get the response to a challenge from a connected YubiKey.

        `mode' is either 'HMAC' or 'OTP'.
        `slot' is 1 or 2.
        `variable' is only relevant for mode == HMAC.

        If variable is True, challenge will be padded such that the
        YubiKey will compute the HMAC as if there were no padding.
        If variable is False, challenge will always be NULL-padded
        to 64 bytes.

        The special case of no input will be HMACed by the YubiKey
        (in variable HMAC mode) as data = 0x00, length = 1.

        In mode 'OTP', the challenge should be exactly 6 bytes. The
        response will be a YubiKey "ticket" with the 6-byte challenge
        in the ticket.uid field. The rest of the "ticket" will contain
        timestamp and counter information, so two identical challenges
        will NOT result in the same responses. The response is
        decryptable using AES ECB if you have access to the AES key
        programmed into the YubiKey.
        Nr)r
�	challenger)r4�variabler?rrrrB�szYubiKey.challengecCsdS)zQ
        Return a YubiKey configuration object for this type of YubiKey.
        Nrr$rrr�init_config�szYubiKey.init_configcCsdS)zC
        Configure a YubiKey using a configuration object.
        Nr)r
Zcfgr4rrr�write_config�szYubiKey.write_config)N)T)rArTT)rrrrr=r>rrr@rBrDrErrrrr<�s


r<N)rZyubico_versionr�rZYubicoErrorrrr�objectrr<rrrr�<module>s

W