github.com/AliyunContainerService/cli@v0.0.0-20181009023821-814ced4b30d0/docs/reference/commandline/trust_key_generate.md (about)

     1  ---
     2  title: "key generate"
     3  description: "The key generate command description and usage"
     4  keywords: "key, notary, trust"
     5  ---
     6  
     7  <!-- This file is maintained within the docker/cli Github
     8       repository at https://github.com/docker/cli/. Make all
     9       pull requests against that repo. If you see this file in
    10       another repository, consider it read-only there, as it will
    11       periodically be overwritten by the definitive file. Pull
    12       requests which include edits to this file in other repositories
    13       will be rejected.
    14  -->
    15  
    16  # trust key generate
    17  
    18  ```markdown
    19  Usage:  docker trust key generate NAME
    20  
    21  Generate and load a signing key-pair
    22  
    23  Options:
    24        --dir string   Directory to generate key in, defaults to current directory
    25        --help         Print usage
    26  ```
    27  
    28  ## Description
    29  
    30  `docker trust key generate` generates a key-pair to be used with signing,
    31   and loads the private key into the local docker trust keystore.
    32  
    33  ## Examples
    34  
    35  ### Generate a key-pair
    36  
    37  ```bash
    38  $ docker trust key generate alice
    39  
    40  Generating key for alice...
    41  Enter passphrase for new alice key with ID 17acf3c:
    42  Repeat passphrase for new alice key with ID 17acf3c:
    43  Successfully generated and loaded private key. Corresponding public key available: alice.pub
    44  $ ls
    45  alice.pub
    46  
    47  ```
    48  
    49  The private signing key is encrypted by the passphrase and loaded into the docker trust keystore.
    50  All passphrase requests to sign with the key will be referred to by the provided `NAME`.
    51  
    52  The public key component `alice.pub` will be available in the current working directory, and can
    53  be used directly by `docker trust signer add`.
    54  
    55  Provide the `--dir` argument to specify a directory to generate the key in:
    56  
    57  ```bash
    58  $ docker trust key generate alice --dir /foo
    59  
    60  Generating key for alice...
    61  Enter passphrase for new alice key with ID 17acf3c:
    62  Repeat passphrase for new alice key with ID 17acf3c:
    63  Successfully generated and loaded private key. Corresponding public key available: alice.pub
    64  $ ls /foo
    65  alice.pub
    66  
    67  ```