Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation on verifying app attest responses #401

Open
lol768 opened this issue Jun 15, 2023 · 2 comments
Open

Add documentation on verifying app attest responses #401

lol768 opened this issue Jun 15, 2023 · 2 comments
Assignees

Comments

@lol768
Copy link

lol768 commented Jun 15, 2023

@aseigler Is there any documentation covering how to use the support introduced in #322?

I appreciate the test is there, but AppleAppAttest is an internal class, as far as I can see, so none of the logic in the test classes is useful to someone using the library.

All of the other examples seem very web-oriented, for example I just have a Base64 blob from my iOS app - I have no idea what I'd pass to AssertionOptions.FromJson

@lol768
Copy link
Author

lol768 commented Jun 15, 2023

Also, I guess before trying to use this support, I need a release/NuGet package that ships it

@aseigler aseigler self-assigned this Jun 28, 2023
@dbeinder
Copy link
Contributor

dbeinder commented Jun 30, 2023

Please put trustPath and attestationType back into AttestationVerificationSuccess, and maybe even the entry of the metadata service.
Before the 4.0 refactoring, the attestation chain was available.

@lol768 for now, I access the attestation chain like this:

var attestation = AuthenticatorAttestationResponse.Parse(rawResponse).AttestationObject;
var verifier = AttestationVerifier.Create(attestation.Fmt);
var clientDataHash = SHA256.HashData(rawResponse.Response.ClientDataJson);
(var attType, var trustPath) = verifier.Verify(attestation.AttStmt, attestation.AuthData, clientDataHash);
Console.WriteLine($"Attestation Type: {attType}");
if (trustPath != null)
{
    for (var cn = 0; cn < trustPath.Length; cn++)
    {
        var cert = trustPath[cn];
        Console.WriteLine($"Attestation[{cn}] Subject: {cert?.Subject}");
        Console.WriteLine($"               Issuer:  {cert?.Issuer}");
        Console.WriteLine($"               Serial:  {cert?.SerialNumber}");
        Console.WriteLine($"               Valid:   {cert?.NotBefore:yyyy-MM-dd} - {cert?.NotAfter:yyyy-MM-dd}");
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants