yubikit.core package
Subpackages
- yubikit.core.smartcard package
- Submodules
- yubikit.core.smartcard.scp module
- Module contents
ApduError
ApduFormat
SW
SW.NO_INPUT_DATA
SW.VERIFY_FAIL_NO_RETRY
SW.MEMORY_FAILURE
SW.WRONG_LENGTH
SW.SECURITY_CONDITION_NOT_SATISFIED
SW.AUTH_METHOD_BLOCKED
SW.DATA_INVALID
SW.CONDITIONS_NOT_SATISFIED
SW.COMMAND_NOT_ALLOWED
SW.INCORRECT_PARAMETERS
SW.FUNCTION_NOT_SUPPORTED
SW.FILE_NOT_FOUND
SW.NO_SPACE
SW.REFERENCE_DATA_NOT_FOUND
SW.APPLET_SELECT_FAILED
SW.WRONG_PARAMETERS_P1P2
SW.INVALID_INSTRUCTION
SW.CLASS_NOT_SUPPORTED
SW.COMMAND_ABORTED
SW.OK
AID
Submodules
yubikit.core.fido module
yubikit.core.otp module
- exception yubikit.core.otp.CommandRejectedError[source]
Bases:
CommandError
The issues command was rejected by the YubiKey
- class yubikit.core.otp.OtpConnection[source]
Bases:
Connection
- usb_interface: ClassVar[USB_INTERFACE] = 1
- yubikit.core.otp.modhex_encode(data)[source]
Encode a bytes-like object using Modhex (modified hexadecimal) encoding.
- Return type:
- yubikit.core.otp.modhex_decode(string)[source]
Decode the Modhex (modified hexadecimal) string.
- Return type:
- class yubikit.core.otp.OtpProtocol(otp_connection)[source]
Bases:
object
An implementation of the OTP protocol.
- 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:
- Return type:
- Returns:
Response data (including CRC) in the case of data, or an updated status struct.
Module contents
- class yubikit.core.Version(major: int, minor: int, patch: int)[source]
Bases:
NamedTuple
3-digit version tuple.
- class yubikit.core.TRANSPORT(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]
-
YubiKey physical connection transports.
- USB = 'usb'
- NFC = 'nfc'
- class yubikit.core.USB_INTERFACE(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
IntFlag
YubiKey USB interface identifiers.
- OTP = 1
- FIDO = 2
- CCID = 4
- class yubikit.core.YUBIKEY(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
Enum
YubiKey hardware platforms.
- YKS = 'YubiKey Standard'
- NEO = 'YubiKey NEO'
- SKY = 'Security Key by Yubico'
- YKP = 'YubiKey Plus'
- YK4 = 'YubiKey'
- class yubikit.core.Connection[source]
Bases:
ABC
A connection to a YubiKey
-
usb_interface:
ClassVar
[USB_INTERFACE
] = 0
-
usb_interface:
- class yubikit.core.PID(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
IntEnum
USB Product ID values for YubiKey devices.
- YKS_OTP = 16
- NEO_OTP = 272
- NEO_OTP_CCID = 273
- NEO_CCID = 274
- NEO_FIDO = 275
- NEO_OTP_FIDO = 276
- NEO_FIDO_CCID = 277
- NEO_OTP_FIDO_CCID = 278
- SKY_FIDO = 288
- YK4_OTP = 1025
- YK4_FIDO = 1026
- YK4_OTP_FIDO = 1027
- YK4_CCID = 1028
- YK4_OTP_CCID = 1029
- YK4_FIDO_CCID = 1030
- YK4_OTP_FIDO_CCID = 1031
- YKP_OTP_FIDO = 1040
- property usb_interfaces: USB_INTERFACE
- class yubikit.core.YubiKeyDevice(transport, fingerprint)[source]
Bases:
ABC
YubiKey device reference
- supports_connection(connection_type)[source]
Check if a YubiKeyDevice supports a specific Connection type
- Return type:
- open_connection(connection_type)[source]
Opens a connection to the YubiKey
- Return type:
TypeVar
(T_Connection
, bound=Connection
)
- exception yubikit.core.BadResponseError[source]
Bases:
CommandError
Invalid response data from the YubiKey
- exception yubikit.core.TimeoutError[source]
Bases:
CommandError
An operation timed out waiting for something
- exception yubikit.core.ApplicationNotAvailableError[source]
Bases:
CommandError
The application is either disabled or not supported on this YubiKey
- exception yubikit.core.NotSupportedError[source]
Bases:
ValueError
Attempting an action that is not supported on this YubiKey
- exception yubikit.core.InvalidPinError(attempts_remaining, message=None)[source]
Bases:
CommandError
,ValueError
An incorrect PIN/PUK was used, with the number of attempts now remaining.
WARNING: This exception currently inherits from ValueError for backwards-compatibility reasons. This will no longer be the case with the next major version of the library.
- yubikit.core.require_version(my_version, min_version, message=None)[source]
Ensure a version is at least min_version.