Skip to content

Commit b597d18

Browse files
authored
Drop assertion-time attestation (#499)
1 parent 0a9886d commit b597d18

File tree

2 files changed

+1
-48
lines changed

2 files changed

+1
-48
lines changed

Src/Fido2.Models/AuthenticatorAssertionRawResponse.cs

-4
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,5 @@ public sealed class AssertionResponse
5454
[JsonPropertyName("userHandle")]
5555
[JsonConverter(typeof(Base64UrlConverter))]
5656
public byte[]? UserHandle { get; set; }
57-
58-
[JsonPropertyName("attestationObject")]
59-
[JsonConverter(typeof(Base64UrlConverter))]
60-
public byte[]? AttestationObject { get; set; }
6157
}
6258
}

Src/Fido2/AuthenticatorAssertionResponse.cs

+1-44
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using System.Threading;
77
using System.Threading.Tasks;
88

9-
using Fido2NetLib.Cbor;
109
using Fido2NetLib.Exceptions;
1110
using Fido2NetLib.Objects;
1211

@@ -35,8 +34,6 @@ private AuthenticatorAssertionResponse(AuthenticatorAssertionRawResponse raw, Au
3534

3635
public byte[]? UserHandle => _raw.Response.UserHandle;
3736

38-
public byte[]? AttestationObject => _raw.Response.AttestationObject;
39-
4037
public static AuthenticatorAssertionResponse Parse(AuthenticatorAssertionRawResponse rawResponse)
4138
{
4239
return new AuthenticatorAssertionResponse(
@@ -174,46 +171,6 @@ public async Task<VerifyAssertionResult> VerifyAsync(
174171
if (authData.SignCount > 0 && authData.SignCount <= storedSignatureCounter)
175172
throw new Fido2VerificationException(Fido2ErrorCode.InvalidSignCount, Fido2ErrorMessages.SignCountIsLessThanSignatureCounter);
176173

177-
// 21. If response.attestationObject is present and the Relying Party wishes to verify the attestation then...
178-
if (AttestationObject is not null)
179-
{
180-
// ... perform CBOR decoding on attestationObject to obtain the attestation statement format fmt, and the attestation statement attStmt.
181-
var cborAttestation = (CborMap)CborObject.Decode(AttestationObject);
182-
string fmt = (string)cborAttestation["fmt"]!;
183-
var attStmt = (CborMap)cborAttestation["attStmt"]!;
184-
185-
// 1. Verify that the AT bit in the flags field of authData is set, indicating that attested credential data is included.
186-
if (!authData.HasAttestedCredentialData)
187-
throw new Fido2VerificationException(Fido2ErrorCode.AttestedCredentialDataFlagNotSet, Fido2ErrorMessages.AttestedCredentialDataFlagNotSet);
188-
189-
// 2. Verify that the credentialPublicKey and credentialId fields of the attested credential data in authData match credentialRecord.publicKey and credentialRecord.id, respectively.
190-
if (!Raw.Id.SequenceEqual(authData.AttestedCredentialData.CredentialId))
191-
throw new Fido2VerificationException(Fido2ErrorCode.InvalidAssertionResponse, "Stored credential id does not match id in attested credential data");
192-
193-
if (!storedPublicKey.SequenceEqual(authData.AttestedCredentialData.CredentialPublicKey.GetBytes()))
194-
throw new Fido2VerificationException(Fido2ErrorCode.InvalidAssertionResponse, "Stored public key does not match public key in attested credential data");
195-
196-
// 3. Determine the attestation statement format by performing a USASCII case-sensitive match on fmt against the set of supported WebAuthn Attestation Statement Format Identifier values. An up-to-date list of registered WebAuthn Attestation Statement Format Identifier values is maintained in the IANA "WebAuthn Attestation Statement Format Identifiers" registry [IANA-WebAuthn-Registries] established by [RFC8809].
197-
var verifier = AttestationVerifier.Create(fmt);
198-
199-
// 4. Verify that attStmt is a correct attestation statement, conveying a valid attestation signature, by using the attestation statement format fmt’s verification procedure given attStmt, authData and hash.
200-
(var attType, var trustPath) = await verifier.VerifyAsync(attStmt, AuthenticatorData, hash).ConfigureAwait(false);
201-
202-
// 5. If validation is successful, obtain a list of acceptable trust anchors (attestation root certificates or ECDAA-Issuer public keys)
203-
// for that attestation type and attestation statement format fmt, from a trusted source or from policy.
204-
// For example, the FIDO Metadata Service [FIDOMetadataService] provides one way to obtain such information, using the aaguid in the attestedCredentialData in authData.
205-
206-
MetadataBLOBPayloadEntry? metadataEntry = null;
207-
if (metadataService != null)
208-
metadataEntry = await metadataService.GetEntryAsync(authData.AttestedCredentialData.AaGuid, cancellationToken);
209-
210-
// while conformance testing, we must reject any authenticator that we cannot get metadata for
211-
if (metadataService?.ConformanceTesting() is true && metadataEntry is null && attType != AttestationType.None && fmt is not "fido-u2f")
212-
throw new Fido2VerificationException(Fido2ErrorCode.AaGuidNotFound, "AAGUID not found in MDS test metadata");
213-
214-
TrustAnchor.Verify(metadataEntry, trustPath);
215-
}
216-
217174
return new VerifyAssertionResult
218175
{
219176
Status = "ok",
@@ -225,7 +182,7 @@ public async Task<VerifyAssertionResult> VerifyAsync(
225182
}
226183

227184
/// <summary>
228-
/// If the devicePubKey extension was included on a navigator.credentials.get() call, then the below
185+
/// If the devicePubKey extension was included on a navigator.credentials.get() call, then the below
229186
/// verification steps are performed in the context of this step of § 7.2 Verifying an Authentication Assertion using
230187
/// these variables established therein: credential, clientExtensionResults, authData, and hash. Relying Party policy
231188
/// may specify whether a response without a devicePubKey is acceptable.

0 commit comments

Comments
 (0)