7#ifndef LOGICALACCESS_YUBIKEYCOMMANDS_HPP
8#define LOGICALACCESS_YUBIKEYCOMMANDS_HPP
11#include <logicalaccess/plugins/cards/yubikey/lla_cards_yubikey_api.hpp>
17#define CMD_YUBIKEY "Yubikey"
87#define YUBIKEY_TLV_DEVINFO_AVAILABLE_CAPABILITIES_USB 0x01
88#define YUBIKEY_TLV_DEVINFO_SERIAL_NUMBER 0x02
89#define YUBIKEY_TLV_DEVINFO_ENABLED_CAPABILITIES_USB 0x03
90#define YUBIKEY_TLV_DEVINFO_FORM_FACTOR 0x04
91#define YUBIKEY_TLV_DEVINFO_FIRMWARE_VERSION 0x05
92#define YUBIKEY_TLV_DEVINFO_AUTOEJECT_TIMEOUT 0x06
93#define YUBIKEY_TLV_DEVINFO_CHALLENGE_RESPONSE_TIMEOUT 0x07
94#define YUBIKEY_TLV_DEVINFO_DEVICE_FLAGS 0x08
95#define YUBIKEY_TLV_DEVINFO_CONFIGURATION_LOCK 0x0A
96#define YUBIKEY_TLV_DEVINFO_AVAILABLE_CAPABILITIES_NFC 0x0D
97#define YUBIKEY_TLV_DEVINFO_ENABLED_CAPABILITIES_NFC 0x0E
99#define YUBIKEY_TLV_NAME 0x71
100#define YUBIKEY_TLV_NAME_LIST 0x72
101#define YUBIKEY_TLV_KEY 0x73
102#define YUBIKEY_TLV_CHALLENGE 0x74
103#define YUBIKEY_TLV_FULL_RESPONSE 0x75
104#define YUBIKEY_TLV_TRUNCATED_RESPONSE 0x76
105#define YUBIKEY_TLV_HOTP_RESPONSE 0x77
106#define YUBIKEY_TLV_PROPERTY 0x78
107#define YUBIKEY_TLV_VERSION 0x79
108#define YUBIKEY_TLV_IMF 0x7a
109#define YUBIKEY_TLV_ALGORITHM 0x7b
110#define YUBIKEY_TLV_TOUCH_RESPONSE 0x7c
The base commands class for all card commands.
Definition: commands.hpp:21
The Yubikey commands class.
Definition: yubikeycommands.hpp:116
virtual bool otp_queryFIPSMode()=0
Determines whether or not the device is loaded with FIPS capable firmware, as well as if the key is c...
virtual std::shared_ptr< ISO7816Commands > getISO7816Commands() const =0
virtual ByteVector otp_getResponse(YubikeySlot slot, const ByteVector &challenge)=0
Challenge/Response operation.
virtual YubikeySelectResponse selectYubikeyOATH()=0
Select the Yubikey OATH application.
virtual void oath_reset()=0
Resets the application to just-installed state.
YubikeyCommands()
Constructor.
Definition: yubikeycommands.hpp:122
virtual void oath_setCode(YubikeyHMAC algorithm, const ByteVector &key, const ByteVector &challenge)=0
Configures Authentication. If length 0 is sent, authentication is removed. The key to be set is expec...
virtual std::vector< TLVPtr > otp_getDeviceInfo()=0
Reads configuration and metadata information about the YubiKey. Similar commands exist in other appli...
virtual ByteVector otp_getSerialNumber()=0
Reads the serial number of the YubiKey if it is allowed by the configuration. Note that certain keys,...
YubikeyCommands(std::string cmdtype)
Constructor.
Definition: yubikeycommands.hpp:131
virtual ByteVector selectYubikeyOTP()=0
Select the old Yubikey OTP application.
virtual void oath_put(const ByteVector &name, YubikeyHMAC algorithm, uint8_t digits, const ByteVector &key, YubikeyProperty property=PROP_NONE, const ByteVector &imf=ByteVector())=0
Adds a new (or overwrites) OATH credential.
virtual std::vector< YubikeyCalculateResponse > oath_calculateAll(const ByteVector &challenge, bool truncate=false)=0
Performs CALCULATE for all available credentials, returns name + response for TOTP and just name for ...
virtual ByteVector oath_validate(const ByteVector &challenge, const ByteVector &response)=0
Validates authentication (mutually). The challenge for this comes from the SELECT command....
virtual void oath_delete(const ByteVector &name)=0
Deletes an existing credential.
virtual std::vector< YubikeyListItem > oath_list()=0
Lists configured credentials.
virtual ByteVector oath_sendRemainingInstruction()=0
Gets remaining data if everything didn’t fit in previous response (response code was 61xx).
virtual YubikeyCalculateResponse oath_calculate(const ByteVector &name, const ByteVector &challenge, bool truncate=false)=0
Performs CALCULATE for one named credential.
ISO7816 commands. See http://www.cardwerk.com/smartcards/smartcard_standard_ISO7816-4....
std::vector< uint8_t > ByteVector
Definition: lla_fwd.hpp:80
YubikeyProperty
Yubikey properties.
Definition: yubikeycommands.hpp:36
@ PROP_ONLY_INCREASE
Definition: yubikeycommands.hpp:38
@ PROP_NONE
Definition: yubikeycommands.hpp:37
@ PROP_REQUIRE_TOUCH
Definition: yubikeycommands.hpp:39
YubikeySlot
Yubikey slot. Only used for the old slot-based Yubikey API.
Definition: yubikeycommands.hpp:46
@ SLOT_NDEF_1
Definition: yubikeycommands.hpp:54
@ SLOT_NAV
Definition: yubikeycommands.hpp:49
@ SLOT_UPDATE_2
Definition: yubikeycommands.hpp:52
@ SLOT_DEVICE_CONFIGURATION
Definition: yubikeycommands.hpp:57
@ SLOT_SWAP
Definition: yubikeycommands.hpp:53
@ SLOT_SCAN_MAP
Definition: yubikeycommands.hpp:58
@ SLOT_DEVICE_SERIAL
Definition: yubikeycommands.hpp:56
@ SLOT_CONFIG_1
Definition: yubikeycommands.hpp:48
@ SLOT_YUBIKEY_4_CAPABILITIES
Definition: yubikeycommands.hpp:59
@ SLOT_DUMMY
Definition: yubikeycommands.hpp:47
@ SLOT_CHALLENGE_OTP_2
Definition: yubikeycommands.hpp:61
@ SLOT_CHALLENGE_HMAC_2
Definition: yubikeycommands.hpp:63
@ SLOT_CHALLENGE_HMAC_1
Definition: yubikeycommands.hpp:62
@ SLOT_CHALLENGE_OTP_1
Definition: yubikeycommands.hpp:60
@ SLOT_UPDATE_1
Definition: yubikeycommands.hpp:51
@ SLOT_NDEF_2
Definition: yubikeycommands.hpp:55
@ SLOT_CONFIG_2
Definition: yubikeycommands.hpp:50
struct logicalaccess::s_YubikeyCalculateResponse YubikeyCalculateResponse
YubikeyHMAC
The HMAC algorithm.
Definition: yubikeycommands.hpp:23
@ HMAC_TYPE_HOTP
Definition: yubikeycommands.hpp:28
@ HMAC_SHA1
Definition: yubikeycommands.hpp:25
@ HMAC_UNKNOWN
Definition: yubikeycommands.hpp:24
@ HMAC_SHA256
Definition: yubikeycommands.hpp:26
@ HMAC_SHA512
Definition: yubikeycommands.hpp:27
@ HMAC_TYPE_TOTP
Definition: yubikeycommands.hpp:29
struct logicalaccess::s_YubikeySelectResponse YubikeySelectResponse
struct logicalaccess::s_YubikeyListItem YubikeyListItem
Definition: yubikeycommands.hpp:75
uint8_t digits
Definition: yubikeycommands.hpp:77
ByteVector name
Definition: yubikeycommands.hpp:76
ByteVector response
Definition: yubikeycommands.hpp:78
Definition: yubikeycommands.hpp:82
YubikeyHMAC algorithm
Definition: yubikeycommands.hpp:83
ByteVector name
Definition: yubikeycommands.hpp:84
Definition: yubikeycommands.hpp:67
YubikeyHMAC algorithm
Definition: yubikeycommands.hpp:70
ByteVector name
Definition: yubikeycommands.hpp:69
ByteVector challenge
Definition: yubikeycommands.hpp:71
ByteVector version
Definition: yubikeycommands.hpp:68
#define CMD_YUBIKEY
Definition: yubikeycommands.hpp:17