2017-10-09 13:44:52 -04:00
|
|
|
# trust key generate
|
2017-09-26 14:46:38 -04:00
|
|
|
|
2023-01-06 13:04:05 -05:00
|
|
|
<!---MARKER_GEN_START-->
|
2017-09-26 14:46:38 -04:00
|
|
|
Generate and load a signing key-pair
|
|
|
|
|
2023-01-06 13:04:05 -05:00
|
|
|
### Options
|
|
|
|
|
|
|
|
| Name | Type | Default | Description |
|
|
|
|
|:--------|:---------|:--------|:------------------------------------------------------------|
|
|
|
|
| `--dir` | `string` | | Directory to generate key in, defaults to current directory |
|
|
|
|
|
|
|
|
|
|
|
|
<!---MARKER_GEN_END-->
|
2017-09-26 14:46:38 -04:00
|
|
|
|
|
|
|
## Description
|
|
|
|
|
2017-10-09 13:44:52 -04:00
|
|
|
`docker trust key generate` generates a key-pair to be used with signing,
|
2023-12-13 09:16:56 -05:00
|
|
|
and loads the private key into the local Docker trust keystore.
|
2017-09-26 14:46:38 -04:00
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
### Generate a key-pair
|
|
|
|
|
2021-08-21 08:54:14 -04:00
|
|
|
```console
|
2017-10-09 13:44:52 -04:00
|
|
|
$ docker trust key generate alice
|
2017-09-26 14:46:38 -04:00
|
|
|
|
|
|
|
Generating key for alice...
|
|
|
|
Enter passphrase for new alice key with ID 17acf3c:
|
|
|
|
Repeat passphrase for new alice key with ID 17acf3c:
|
|
|
|
Successfully generated and loaded private key. Corresponding public key available: alice.pub
|
|
|
|
$ ls
|
|
|
|
alice.pub
|
|
|
|
```
|
|
|
|
|
2023-12-13 09:16:56 -05:00
|
|
|
The private signing key is encrypted by the passphrase and loaded into the Docker trust keystore.
|
2017-09-26 14:46:38 -04:00
|
|
|
All passphrase requests to sign with the key will be referred to by the provided `NAME`.
|
|
|
|
|
|
|
|
The public key component `alice.pub` will be available in the current working directory, and can
|
2017-10-09 13:44:52 -04:00
|
|
|
be used directly by `docker trust signer add`.
|
2017-10-25 13:45:10 -04:00
|
|
|
|
|
|
|
Provide the `--dir` argument to specify a directory to generate the key in:
|
|
|
|
|
2021-08-21 08:54:14 -04:00
|
|
|
```console
|
2017-10-25 13:45:10 -04:00
|
|
|
$ docker trust key generate alice --dir /foo
|
|
|
|
|
|
|
|
Generating key for alice...
|
|
|
|
Enter passphrase for new alice key with ID 17acf3c:
|
|
|
|
Repeat passphrase for new alice key with ID 17acf3c:
|
|
|
|
Successfully generated and loaded private key. Corresponding public key available: alice.pub
|
|
|
|
$ ls /foo
|
|
|
|
alice.pub
|
|
|
|
```
|