Hi everyone,
We are using the App Attest API to securely transition users to our new system. As part of this, we store the Key ID of the attestation key for each user to verify their identity later.
However, we’ve noticed that some users are encountering the error “DCErrorInvalidKey 3” when calling generateAssertion. Importantly, the key was previously successfully attested, and generateAssertion has worked before for these users.
Our questions:
Could this error be caused by an app or iOS update?
Is it problematic to link an attestation key's Key ID directly to a user, or are there scenarios where the key might change or become invalid?
If there’s a way to mitigate this issue or recover affected users, what best practices would you recommend?
Any help or shared experiences would be greatly appreciated! Thanks in advance.
App Attest
RSS for tagValidate the integrity of your app before your server provides access to sensitive data.
Posts under App Attest tag
26 Posts
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hi,
When calling generateAssertion on DCAppAttestService.shared, it gives invalidKey error when there was an update for an offloaded app.
The offloading and reinstall always works fine if it is the same version on app store that was offloaded from device,
but if there is an update and the app tries to reuse the keyID from previous installation for generateAssertion, attestation service rejects the key with error code 3 (invalid key) for a significant portion of our user.
In our internal testing it failed for more than a third of the update attempts.
STEPS TO REPRODUCE:
install v1 from app store
generate key using DCAppAttestService.shared.generateKey
Attest this key using DCAppAttestService.shared.attestKey
Send the attestation objection to our server and verify with apple servers
Generate assertions for network calls to backend using DCAppAttestService.shared.generateAssertion with keyID from step 2
Device offloads the app (manually triggered by user, or automatically by iOS)
A new version v2 is published to App Store
Use tries to open the app
Latest version is download from the App Store
App tries to use the keyID from step 2 to generate assertions
DCAppAttestService throws invalidKey error (Error Domain=com.apple.devicecheck.error Code=3)
Step 7 is critical here, if there is no new version of the app, the reinstalled v1 can reuse the key from step 2 without any issues
Is this behaviour expected?
Is there any way we can make sure the key is preserved between offloaded app updates?
Thanks
If an app has a text filtering extension and associated server that the iPhone OS communicates with, then how can that communication be authenticated?
In other words, how can the server verify that the request is valid and coming from the iPhone and not from some spoofer?
If somebody reverse engineers the associated domain urls our of the app's info.plist or entitlement files and calls the server url directly, then how can the server detect this has occurred and the request is not coming from the iPhone OS of a handset on which the app is installed?
The token is legitimate, however I keep getting bad requests (400). The payload may not be accurate.
No document with the appropriate payload structure is visible to me.
Receipt.bin was tried, but the file content could not be verified.
Referring this URL: https://developer.apple.com/documentation/devicecheck/assessing-fraud-risk
Here is my server side Java code:
private static String sendAttestationWithPayload(String jwt, String keyId,
String attestationData, String clientData) throws Exception {
// Create JSON payload
JSONObject payload = new JSONObject();
payload.put("keyId", keyId);
payload.put("attestationData", attestationData);
payload.put("clientData", clientData);
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(APPLE_ATTESTATION_URL))
.header("Authorization", "Bearer " + jwt)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(payload.toString()))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
handleResponse(response);
return response.body();
}
Hello,
I am getting the error : "This app cannot be installed because its integrity couldn't be verified" when the app is installed using Apple configurator.
The same .ipa works when deployed to app store.
I am using App Store Connect distribution provisioning profile type.
I want this .ipa to be deployed to multiple devices without having to add these devices to the provisioning profile list.
Any insights?
Thank you,
Prateek
I am getting issue on my application that my device is jailbroken security message I updated my device 18.2 what the solution