Package com.yubico.yubikit.support
Class DeviceUtil
java.lang.Object
com.yubico.yubikit.support.DeviceUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetName(com.yubico.yubikit.management.DeviceInfo info, com.yubico.yubikit.core.YubiKeyType keyType) Determine the product name of a YubiKeystatic com.yubico.yubikit.management.DeviceInforeadInfo(com.yubico.yubikit.core.YubiKeyConnection connection, com.yubico.yubikit.core.UsbPid pid) Reads out DeviceInfo from a YubiKey, or attempts to synthesize the data.
-
Constructor Details
-
DeviceUtil
public DeviceUtil()
-
-
Method Details
-
readInfo
public static com.yubico.yubikit.management.DeviceInfo readInfo(com.yubico.yubikit.core.YubiKeyConnection connection, @Nullable com.yubico.yubikit.core.UsbPid pid) throws IOException, 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
pidparameter must be provided whenever the YubiKey is connected via USB,- Parameters:
connection-SmartCardConnection,OtpConnectionorFidoConnectionconnection to the YubiKeypid- USB product ID of the YubiKey, can be null if unknown- Throws:
IOException- in case of connection errorIllegalArgumentException- in case ofpidis null for USB connectionIllegalArgumentException- in case of connection is notSmartCardConnection,OtpConnectionorFidoConnectionIllegalArgumentException- when the hardware key could not be identified
-
getName
public static String getName(com.yubico.yubikit.management.DeviceInfo info, @Nullable com.yubico.yubikit.core.YubiKeyType keyType) Determine the product name of a YubiKey
-