LibLogicalAccess
2.5.0
An Open Source RFID Library
|
The Yubikey commands class. More...
#include <yubikeycommands.hpp>
Public Member Functions | |
YubikeyCommands () | |
Constructor. | |
YubikeyCommands (std::string cmdtype) | |
Constructor. | |
virtual YubikeySelectResponse | selectYubikeyOATH ()=0 |
Select the Yubikey OATH application. | |
virtual ByteVector | selectYubikeyOTP ()=0 |
Select the old Yubikey OTP application. | |
virtual ByteVector | otp_getResponse (YubikeySlot slot, const ByteVector &challenge)=0 |
Challenge/Response operation. | |
virtual ByteVector | otp_getSerialNumber ()=0 |
Reads the serial number of the YubiKey if it is allowed by the configuration. Note that certain keys, such as the Security Key by Yubico, do not have serial numbers. | |
virtual std::vector< TLVPtr > | otp_getDeviceInfo ()=0 |
Reads configuration and metadata information about the YubiKey. Similar commands exist in other applications. The Command APDU may be different, however the data in the Response APDU will be of identical format. | |
virtual bool | otp_queryFIPSMode ()=0 |
Determines whether or not the device is loaded with FIPS capable firmware, as well as if the key is currently in a FIPS compliant state. | |
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 void | oath_delete (const ByteVector &name)=0 |
Deletes an existing credential. | |
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 expected to be a user-supplied UTF-8 encoded password passed through 1000 rounds of PBKDF2 with the ID from select used as salt. 16 bytes of that are used. When configuring authentication you are required to send an 8 byte challenge and one authentication-response with that key, in order to confirm that the application and the host software can calculate the same response for that key. | |
virtual std::vector< YubikeyListItem > | oath_list ()=0 |
Lists configured credentials. | |
virtual void | oath_reset ()=0 |
Resets the application to just-installed state. | |
virtual YubikeyCalculateResponse | oath_calculate (const ByteVector &name, const ByteVector &challenge, bool truncate=false)=0 |
Performs CALCULATE for one named credential. | |
virtual ByteVector | oath_validate (const ByteVector &challenge, const ByteVector &response)=0 |
Validates authentication (mutually). The challenge for this comes from the SELECT command. The response if computed by performing the correct HMAC function of that challenge with the correct key. A new challenge is then sent to the application, together with the response. The application will then respond with a similar calculation that the host software can verify. | |
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 HOTP and credentials requiring touch. | |
virtual ByteVector | oath_sendRemainingInstruction ()=0 |
Gets remaining data if everything didn’t fit in previous response (response code was 61xx). | |
virtual std::shared_ptr< ISO7816Commands > | getISO7816Commands () const =0 |
![]() | |
Commands ()=delete | |
Constructor. | |
virtual | ~Commands () |
std::shared_ptr< Chip > | getChip () const override |
Get the chip. | |
virtual void | setChip (std::shared_ptr< Chip > chip) |
Set the chip. | |
std::shared_ptr< ReaderCardAdapter > | getReaderCardAdapter () const override |
Get the reader/card adapter. | |
virtual void | setReaderCardAdapter (std::shared_ptr< ReaderCardAdapter > adapter) |
Set the reader/card adapter. | |
virtual const std::string & | getCmdType () const |
Get the cmd name. | |
virtual void | setCmdType (const std::string &command_type) |
Set the cmd name. | |
![]() | |
virtual | ~ICommands ()=default |
virtual std::shared_ptr< Chip > | getChip () const =0 |
Get the chip. | |
virtual std::shared_ptr< ReaderCardAdapter > | getReaderCardAdapter () const =0 |
Get the reader/card adapter. | |
Additional Inherited Members | |
![]() | |
Commands (std::string commandtype) | |
Constructor. | |
![]() | |
std::shared_ptr< ReaderCardAdapter > | d_readerCardAdapter |
The reader/card adapter. | |
std::weak_ptr< Chip > | d_chip |
The chip. | |
std::string | d_commandtype |
The command type. | |
The Yubikey commands class.
|
inline |
Constructor.
|
inlineexplicit |
Constructor.
ct | The cmd type. |
|
pure virtual |
Implemented in logicalaccess::YubikeyISO7816Commands.
|
pure virtual |
Performs CALCULATE for one named credential.
name | The credential name. |
challenge | The challenge. |
truncate | Truncate the response, full response otherwise. |
Implemented in logicalaccess::YubikeyISO7816Commands.
|
pure virtual |
Performs CALCULATE for all available credentials, returns name + response for TOTP and just name for HOTP and credentials requiring touch.
challenge | The challenge. |
truncate | Truncate the response, full response otherwise. |
Implemented in logicalaccess::YubikeyISO7816Commands.
|
pure virtual |
Deletes an existing credential.
name | The credential name to delete. |
Implemented in logicalaccess::YubikeyISO7816Commands.
|
pure virtual |
Lists configured credentials.
Implemented in logicalaccess::YubikeyISO7816Commands.
|
pure virtual |
Adds a new (or overwrites) OATH credential.
name | The credential name. |
algorithm | The HMAC algorithm. |
digits | Number of digits in OATH code. |
key | The HMAC key. |
property | OATH properties. |
imf | IMF (only valid for HOTP). |
Implemented in logicalaccess::YubikeyISO7816Commands.
|
pure virtual |
Resets the application to just-installed state.
Implemented in logicalaccess::YubikeyISO7816Commands.
|
pure virtual |
Gets remaining data if everything didn’t fit in previous response (response code was 61xx).
Implemented in logicalaccess::YubikeyISO7816Commands.
|
pure virtual |
Configures Authentication. If length 0 is sent, authentication is removed. The key to be set is expected to be a user-supplied UTF-8 encoded password passed through 1000 rounds of PBKDF2 with the ID from select used as salt. 16 bytes of that are used. When configuring authentication you are required to send an 8 byte challenge and one authentication-response with that key, in order to confirm that the application and the host software can calculate the same response for that key.
name | The credential name. |
algorithm | The HMAC algorithm to use. |
key | The HMAC key. |
challenge | The challenge. |
Implemented in logicalaccess::YubikeyISO7816Commands.
|
pure virtual |
Validates authentication (mutually). The challenge for this comes from the SELECT command. The response if computed by performing the correct HMAC function of that challenge with the correct key. A new challenge is then sent to the application, together with the response. The application will then respond with a similar calculation that the host software can verify.
challenge | The challenge. |
challenge | The host calculated response. |
Implemented in logicalaccess::YubikeyISO7816Commands.
|
pure virtual |
Reads configuration and metadata information about the YubiKey. Similar commands exist in other applications. The Command APDU may be different, however the data in the Response APDU will be of identical format.
Implemented in logicalaccess::YubikeyISO7816Commands.
|
pure virtual |
Challenge/Response operation.
slot | Target slot. |
challenge | Challenge to transmit. |
Implemented in logicalaccess::YubikeyISO7816Commands.
|
pure virtual |
Reads the serial number of the YubiKey if it is allowed by the configuration. Note that certain keys, such as the Security Key by Yubico, do not have serial numbers.
Implemented in logicalaccess::YubikeyISO7816Commands.
|
pure virtual |
Determines whether or not the device is loaded with FIPS capable firmware, as well as if the key is currently in a FIPS compliant state.
Implemented in logicalaccess::YubikeyISO7816Commands.
|
pure virtual |
Select the Yubikey OATH application.
Implemented in logicalaccess::YubikeyISO7816Commands.
|
pure virtual |
Select the old Yubikey OTP application.
Implemented in logicalaccess::YubikeyISO7816Commands.