How to use the command ykinfo (with examples)
The ykinfo
command is used to retrieve basic information from a YubiKey. It can display all information from the YubiKey, as well as extract specific details such as the serial number and capabilities.
Use case 1: Display all information from YubiKey
Code:
ykinfo -a
Motivation: This use case is helpful when you need to retrieve all the available information from a YubiKey, including its firmware version, serial number, supported algorithms, and configuration settings.
Explanation:
ykinfo
: The command itself.-a
: This option stands for “all” and instructsykinfo
to retrieve and display all available information from the YubiKey.
Example output:
Firmware version 5.4.2 Touch level 1 Program sequence number 1
Serial number 0123456789
Supported algorithms: ecc ed25519 ecdsa cv25819 rsa-pss rsa
Supported capability: otp ccid u2f u2f-2 fido2 fido2-2 otp over ccid over ccid-long
Use case 2: Get only serial in decimal from YubiKey
Code:
ykinfo -s -q
Motivation: Sometimes, you may only need the serial number of a YubiKey, and you want to retrieve it in a specific format. This use case allows you to get the serial number in decimal format.
Explanation:
-s
: This option stands for “serial” and tellsykinfo
to only retrieve the serial number from the YubiKey.-q
: This option stands for “quiet” and suppresses all non-error output, resulting in only the serial number being displayed.
Example output:
123456789
Use case 3: Get capabilities from YubiKey
Code:
ykinfo -c
Motivation: Understanding the capabilities of a YubiKey can be useful when developing or configuring applications that interact with it. This use case allows you to retrieve the supported capabilities of a YubiKey.
Explanation:
-c
: This option stands for “capabilities” and instructsykinfo
to retrieve and display the supported capabilities of the YubiKey.
Example output:
Supported capability: otp ccid u2f u2f-2 fido2 fido2-2 otp over ccid over ccid-long
Conclusion:
The ykinfo
command provides a simple and straightforward way to retrieve basic information from a YubiKey. Whether you need to obtain all available details, specific attributes like the serial number, or the supported capabilities, ykinfo
has you covered. By using the provided examples, you can easily utilize this command to obtain the information you need.