Skip to content

Commit 6a8fb0b

Browse files
authored
Expose attestation certificates in attestation response. (#302)
* Expose attestation certificates in attestation response. Fixes #299 * Add nullability annotations as per review comments.
1 parent 2643470 commit 6a8fb0b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Src/Fido2.Models/Objects/AttestationVerificationSuccess.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Text.Json.Serialization;
1+
using System.Security.Cryptography.X509Certificates;
2+
using System.Text.Json.Serialization;
23

34
namespace Fido2NetLib.Objects
45
{
@@ -13,5 +14,9 @@ public class AttestationVerificationSuccess : AssertionVerificationResult
1314
public Fido2User User { get; set; }
1415
public string CredType { get; set; }
1516
public System.Guid Aaguid { get; set; }
17+
#nullable enable
18+
public X509Certificate2? AttestationCertificate { get; set; }
19+
#nullable disable
20+
public X509Certificate2[] AttestationCertificateChain { get; set; }
1621
}
1722
}

Src/Fido2/AuthenticatorAttestationResponse.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ static bool ContainsAttestationType(MetadataBLOBPayloadEntry entry, MetadataAtte
241241
Counter = authData.SignCount,
242242
CredType = AttestationObject.Fmt,
243243
Aaguid = authData.AttestedCredentialData.AaGuid,
244+
AttestationCertificate = trustPath?.FirstOrDefault(),
245+
AttestationCertificateChain = trustPath ?? Array.Empty<X509Certificate2>(),
244246
};
245247

246248
return result;

0 commit comments

Comments
 (0)