Skip to content

Commit 0d38438

Browse files
Jonas Hendrickxabergs
andauthored
Supporting attestation formats (#530)
* Attestation Formats * Add remark * Field should be property. * Collection expression * Remove formats from assertionOptions Assertion time attestation is removed from per this PR: https://github.com/w3c/webauthn/pull/1997/files --------- Co-authored-by: Anders Åberg <[email protected]>
1 parent e687bc6 commit 0d38438

File tree

3 files changed

+68
-1
lines changed

3 files changed

+68
-1
lines changed

Src/Fido2.Models/CredentialCreateOptions.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ public sealed class CredentialCreateOptions
4949
[JsonPropertyName("attestation")]
5050
public AttestationConveyancePreference Attestation { get; set; } = AttestationConveyancePreference.None;
5151

52+
/// <summary>
53+
/// This member is intended for use by Relying Parties that wish to select a preference regarding the attestation statement format used, if such an attestation is requested.
54+
/// </summary>
55+
/// <remarks>
56+
/// This parameter is advisory and the authenticator MAY use an attestation statement not enumerated in this parameter.
57+
/// </remarks>
58+
[JsonPropertyName("attestationFormats")]
59+
public IReadOnlyList<AttestationStatementFormatIdentifier> AttestationFormats { get; set; } = [];
60+
5261
/// <summary>
5362
/// This member is intended for use by Relying Parties that wish to select the appropriate authenticators to participate in the create() operation.
5463
/// </summary>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
using System.Runtime.Serialization;
2+
using System.Text.Json.Serialization;
3+
4+
namespace Fido2NetLib.Objects;
5+
6+
/// <summary>
7+
/// The attestation statement format identifier in WebAuthn specifies the format of the attestation statement that is used to attest to the authenticity of a credential created by a WebAuthn authenticator.
8+
/// https://www.iana.org/assignments/webauthn/webauthn.xhtml
9+
/// </summary>
10+
[JsonConverter(typeof(FidoEnumConverter<AttestationStatementFormatIdentifier>))]
11+
public enum AttestationStatementFormatIdentifier
12+
{
13+
/// <summary>
14+
/// The "packed" attestation statement format is a WebAuthn-optimized format for attestation. It uses a very compact but still extensible encoding method. This format is implementable by authenticators with limited resources (e.g., secure elements).
15+
/// </summary>
16+
[EnumMember(Value = "packed")]
17+
Packed,
18+
19+
/// <summary>
20+
/// The "TPM" attestation statement format returns an attestation statement in the same format as the packed attestation statement format, although the rawData and signature fields are computed differently.
21+
/// </summary>
22+
[EnumMember(Value = "tpm")]
23+
Tpm,
24+
25+
/// <summary>
26+
/// Platform authenticators on versions "N", and later, may provide this proprietary "hardware attestation" statement.
27+
/// </summary>
28+
[EnumMember(Value = "android-key")]
29+
AndroidKey,
30+
31+
/// <summary>
32+
/// Android-based platform authenticators MAY produce an attestation statement based on the Android SafetyNet API.
33+
/// </summary>
34+
[EnumMember(Value = "android-safetynet")]
35+
AndroidSafetyNet,
36+
37+
/// <summary>
38+
/// Used with FIDO U2F authenticators.
39+
/// </summary>
40+
[EnumMember(Value = "fido-u2f")]
41+
FidoU2f,
42+
43+
/// <summary>
44+
/// Used with Apple devices' platform authenticators.
45+
/// </summary>
46+
[EnumMember(Value = "apple")]
47+
Apple,
48+
49+
/// <summary>
50+
/// Used to replace any authenticator-provided attestation statement when a WebAuthn Relying Party indicates it does not wish to receive attestation information.
51+
/// </summary>
52+
[EnumMember(Value = "none")]
53+
None
54+
}
55+

Src/Fido2.Models/Objects/AuthenticationExtensionsDevicePublicKeyInputs.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
using System;
44
using System.Text.Json.Serialization;
55

6+
/// <summary>
7+
/// Deprecated: DevicePublickeyKey has been deprecated but is kept around in the code base because of conformance testing tools.
8+
/// </summary>
69
public sealed class AuthenticationExtensionsDevicePublicKeyInputs
710
{
811
[JsonPropertyName("attestation")]
912
public string Attestation { get; set; } = "none";
1013

1114
[JsonPropertyName("attestationFormats")]
12-
public string[] AttestationFormats { get; set; } = Array.Empty<string>();
15+
public IReadOnlyList<AttestationStatementFormatIdentifier> AttestationFormats { get; set; } = Array.Empty<AttestationStatementFormatIdentifier>();
1316
}

0 commit comments

Comments
 (0)