yubikit.hsmauth
Attributes
Classes
Algorithms for YubiHSM Auth credentials. |
|
A YubiHSM Auth credential object. |
|
YubiHSM Session Keys. |
|
A session with the YubiHSM Auth application. |
Module Contents
- yubikit.hsmauth.TAG_LABEL = 113
- yubikit.hsmauth.TAG_LABEL_LIST = 114
- yubikit.hsmauth.TAG_CREDENTIAL_PASSWORD = 115
- yubikit.hsmauth.TAG_ALGORITHM = 116
- yubikit.hsmauth.TAG_KEY_ENC = 117
- yubikit.hsmauth.TAG_KEY_MAC = 118
- yubikit.hsmauth.TAG_CONTEXT = 119
- yubikit.hsmauth.TAG_RESPONSE = 120
- yubikit.hsmauth.TAG_VERSION = 121
- yubikit.hsmauth.TAG_TOUCH = 122
- yubikit.hsmauth.TAG_MANAGEMENT_KEY = 123
- yubikit.hsmauth.TAG_PUBLIC_KEY = 124
- yubikit.hsmauth.TAG_PRIVATE_KEY = 125
- yubikit.hsmauth.INS_PUT = 1
- yubikit.hsmauth.INS_DELETE = 2
- yubikit.hsmauth.INS_CALCULATE = 3
- yubikit.hsmauth.INS_GET_CHALLENGE = 4
- yubikit.hsmauth.INS_LIST = 5
- yubikit.hsmauth.INS_RESET = 6
- yubikit.hsmauth.INS_GET_VERSION = 7
- yubikit.hsmauth.INS_PUT_MANAGEMENT_KEY = 8
- yubikit.hsmauth.INS_GET_MANAGEMENT_KEY_RETRIES = 9
- yubikit.hsmauth.INS_GET_PUBLIC_KEY = 10
- yubikit.hsmauth.MANAGEMENT_KEY_LEN = 16
- yubikit.hsmauth.CREDENTIAL_PASSWORD_LEN = 16
- yubikit.hsmauth.MIN_LABEL_LEN = 1
- yubikit.hsmauth.MAX_LABEL_LEN = 64
- yubikit.hsmauth.DEFAULT_MANAGEMENT_KEY = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
- yubikit.hsmauth.INITIAL_RETRY_COUNTER = 8
- class yubikit.hsmauth.ALGORITHM[source]
Bases:
enum.IntEnum
Algorithms for YubiHSM Auth credentials.
- AES128_YUBICO_AUTHENTICATION = 38
- EC_P256_YUBICO_AUTHENTICATION = 39
- property pubkey_len
- class yubikit.hsmauth.SessionKeys[source]
Bases:
NamedTuple
YubiHSM Session Keys.
- class yubikit.hsmauth.HsmAuthSession(connection, scp_key_params=None)[source]
A session with the YubiHSM Auth application.
- Parameters:
connection (yubikit.core.smartcard.SmartCardConnection)
scp_key_params (Optional[yubikit.core.smartcard.ScpKeyParams])
- protocol
- property version: yubikit.core.Version
The YubiHSM Auth application version.
- Return type:
- put_credential_symmetric(management_key, label, key_enc, key_mac, credential_password, touch_required=False)[source]
Import a symmetric YubiHSM Auth credential.
- Parameters:
management_key (bytes) – The management key.
label (str) – The label of the credential.
key_enc (bytes) – The static K-ENC.
key_mac (bytes) – The static K-MAC.
credential_password (Union[bytes, str]) – The password used to protect access to the credential.
touch_required (bool) – The touch requirement policy.
- Return type:
- put_credential_derived(management_key, label, derivation_password, credential_password, touch_required=False)[source]
Import a symmetric YubiHSM Auth credential derived from password.
- Parameters:
management_key (bytes) – The management key.
label (str) – The label of the credential.
derivation_password (str) – The password used to derive the keys from.
credential_password (Union[bytes, str]) – The password used to protect access to the credential.
touch_required (bool) – The touch requirement policy.
- Return type:
- put_credential_asymmetric(management_key, label, private_key, credential_password, touch_required=False)[source]
Import an asymmetric YubiHSM Auth credential.
- Parameters:
management_key (bytes) – The management key.
label (str) – The label of the credential.
private_key (cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKeyWithSerialization) – Private key corresponding to the public authentication key object on the YubiHSM.
credential_password (Union[bytes, str]) – The password used to protect access to the credential.
touch_required (bool) – The touch requirement policy.
- Return type:
- generate_credential_asymmetric(management_key, label, credential_password, touch_required=False)[source]
Generate an asymmetric YubiHSM Auth credential.
Generates a private key on the YubiKey, whose corresponding public key can be retrieved using get_public_key.
- get_public_key(label)[source]
Get the public key for an asymmetric credential.
This will return the long-term public key “PK-OCE” for an asymmetric credential.
- Parameters:
label (str) – The label of the credential.
- Return type:
cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKey
- calculate_session_keys_symmetric(label, context, credential_password, card_crypto=None)[source]
Calculate session keys from a symmetric YubiHSM Auth credential.
- calculate_session_keys_asymmetric(label, context, public_key, credential_password, card_crypto)[source]
Calculate session keys from an asymmetric YubiHSM Auth credential.
- Parameters:
label (str) – The label of the credential.
context (bytes) – The context (EPK.OCE + EPK.SD).
public_key (cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKey) – The YubiHSM device’s public key.
credential_password (Union[bytes, str]) – The password used to protect access to the credential.
card_crypto (bytes) – The card cryptogram.
- Return type: