# Approving and Revoking Certificates

_Peios / Using Peios / Certificate Authority_

> As an officer of a CA, find held requests, approve or deny them, and revoke certificates that are not to be trusted.

Approve and revoke certificates when a CA holds requests for an officer, or
when a certificate's key is lost or its holder leaves. These are an
officer's tasks: they need the Officer right in the CA's descriptor, which
Administrators hold by default.

## Before you start

- Sign in as an officer of the CA.

`pki ca show "Home Issuing"` lists your rights at the CA under Your access.

## Make someone an officer

Officers are named in the CA's descriptor. Someone with Manage CA at the CA
can change it. To let the group Lab Officers approve and revoke, while
everyone signed in can still request and Administrators keep every right:

```sh
pki ca set-security "Home Issuing" "D:(A;;0x2;;;AU)(A;;0x5;;;S-1-5-21-1-2-3-1105)(A;;0xf;;;BA)(A;;0xf;;;SY)"
```

In the Certificate Authority window, open the CA's page and choose
**Edit…** under **Permissions**, which opens the permissions editor with
these rights by name.

The descriptor replaces the one the CA had, so include every grant it
should keep. Grant `0x4` (Issue and Manage Certificates) and `0x8` (Manage
CA) only to people you trust to issue any certificate. `pki` warns you if
the descriptor lets a broad group approve or manage, or leaves you without
Manage CA. `pki(8)` lists the rights.

## Approve or deny held requests

1. List the requests waiting for an officer:

   ```sh
   pki request list "Home Issuing" --status pending
   ```

   Each is listed with its number, template, when it was submitted, and the
   names it asks for.

2. Look at a request in full, including who submitted it and why it was
   held:

   ```sh
   pki request show "Home Issuing" 42
   ```

3. Approve it, which issues the certificate:

   ```sh
   pki request approve "Home Issuing" 42
   ```

   Or deny it, recording why:

   ```sh
   pki request deny "Home Issuing" 42 --reason "not a lab machine"
   ```

You can't approve a request you submitted yourself; another officer has to.
pkid checks an approved request again as its requester, so approving it
issues only what the requester was allowed to ask for, whatever the
officer's own rights.

The requester then collects the certificate, as described in
[Requesting a Certificate](/peios/using-peios/certificate-authority/requesting-a-certificate.md).

### With the Certificate Authority window

Open **Requests**. Requests waiting for an officer are listed first, each
with **Approve** and **Details**. **Deny…** on a request's page asks for an
optional reason. The window shows your own requests without these, with why:
another officer has to decide them.

## Revoke a certificate

1. Find the certificate's serial number:

   ```sh
   pki cert list "Home Issuing"
   ```

2. Revoke it, with the reason, such as `key-compromise` for a key that was
   exposed or `superseded` for one that was replaced:

   ```sh
   pki cert revoke "Home Issuing" 4f1a09 --reason key-compromise
   ```

A revocation can't be undone. pkid records it with its reason, the time, and
the officer who made it. `pki(8)` lists every reason.

In the Certificate Authority window, open the certificate from
**Certificates** and choose **Revoke…**, then the reason.

Software learns of the revocation from the CA's revocation list. pkid
publishes a new list at once for a CA whose key it keeps. For a CA whose key
is in a sealed file, `pki` reminds you to publish one with
`pki ca publish-crl`, as described in
[Publishing Revocation Lists](/peios/using-peios/certificate-authority/publishing-revocation-lists.md).

## Check the result

Show the certificate:

```sh
pki cert show "Home Issuing" 4f1a09
```

Its state is `revoked`, with when, why, and by whom. A request you approved
or denied leaves the list that `pki request list "Home Issuing" --status
pending` prints.

Related content:

- [The Certificate Authority](/peios/using-peios/certificate-authority/overview.md)
- [Publishing Revocation Lists](/peios/using-peios/certificate-authority/publishing-revocation-lists.md)
- [Requesting a Certificate](/peios/using-peios/certificate-authority/requesting-a-certificate.md)
- [Controlling Who Can Request Certificates](/peios/using-peios/certificate-authority/controlling-who-can-request-certificates.md)
