Add support for Apple App Attestation statement decoding
See original GitHub issueIs your feature request related to a problem? Please describe.
Apple started to use WebAuthentication for their new App Attestation service:
Apple DeviceCheck documentation
Describe the solution you’d like
I got basic parsing to work by registering my own attestation statement format, and adding some overwrites to use a modified object converter. So it seems a first nice step would be to have the format as part of the library.
There are still some kinks and very deep details on how to validate the attestations and assertions, as a start parsing support would be a great addition for everyone looking to use this.
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.webauthn4j.data.attestation.statement.AttestationCertificatePath;
import com.webauthn4j.data.attestation.statement.CertificateBaseAttestationStatement;
import com.webauthn4j.validator.exception.ConstraintViolationException;
@JsonIgnoreProperties(value = "format")
@JsonTypeName(AppleAppAttestationStatement.FORMAT)
public class AppleAppAttestationStatement implements CertificateBaseAttestationStatement {
public static final String FORMAT = "apple-appattest";
@JsonProperty
private final AttestationCertificatePath x5c;
@JsonCreator
public AppleAppAttestationStatement(
@JsonProperty("x5c") AttestationCertificatePath x5c) {
this.x5c = x5c;
}
@Override
public AttestationCertificatePath getX5c() {
return x5c;
}
@Override
public String getFormat() {
return FORMAT;
}
@Override
public void validate() {
if (x5c == null) {
throw new ConstraintViolationException("x5c must not be null");
}
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
AppleAppAttestationStatement that = (AppleAppAttestationStatement) o;
return Objects.equals(x5c, that.x5c);
}
@Override
public int hashCode() {
int result = Objects.hash(x5c);
return result;
}
}
Overwrites to make this currently work:
cborMapper = new ObjectMapper(new CBORFactory());
// We added our own attestation type that is not yet part of the standard library
cborMapper.registerSubtypes(new NamedType(AppleAppAttestationStatement.class, AppleAppAttestationStatement.FORMAT));
authObjConverter = new ObjectConverter(new ObjectMapper(), cborMapper);
webAuthnManager = new WebAuthnManager(
Arrays.asList(
new AppleAppAttestationStatementValidator()
),
new NullCertPathTrustworthinessValidator(),
new NullSelfAttestationTrustworthinessValidator(),
authObjConverter
);
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Validating Apps That Connect to Your Server - Apple Developer
Overview. Adopt App Attest to check whether clients connecting to your server are valid instances of your app. Your app uses the shared...
Read more >PassKeys decoded attestation has no statement
Hi,. I'm decoding an attestationObject created with ASAuthorizationPlatformPublicKeyCredentialRegistration , but the results have no statement:
Read more >Preparing to Use the App Attest Service - Apple Developer
The App Attest service records device metrics that you can't reset. To avoid affecting the real metrics for devices that you use for...
Read more >Complying with Encryption Export Regulations
If your app requires export compliance documentation, upload the required items to App Store Connect, as described in Upload export compliance documentation.
Read more >App Attest | Apple Developer Forums
Hi, I am new to iOS development and currently studying App Attest functionality. Can someone confirm why the counter value be 0 during...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I will try to get you an example with all these details tomorrow.
Apple App Attest attestation support is now merged into master. https://github.com/webauthn4j/webauthn4j/pull/329