Package com.yubico.yubikit.support
Class DeviceUtil
- java.lang.Object
-
- com.yubico.yubikit.support.DeviceUtil
-
public class DeviceUtil extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description DeviceUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getName(com.yubico.yubikit.management.DeviceInfo info, com.yubico.yubikit.core.YubiKeyType keyType)
Determine the product name of a YubiKeystatic com.yubico.yubikit.management.DeviceInfo
readInfo(com.yubico.yubikit.core.YubiKeyConnection connection, com.yubico.yubikit.core.UsbPid pid)
Reads out DeviceInfo from a YubiKey, or attempts to synthesize the data.
-
-
-
Method Detail
-
readInfo
public static com.yubico.yubikit.management.DeviceInfo readInfo(com.yubico.yubikit.core.YubiKeyConnection connection, @Nullable com.yubico.yubikit.core.UsbPid pid) throws java.io.IOException, java.lang.IllegalArgumentException
Reads out DeviceInfo from a YubiKey, or attempts to synthesize the data.Reading DeviceInfo from a ManagementSession is only supported for newer YubiKeys. This function attempts to read that information, but will fall back to gathering the data using other mechanisms if needed. It will also make adjustments to the data if required, for example to "fix" known bad values.
The
pid
parameter must be provided whenever the YubiKey is connected via USB,- Parameters:
connection
-SmartCardConnection
,OtpConnection
orFidoConnection
connection to the YubiKeypid
- USB product ID of the YubiKey, can be null if unknown- Throws:
java.io.IOException
- in case of connection errorjava.lang.IllegalArgumentException
- in case ofpid
is null for USB connectionjava.lang.IllegalArgumentException
- in case of connection is notSmartCardConnection
,OtpConnection
orFidoConnection
-
getName
public static java.lang.String getName(com.yubico.yubikit.management.DeviceInfo info, @Nullable com.yubico.yubikit.core.YubiKeyType keyType)
Determine the product name of a YubiKey
-
-