yubikit.core.otp
Attributes
Exceptions
The issues command was rejected by the YubiKey |
Classes
A connection to a YubiKey |
|
An implementation of the OTP protocol. |
Functions
|
|
|
|
|
Encode a bytes-like object using Modhex (modified hexadecimal) encoding. |
|
Decode the Modhex (modified hexadecimal) string. |
Module Contents
- yubikit.core.otp.MODHEX_ALPHABET = 'cbdefghijklnrtuv'
- exception yubikit.core.otp.CommandRejectedError[source]
Bases:
yubikit.core.CommandError
The issues command was rejected by the YubiKey
- class yubikit.core.otp.OtpConnection[source]
Bases:
yubikit.core.Connection
A connection to a YubiKey
- usb_interface
- yubikit.core.otp.CRC_OK_RESIDUAL = 61624
- yubikit.core.otp.modhex_encode(data)[source]
Encode a bytes-like object using Modhex (modified hexadecimal) encoding.
- yubikit.core.otp.FEATURE_RPT_SIZE = 8
- yubikit.core.otp.FEATURE_RPT_DATA_SIZE = 7
- yubikit.core.otp.SLOT_DATA_SIZE = 64
- yubikit.core.otp.FRAME_SIZE = 70
- yubikit.core.otp.RESP_PENDING_FLAG = 64
- yubikit.core.otp.SLOT_WRITE_FLAG = 128
- yubikit.core.otp.RESP_TIMEOUT_WAIT_FLAG = 32
- yubikit.core.otp.DUMMY_REPORT_WRITE = 143
- yubikit.core.otp.SEQUENCE_MASK = 31
- yubikit.core.otp.STATUS_OFFSET_PROG_SEQ = 4
- yubikit.core.otp.STATUS_OFFSET_TOUCH_LOW = 5
- yubikit.core.otp.CONFIG_STATUS_MASK = 31
- yubikit.core.otp.STATUS_PROCESSING = 1
- yubikit.core.otp.STATUS_UPNEEDED = 2
- class yubikit.core.otp.OtpProtocol(otp_connection)[source]
An implementation of the OTP protocol.
- Parameters:
otp_connection (OtpConnection)
- connection
- version
- send_and_receive(slot, data=None, event=None, on_keepalive=None)[source]
Sends a command to the YubiKey, and reads the response.
If the command results in a configuration update, the programming sequence number is verified and the updated status bytes are returned.
- Parameters:
slot (int) – The slot to send to.
data (Optional[bytes]) – The data payload to send.
state – Optional CommandState for listening for user presence requirement and for cancelling a command.
event (Optional[threading.Event])
on_keepalive (Optional[Callable[[int], None]])
- Returns:
Response data (including CRC) in the case of data, or an updated status struct.
- Return type: