fido2.ctap1
Exceptions
An Exception thrown when a response APDU doesn't have an OK (0x9000) |
Classes
APDU response codes. |
|
Binary response data for a CTAP1 registration. |
|
Binary response data for a CTAP1 authentication. |
|
Implementation of the CTAP1 specification. |
Module Contents
- class fido2.ctap1.APDU[source]
Bases:
enum.IntEnum
APDU response codes.
- OK = 36864
- USE_NOT_SATISFIED = 27013
- WRONG_DATA = 27264
- exception fido2.ctap1.ApduError(code, data=b'')[source]
Bases:
Exception
An Exception thrown when a response APDU doesn’t have an OK (0x9000) status.
- code
- data
- class fido2.ctap1.RegistrationData(_)[source]
Bases:
bytes
Binary response data for a CTAP1 registration.
- Parameters:
_ (bytes) – The binary contents of the response data.
- Variables:
public_key – Binary representation of the credential public key.
key_handle – Binary key handle of the credential.
certificate – Attestation certificate of the authenticator, DER encoded.
signature – Attestation signature.
- verify(app_param, client_param)[source]
Verify the included signature with regard to the given app and client params.
- class fido2.ctap1.SignatureData(_)[source]
Bases:
bytes
Binary response data for a CTAP1 authentication.
- Parameters:
_ (bytes) – The binary contents of the response data.
- Variables:
user_presence – User presence byte.
counter – Signature counter.
signature – Cryptographic signature.
- verify(app_param, client_param, public_key)[source]
Verify the included signature with regard to the given app and client params, using the given public key.
- class fido2.ctap1.Ctap1(device)[source]
Implementation of the CTAP1 specification.
- Parameters:
device (fido2.ctap.CtapDevice) – A CtapHidDevice handle supporting CTAP1.
- class INS[source]
Bases:
enum.IntEnum
Enum where members are also (and must be) ints
- REGISTER = 1
- AUTHENTICATE = 2
- VERSION = 3
- device
- send_apdu(cla=0, ins=0, p1=0, p2=0, data=b'')[source]
Packs and sends an APDU for use in CTAP1 commands. This is a low-level method mainly used internally. Avoid calling it directly if possible, and use the get_version, register, and authenticate methods if possible instead.
- Parameters:
- Returns:
The response APDU data of a successful request.
- Raise:
ApduError
- Return type:
- get_version()[source]
Get the U2F version implemented by the authenticator. The only version specified is “U2F_V2”.
- Returns:
A U2F version string.
- Return type:
- register(client_param, app_param)[source]
Register a new U2F credential.
- Parameters:
- Returns:
The registration response from the authenticator.
- Return type:
- authenticate(client_param, app_param, key_handle, check_only=False)[source]
Authenticate a previously registered credential.
- Parameters:
client_param (bytes) – SHA256 hash of the ClientData used for the request.
app_param (bytes) – SHA256 hash of the app ID used for the request.
key_handle (bytes) – The binary key handle of the credential.
check_only (bool) – True to send a “check-only” request, which is used to determine if a key handle is known.
- Returns:
The authentication response from the authenticator.
- Return type: