Skip to content

Commit

Permalink
Add API docs on Transit X.509 certificates (hashicorp#22998)
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Scheel <[email protected]>
  • Loading branch information
cipherboy authored Sep 12, 2023
1 parent b583ab9 commit 2174202
Showing 1 changed file with 81 additions and 0 deletions.
81 changes: 81 additions & 0 deletions website/content/api-docs/secret/transit.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,85 @@ $ curl \
http://127.0.0.1:8200/v1/transit/keys/my-key/rotate
```

## Sign CSR

This endpoint signs a CSR with the `:name` key, allowing the key material
never to leave Transit. If no template CSR is specified, an empty CSR is
signed, otherwise, a copy of the specified CSR with key material replaced
with this key material is signed.

| Method | Path |
| :----- | :------------------------ |
| `POST` | `/transit/keys/:name/csr` |

### Parameters

- `name` `(string: <required>)` - Specifies the name of the key to
sign the CSR with. This is specified as part of the URL.

- `version` `(string: "")` - Specifies the version of the CSR key to
use for signing. If the version is set to `latest` or is not set,
the current key will be returned.

- `csr` `(string: "")` - Optional PEM-encoded CSR template to use
as a basis for the new CSR signed by this key. If not set, an empty
CSR is used.

### Sample request

```shell-session
$ curl \
--header "X-Vault-Token: ..." \
--request POST \
http://127.0.0.1:8200/v1/transit/keys/my-key/csr
```

### Sample response

```json
{
"data": {
"name": "my-key",
"version": 1,
"csr": "-----BEGIN ..."
}
}
```

## Set Certificate Chain

This endpoint sets the certificate chain associated with the `:name` key,
allowing the key material never to leave Transit and for certificates to
be tracked in a single mount. Note that this allows updating and rotating
the chain as it will overwrite any previously set certificate chain.

| Method | Path |
| :----- | :------------------------------------ |
| `POST` | `/transit/keys/:name/set-certificate` |

### Parameters

- `name` `(string: <required>)` - Specifies the name of the key to
import the certificate chain against. This is specified as part of the
URL.

- `version` `(string: "")` - Specifies the version of the key to import the
chain against. If the version is set to `latest` or is not set, the current
key will be returned.

- `certificate_chain` `(string: "")` - Optional PEM-encoded CSR template to use
as a basis for the new CSR signed by this key. If not set, an empty
CSR is used.

### Sample request

```shell-session
$ curl \
--header "X-Vault-Token: ..." \
--request POST \
http://127.0.0.1:8200/v1/transit/keys/my-key/set-certificate
```

## Securely export key

This endpoint returns a wrapped copy of the `source` key, protected by the
Expand Down Expand Up @@ -582,6 +661,8 @@ be valid.
- `hmac-key`
- `public-key`, to return the corresponding public keys of private key
asymmetric keys (EC with NIST P-curves or Ed25519 and RSA).
- `certificate-chain`, to return the imported certificate chain (via
`set-certificate`) corresponding to this key and version.

- `name` `(string: <required>)` – Specifies the name of the key to read
information about. This is specified as part of the URL.
Expand Down

0 comments on commit 2174202

Please sign in to comment.