Skip to content

Commit

Permalink
Merge PR #135
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisDyallo authored Aug 7, 2024
2 parents b9e6c16 + 8ce0fde commit ffcd85b
Show file tree
Hide file tree
Showing 78 changed files with 251 additions and 202 deletions.
1 change: 1 addition & 0 deletions Yubico.YubiKey/src/Yubico/YubiKey/IYubiKeyDeviceInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public interface IYubiKeyDeviceInfo

/// <summary>
/// The serial number of the YubiKey, if one is present.
/// <remarks>Security Keys don't have serial numbers</remarks>
/// </summary>
public int? SerialNumber { get; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

namespace Yubico.YubiKey.Cryptography
{
[Trait("Category", "Simple")]
[Trait(TraitTypes.Category, TestCategories.Simple)]
public class RsaOaepTimingTests
{
private const int IterationCount1024 = 200000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

namespace Yubico.YubiKey.Cryptography
{
[Trait("Category", "Simple")]
[Trait(TraitTypes.Category, TestCategories.Simple)]
public class RsaP1TimingTests
{
private const int IterationCount1024 = 10000000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

namespace Yubico.YubiKey.Fido2
{
[Trait("Category", "RequiresBio")]
[Trait(TraitTypes.Category, TestCategories.RequiresBio)]
public class BioEnrollTests : SimpleIntegrationTestConnection
{
// Set to 0 meaning don't cancel.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

namespace Yubico.YubiKey.Fido2.Commands
{
[Trait("Category", "RequiresBio")]
[Trait(TraitTypes.Category, TestCategories.RequiresBio)]
public class BioEnrollmentCommandTests : NeedPinToken
{
public BioEnrollmentCommandTests()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

namespace Yubico.YubiKey.Fido2.Commands
{
[Trait("Category", "RequiresBio")]
[Trait(TraitTypes.Category, TestCategories.RequiresBio)]
public class ConfigCommandTests : NeedPinToken
{
public ConfigCommandTests()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

namespace Yubico.YubiKey.Fido2.Commands
{
[Trait("Category", "RequiresBio")]
[Trait(TraitTypes.Category, TestCategories.RequiresBio)]
public class DeleteCredCommandTests : SimpleIntegrationTestConnection
{
public DeleteCredCommandTests()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

namespace Yubico.YubiKey.Fido2.Commands
{
[Trait("Category", "FirmwareOrHardwareMissmatch")]
[Trait(TraitTypes.Category, TestCategories.FirmwareOrHardwareMismatch)]
public class EnumCredsCommandTests : SimpleIntegrationTestConnection
{
public EnumCredsCommandTests()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

namespace Yubico.YubiKey.Fido2.Commands
{
[Trait("Category", "FirmwareOrHardwareMissmatch")]
[Trait(TraitTypes.Category, TestCategories.FirmwareOrHardwareMismatch)]
public class EnumRpsCommandTests : SimpleIntegrationTestConnection
{
public EnumRpsCommandTests()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

namespace Yubico.YubiKey.Fido2.Commands
{
[Trait("Category", "RequiresBio")]
[Trait(TraitTypes.Category, TestCategories.RequiresBio)]
public class GetAssertionCommandTests : NeedPinToken
{
public GetAssertionCommandTests()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

namespace Yubico.YubiKey.Fido2.Commands
{
[Trait("Category", "RequiresBio")]
[Trait(TraitTypes.Category, TestCategories.RequiresBio)]
public class GetKeyAgreeCommandTests : SimpleIntegrationTestConnection
{
public GetKeyAgreeCommandTests()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

namespace Yubico.YubiKey.Fido2.Commands
{
[Trait("Category", "RequiresBio")]
[Trait(TraitTypes.Category, TestCategories.RequiresBio)]
public class HmacSecretTests : SimpleIntegrationTestConnection
{
private readonly byte[] _pin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

namespace Yubico.YubiKey.Fido2.Commands
{
[Trait("Category", "RequiresBio")]
[Trait(TraitTypes.Category, TestCategories.RequiresBio)]
public class MakeCredBlobTests : NeedPinToken
{
private readonly byte[] _clientDataHash = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

namespace Yubico.YubiKey.Fido2.Commands
{
[Trait("Category", "RequiresBio")]
[Trait(TraitTypes.Category, TestCategories.RequiresBio)]
public class MakeCredentialCommandTests : NeedPinToken
{
public MakeCredentialCommandTests()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

namespace Yubico.YubiKey.Fido2.Commands
{
[Trait("Category", "RequiresBio")]
[Trait(TraitTypes.Category, TestCategories.RequiresBio)]
public class MakeLargeBlobTests : NeedPinToken
{
public MakeLargeBlobTests()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

namespace Yubico.YubiKey.Fido2.Commands
{
[Trait("Category", "RequiresBio")]
[Trait(TraitTypes.Category, TestCategories.RequiresBio)]
public class SetPinCommandTests : SimpleIntegrationTestConnection
{
private const int Fido2AuthPin = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

namespace Yubico.YubiKey.Fido2.Commands
{
[Trait("Category", "FirmwareOrHardwareMissmatch")]
[Trait(TraitTypes.Category, TestCategories.FirmwareOrHardwareMismatch)]
public class UpdateUserInfoCommandTests : SimpleIntegrationTestConnection
{
public UpdateUserInfoCommandTests()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

namespace Yubico.YubiKey.Fido2
{
[Trait("Category", "Simple")]
[Trait(TraitTypes.Category, TestCategories.Simple)]
public class ConfigTests : SimpleIntegrationTestConnection
{
public ConfigTests()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

namespace Yubico.YubiKey.Fido2
{
[Trait("Category", "RequiresBio")]
[Trait(TraitTypes.Category, TestCategories.RequiresBio)]
public class CredMgmtTests : IClassFixture<BioFido2Fixture>
{
private readonly BioFido2Fixture _bioFido2Fixture;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@

using System.Linq;
using Xunit;
using Yubico.YubiKey.TestUtilities;

namespace Yubico.YubiKey.Fido2
{
public class GetAuthenticatorInfoTests
{
[Fact]
[Trait("Category", "Simple")]
[Trait(TraitTypes.Category, TestCategories.Simple)]
public void GetAuthenticator_Succeeds()
{
IYubiKeyDevice yubiKey = YubiKeyDevice.FindAll().First();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

namespace Yubico.YubiKey.Fido2
{
[Trait("Category", "RequiresBio")]
[Trait(TraitTypes.Category, TestCategories.RequiresBio)]
public class LargeBlobTests
{
static readonly byte[] _clientDataHash = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class MakeCredentialBlobTests
[Fact]
public void CredBlobExtension_Correct()
{
IYubiKeyDevice yubiKeyDevice = IntegrationTestDeviceEnumeration.GetTestDevices()[0];
IYubiKeyDevice yubiKeyDevice = IntegrationTestDeviceEnumeration.GetTestDevice();
IYubiKeyConnection connection = yubiKeyDevice.Connect(YubiKeyApplication.Fido2);

var getInfoCmd = new GetInfoCommand();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class MakeCredentialGetAssertionTests
static readonly RelyingParty _rp = new RelyingParty("relyingparty1");

// This test requires user to touch the device.
[Fact, Trait("Category", "RequiresTouch")]
[Fact, Trait(TraitTypes.Category, TestCategories.RequiresTouch)]
public void MakeCredential_NonDiscoverable_GetAssertion_Succeeds()
{
IYubiKeyDevice yubiKeyDevice = YubiKeyDevice.FindByTransport(Transport.HidFido).First();
Expand Down Expand Up @@ -85,7 +85,7 @@ public void MakeCredential_NonDiscoverable_GetAssertion_Succeeds()
}

// This test requires user to touch the device.
[Fact, Trait("Category", "RequiresTouch")]
[Fact, Trait(TraitTypes.Category, TestCategories.RequiresTouch)]
public void MakeCredential_NoName_GetAssertion_Succeeds()
{
IYubiKeyDevice yubiKeyDevice = YubiKeyDevice.FindByTransport(Transport.HidFido).First();
Expand Down Expand Up @@ -124,7 +124,7 @@ public void MakeCredential_NoName_GetAssertion_Succeeds()
}

// This test requires user to touch the device.
[Fact, Trait("Category", "RequiresTouch")]
[Fact, Trait(TraitTypes.Category, TestCategories.RequiresTouch)]
public void MakeCredential_MultipleCredentials_GetAssertion_ReturnsMultipleAssertions()
{
IYubiKeyDevice yubiKeyDevice = YubiKeyDevice.FindByTransport(Transport.HidFido).First();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public MinPinLenTests()
}

[Fact]
[Trait("Category", "Simple")]
[Trait(TraitTypes.Category, TestCategories.Simple)]
public void GetMinPinFromCredential_Succeeds()
{
using (var fido2Session = new Fido2Session(Device))
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
using System.Text;
using Xunit;
using Yubico.YubiKey.Fido2.Commands;
using Yubico.YubiKey.TestUtilities;

namespace Yubico.YubiKey.Fido2
{
public class PinCollectionTests
{
[Fact]
[Trait("Category", "RequiresSetup")]
[Trait(TraitTypes.Category, TestCategories.RequiresSetup)]
public void PinOperations_Succeed()
{
// Assumption - the YubiKey returned has a new or reset FIDO2 application with no PIN set.
Expand Down Expand Up @@ -83,7 +84,7 @@ public void PinOperations_Succeed()
}

[Fact]
[Trait("Category", "RequiresSetup")]
[Trait(TraitTypes.Category, TestCategories.RequiresSetup)]
public void UvOperations_Succeed()
{
// Test assumptions: PIN is already set to 123456 (UTF-8 chars, not the number `123456`)
Expand All @@ -99,7 +100,7 @@ public void UvOperations_Succeed()
}

[Fact]
[Trait("Category", "RequiresSetup")]
[Trait(TraitTypes.Category, TestCategories.RequiresSetup)]
public void InvalidPinFollowedByValidPin_Succeeds()
{
// Test assumption: PIN is already set to 123456 (UTF-8 chars, not the number `123456`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

namespace Yubico.YubiKey.Fido2
{
[Trait("Category", "FirmwareOrHardwareMissmatch")]
[Trait(TraitTypes.Category, TestCategories.FirmwareOrHardwareMismatch)]
public class SimpleCredMgmtTests : SimpleIntegrationTestConnection
{
public SimpleCredMgmtTests()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

namespace Yubico.YubiKey.Fido2
{
[Trait("Category", "RequiresBio")]
[Trait(TraitTypes.Category, TestCategories.RequiresBio)]
public class VerifyFpTests : SimpleIntegrationTestConnection
{
public VerifyFpTests()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void HasFeature_ApplicationOTP_Correct()
[Fact]
public void HasFeature_ApplicationU2F_Correct()
{
IYubiKeyDevice yubiKeyDevice = IntegrationTestDeviceEnumeration.GetTestDevices().First();
IYubiKeyDevice yubiKeyDevice = IntegrationTestDeviceEnumeration.GetTestDevice();
bool expectedResult = true;

//Can this be removed?
Expand All @@ -50,7 +50,7 @@ public void HasFeature_ApplicationU2F_Correct()
[Fact]
public void HasFeature_ApplicationFido2_Correct()
{
IYubiKeyDevice yubiKeyDevice = IntegrationTestDeviceEnumeration.GetTestDevices().First();
IYubiKeyDevice yubiKeyDevice = IntegrationTestDeviceEnumeration.GetTestDevice();
bool expectedResult = true;
if (!yubiKeyDevice.IsSkySeries && yubiKeyDevice.FirmwareVersion.Major < 5)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

namespace Yubico.YubiKey.Management
{
[Trait("Category", "Simple")]
[Trait(TraitTypes.Category, TestCategories.Simple)]
public class SetDeviceInfoCommandTests
{
[SkippableTheory(typeof(DeviceNotFoundException))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

namespace Yubico.YubiKey.Oath
{
[Trait("Category", "Simple")]
[Trait(TraitTypes.Category, TestCategories.Simple)]
[TestCaseOrderer(PriorityOrderer.TypeName, PriorityOrderer.AssembyName)]
public class CredentialTests : IClassFixture<CredentialFixture>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace Yubico.YubiKey.Oath
// retrieve large amounts of data that spans more
// than one APDU. For more information, see
// Pipelines.ResponseChainingTransform.
[Trait("Category", "Simple")]
[Trait(TraitTypes.Category, TestCategories.Simple)]
public sealed class GetLargeData
{
private static readonly Random random = new Random();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

namespace Yubico.YubiKey.Oath
{
[Trait("Category", "Simple")]
[Trait(TraitTypes.Category, TestCategories.Simple)]
public sealed class NoCollectorPasswordTests
{
[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
namespace Yubico.YubiKey.Oath
{
[TestCaseOrderer(PriorityOrderer.TypeName, PriorityOrderer.AssembyName)]
[Trait("Category", "Simple")]
[Trait(TraitTypes.Category, TestCategories.Simple)]
public sealed class OathSessionCredentialTests : IClassFixture<CredentialFixture>
{
// Shared object instance across tests.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
namespace Yubico.YubiKey.Oath
{
[TestCaseOrderer(PriorityOrderer.TypeName, PriorityOrderer.AssembyName)]
[Trait("Category", "Simple")]
[Trait(TraitTypes.Category, TestCategories.Simple)]
public sealed class OathSessionPasswordTests
{
[Theory, TestPriority(0)]
Expand Down
Loading

0 comments on commit ffcd85b

Please sign in to comment.