Skip to content

Commit

Permalink
Rename
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisDyallo committed May 17, 2024
1 parent ea58382 commit 16a899f
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Yubico.YubiKey/src/Yubico/YubiKey/FidoDeviceInfoFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private static bool TryGetDeviceInfoFromFido(IHidDevice device,
log.LogInformation("Attempting to read device info via the FIDO interface management command.");
using var connection = new FidoConnection(device);

yubiKeyDeviceInfo = DeviceInfoHelper.GetDeviceInfo<GetPagedDeviceInfoCommand>(connection);
yubiKeyDeviceInfo = GetDeviceInfoHelper.GetDeviceInfo<GetPagedDeviceInfoCommand>(connection);
if (yubiKeyDeviceInfo is { })
{
log.LogInformation("Successfully read device info via FIDO interface management command.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

namespace Yubico.YubiKey
{
internal static class DeviceInfoHelper
internal static class GetDeviceInfoHelper
{
private static readonly Logger Logger = Log.GetLogger();

Expand Down Expand Up @@ -82,6 +82,9 @@ internal static class DeviceInfoHelper
return null;
}

// Certain transports (such as OTP keyboard) may return a buffer that is larger than the
// overall TLV size. We want to make sure we're only parsing over real TLV data here, so
// check the first byte to get the overall TLV length and slice accordingly.
int tlvDataLength = tlvData.Span[0];
if (tlvDataLength == 0 || 1 + tlvDataLength > tlvData.Length)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private static bool TryGetDeviceInfoFromKeyboard(IHidDevice device, [MaybeNullWh
log.LogInformation("Attempting to read device info via the management command over the keyboard interface.");
using var connection = new KeyboardConnection(device);

yubiKeyDeviceInfo = DeviceInfoHelper.GetDeviceInfo<GetPagedDeviceInfoCommand>(connection);
yubiKeyDeviceInfo = GetDeviceInfoHelper.GetDeviceInfo<GetPagedDeviceInfoCommand>(connection);
if (yubiKeyDeviceInfo is { })
{
log.LogInformation("Successfully read device info via the keyboard management command.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public Dictionary<int, ReadOnlyMemory<byte>> GetData()
};
}

Dictionary<int, ReadOnlyMemory<byte>>? result = DeviceInfoHelper.CreateApduDictionaryFromResponseData(ResponseApdu.Data);
Dictionary<int, ReadOnlyMemory<byte>>? result = GetDeviceInfoHelper.CreateApduDictionaryFromResponseData(ResponseApdu.Data);

return result ?? throw new MalformedYubiKeyResponseException
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public Dictionary<int, ReadOnlyMemory<byte>> GetData()
};
}

Dictionary<int, ReadOnlyMemory<byte>>? result = DeviceInfoHelper.CreateApduDictionaryFromResponseData(ResponseApdu.Data);
Dictionary<int, ReadOnlyMemory<byte>>? result = GetDeviceInfoHelper.CreateApduDictionaryFromResponseData(ResponseApdu.Data);

return result ?? throw new MalformedYubiKeyResponseException
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private static bool TryGetDeviceInfoFromManagement(
log.LogInformation("Attempting to read device info via the management application.");
using var connection = new SmartcardConnection(device, YubiKeyApplication.Management);

yubiKeyDeviceInfo = DeviceInfoHelper.GetDeviceInfo<GetPagedDeviceInfoCommand>(connection);
yubiKeyDeviceInfo = GetDeviceInfoHelper.GetDeviceInfo<GetPagedDeviceInfoCommand>(connection);
if (yubiKeyDeviceInfo is { })
{
log.LogInformation("Successfully read device info via management application.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public Dictionary<int, ReadOnlyMemory<byte>> GetData()
};
}

Dictionary<int, ReadOnlyMemory<byte>>? result = DeviceInfoHelper.CreateApduDictionaryFromResponseData(ResponseApdu.Data);
Dictionary<int, ReadOnlyMemory<byte>>? result = GetDeviceInfoHelper.CreateApduDictionaryFromResponseData(ResponseApdu.Data);

return result ?? throw new MalformedYubiKeyResponseException
{
Expand Down
1 change: 1 addition & 0 deletions Yubico.YubiKey/src/Yubico/YubiKey/YubiKeyDeviceInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public YubiKeyDeviceInfo()
/// True if the parsing and construction was successful, and false if
/// <paramref name="responseApduData"/> did not meet formatting requirements.
/// </returns>
[Obsolete("This has been replaced by CreateFromResponseData")]
internal static bool TryCreateFromResponseData(
ReadOnlyMemory<byte> responseApduData,
[MaybeNullWhen(returnValue: false)] out YubiKeyDeviceInfo deviceInfo)
Expand Down

0 comments on commit 16a899f

Please sign in to comment.