# Signing keys

A signing key is an Ed25519 key pair. Seatify uses the private key to sign API responses, license files and artifacts. Your application embeds the public key and uses it to check each signature.

Signing keys belong to your account. One set of keys signs for all your products.

## Signing key properties

| Property | Description |
| --- | --- |
| Key ID | The ID of the key. Each signature names the key ID of the key that made it. |
| Algorithm | The signature algorithm. It is always Ed25519. |
| Public key | The key that your application embeds to check signatures. It is available as hex, Base64 and PEM. |
| Status | `Active` or `Retired`. See [Active and retired keys](#active-and-retired-keys). |
| Last used | The last time that the key signed something. Seatify updates this value at most once an hour. |

The private key never leaves Seatify. The public key is not a secret. It is safe to ship inside your application.

## Signed data

| Data | Signing key |
| --- | --- |
| License API responses | The key that the request names, or the active key when the request names no key. |
| Distribution API responses about a product or its releases | The key that the request names, or the active key when the request names no key. |
| [License files](../../license-api/licenses/check-out/) | The key that the request names, or the active key. The file names the key ID of its key. |
| Artifacts | The active key at the time of signing. See [Verifying files](../releases-and-artifacts/#verifying-files). |

These responses are not signed:

- The download redirects of the Distribution API. Your application checks the downloaded file with its SHA-256 and its signature instead.
- Every error response. That includes the response to a request that is not valid, fails authentication or goes over a rate limit.

Your application must trust a response only when its signature is valid.

## Signed responses

A signed response carries the signature in the `Seatify-Signature` header. The header also names the key ID and the algorithm.

The signature covers these values:

- the request method, and the path with its query string
- the host
- the date of the response
- the nonce
- a SHA-256 digest of the response body

Send a new random value in the `Seatify-Nonce` header with each request. Seatify returns the value and includes it in the signature. A recorded response then does not match a new request. If a request sends no nonce, the signature covers an empty nonce.

See [Verify signed responses](../../guides/signatures/verify-signed-responses/) for the exact steps.

## Key selection

By default, Seatify signs with the active key. A request can name a key in the `Seatify-Signing-Key` header. The value is the key ID. Seatify then signs with that key, even if the key is retired.

Always name the key that your application embeds. The application then keeps working after you rotate keys.

If the named key is not a key of your account, the request fails with the message "The signing key is not known." Seatify refuses the request before it makes any change. For example, a claim does not bind a device.

## Active and retired keys

Your account has one active key at a time. Seatify creates the first key when you create your account.

When you rotate keys, Seatify creates a new active key. The old active key becomes retired.

- A retired key still signs every request that names it. Installed copies of your application keep working.
- A request that names no key is signed with the new active key.
- New artifacts are signed with the new active key. Existing artifacts keep their signatures until you re-sign them.
- A signing key does not expire.

## Deletion

Deletion is permanent. After you delete a key, every request that names the key fails.

- The active key cannot be deleted. Rotate keys first.
- A key cannot be deleted while it signs artifacts. Re-sign these artifacts with the active key first.
- Delete a retired key only when no installed copy of your application names it. The last used time shows whether the key still signs.

## Related guides

- [Verify signed responses](../../guides/signatures/verify-signed-responses/) shows how your application checks a signature.
- [Rotate signing keys](../../guides/signatures/rotate-signing-keys/) shows how to ship a new public key before you retire the old key.
- [Offline validation](../../guides/offline-use/offline-validation/) shows how your application checks a signed license file without a network.

