github.com/khulnasoft/cli@v0.0.0-20240402070845-01bcad7beefa/docs/reference/commandline/trust_key_generate.md (about)

     1  # trust key generate
     2  
     3  <!---MARKER_GEN_START-->
     4  Generate and load a signing key-pair
     5  
     6  ### Options
     7  
     8  | Name    | Type     | Default | Description                                                 |
     9  |:--------|:---------|:--------|:------------------------------------------------------------|
    10  | `--dir` | `string` |         | Directory to generate key in, defaults to current directory |
    11  
    12  
    13  <!---MARKER_GEN_END-->
    14  
    15  ## Description
    16  
    17  `docker trust key generate` generates a key-pair to be used with signing,
    18   and loads the private key into the local Docker trust keystore.
    19  
    20  ## Examples
    21  
    22  ### Generate a key-pair
    23  
    24  ```console
    25  $ docker trust key generate alice
    26  
    27  Generating key for alice...
    28  Enter passphrase for new alice key with ID 17acf3c:
    29  Repeat passphrase for new alice key with ID 17acf3c:
    30  Successfully generated and loaded private key. Corresponding public key available: alice.pub
    31  $ ls
    32  alice.pub
    33  ```
    34  
    35  The private signing key is encrypted by the passphrase and loaded into the Docker trust keystore.
    36  All passphrase requests to sign with the key will be referred to by the provided `NAME`.
    37  
    38  The public key component `alice.pub` will be available in the current working directory, and can
    39  be used directly by `docker trust signer add`.
    40  
    41  Provide the `--dir` argument to specify a directory to generate the key in:
    42  
    43  ```console
    44  $ docker trust key generate alice --dir /foo
    45  
    46  Generating key for alice...
    47  Enter passphrase for new alice key with ID 17acf3c:
    48  Repeat passphrase for new alice key with ID 17acf3c:
    49  Successfully generated and loaded private key. Corresponding public key available: alice.pub
    50  $ ls /foo
    51  alice.pub
    52  ```