Skip to content

Key Operations Incompatible

URI: https://docs.ankatech.co/errors/key-ops-incompatible
HTTP Status: 422 Unprocessable Entity

When you see this

An authorization was declared over a key whose stored key operations (key_ops) do not permit one of the declared operations. It is returned when the authorization is created: an internal crypto use case (operation createInternalCryptoUseCase), a capability grant (createCapabilityGrant), or a grant of a Cryptographic Exchange (createExchangeGrant).

Each key reference is first checked for its state (Key State Not Admissible), then for what it can carry, in three checks: its purpose family (Key Purpose Incompatible), its algorithm (Key Algorithm Incompatible) and, last, its stored key operations, this one. Those two ask what the key can do; this one asks what the key was provisioned to be allowed to do. An encrypt-only key of an encrypt/decrypt algorithm passes both earlier checks and is refused here, at the time of the write, instead of at its first use.

The comparison is exact:

  • Each operation requires a fixed set of key operations: ENCRYPT requires encrypt, DECRYPT decrypt, SIGN sign, VERIFY verify, REENCRYPT encrypt and decrypt, RESIGN sign and verify. The interoperability, PKCS#7 analysis and key-export operations bind no tenant key and are not checked.
  • On a cross-kid authorization the requirement is narrowed by role: the SOURCE key of a REENCRYPT is asked for decrypt only and its TARGET for encrypt only; for RESIGN, the SOURCE for verify and the TARGET for sign. A SINGLE reference is asked for the whole set.
  • The key's operations are matched case-insensitively and verbatim, with no widening. A key whose key_ops is empty permits nothing.

The detail names the operation and the role of the reference that failed (SINGLE, SOURCE or TARGET), and nothing else about the key. Nothing was created.

Common Causes

  • DECRYPT or REENCRYPT declared over a key provisioned with key_ops ["encrypt"], such as an imported encrypt-only public key used as a SINGLE reference.
  • SIGN or RESIGN declared over a verification-only key.
  • On a cross-kid use case, the source and target were transposed, so each side is asked for the operation the other was provisioned for.

Response Example

{
  "type": "https://docs.ankatech.co/errors/key-ops-incompatible",
  "title": "Key Operations Incompatible",
  "status": 422,
  "detail": "Operation 'DECRYPT' is not permitted by the key operations the referenced key was provisioned with (role SINGLE). Reference a key provisioned for this operation, or provision one for it.",
  "instance": "/api/v3/admin/tenants/3f9a1b62-5d47-4c8e-b0a2-91d7e4f60cc5/capability-grants",
  "timestamp": 1763112600,
  "extensions": {
    "requestId": "c41e7b29-8d53-4a06-b9f2-5e0d3a7c1b84"
  }
}

Content-Type: application/problem+json — the response follows RFC 9457 Problem Details.

How to Resolve

  1. Read the detail: it names the refused operation and the role of the reference that failed.
  2. Read the key's key_ops and confirm it lacks the operation that role requires.
  3. Reference a key provisioned for the operation, or provision one for it.
  4. On a cross-kid authorization, confirm the source and target keys are the way round you intended before re-submitting.

For full schema definitions, examples, and interactive testing, see the Developer Hub Reference.