<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 11.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "DeviceCheck",
  "identifier" : "/documentation/DeviceCheck/DCError-swift.struct/invalidKey",
  "metadataVersion" : "0.1.0",
  "role" : "Type Property",
  "symbol" : {
    "kind" : "Type Property",
    "modules" : [
      "DeviceCheck"
    ],
    "preciseIdentifier" : "s:SC7DCErrorLeV10invalidKeySoAAVvpZ"
  },
  "title" : "invalidKey"
}
-->

# invalidKey

An error caused by a failed attempt to use the App Attest key.

```
static var invalidKey: DCError.Code { get }
```

## Discussion

You receive this error if something goes wrong with generating, retrieving, or using
an App Attest cryptographic key, when:

- You call [`attestKey(_:clientDataHash:completionHandler:)`](/documentation/DeviceCheck/DCAppAttestService/attestKey(_:clientDataHash:completionHandler:))
  for a key that’s already been attested.
- You call [`generateAssertion(_:clientDataHash:completionHandler:)`](/documentation/DeviceCheck/DCAppAttestService/generateAssertion(_:clientDataHash:completionHandler:))
  with an unattested key.
- The App Attest service rejects the key.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)