Skip to content

Commit 46999f0

Browse files
committed
tests:
AttestTests - added comment on CreateAttestationStatement Added test for Ed25519 attest Fix tests in PivSessionTests
1 parent ace1a0a commit 46999f0

File tree

3 files changed

+146
-149
lines changed

3 files changed

+146
-149
lines changed

Yubico.YubiKey/tests/integration/Yubico/YubiKey/Piv/AttestTests.cs

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,27 +56,20 @@ public void Attest_Imported_ThrowsException(
5656
[InlineData(KeyType.RSA3072, StandardTestDevice.Fw5)]
5757
[InlineData(KeyType.RSA4096, StandardTestDevice.Fw5)]
5858
[InlineData(KeyType.ECP256, StandardTestDevice.Fw5)]
59-
[InlineData(KeyType.ECP384, StandardTestDevice.Fw5)]
59+
[InlineData(KeyType.Ed25519, StandardTestDevice.Fw5)]
6060
public void AttestGenerated(
6161
KeyType keyType,
6262
StandardTestDevice deviceType)
6363
{
6464
TestDeviceType = deviceType;
65-
6665
const byte slotNumber = PivSlot.Retired1;
67-
_ = Session.GenerateKeyPair(
68-
slotNumber, keyType, PivPinPolicy.Never, PivTouchPolicy.Never);
66+
Session.GenerateKeyPair(slotNumber, keyType, PivPinPolicy.Never, PivTouchPolicy.Never);
6967

70-
X509Certificate2? cert = null;
71-
try
72-
{
73-
cert = Session.CreateAttestationStatement(slotNumber);
74-
Assert.NotEqual(1, cert.Version);
75-
}
76-
finally
77-
{
78-
cert?.Dispose();
79-
}
68+
// If this test fails, it's possible the attestation key or cert is missing or broken.
69+
// In that case, run LoadAttestationPair(KeyType, true) to fix the problem.
70+
var cert = Session.CreateAttestationStatement(slotNumber);
71+
72+
Assert.NotEqual(1, cert.Version);
8073
}
8174

8275
[Theory]
@@ -86,7 +79,7 @@ public void GetAttestationCert_ReturnsCert(
8679
{
8780
TestDeviceType = deviceType;
8881

89-
LoadAttestationPair(KeyType.ECP384, true);
82+
LoadAttestationPair(KeyType.ECP256, true);
9083

9184
X509Certificate2? cert = null;
9285
try

0 commit comments

Comments
 (0)