Home Explore Blog CI



nix

src/nix/key-convert-secret-to-public.md
c867aee515bbdd1b95c8f57b40e5ac341b66f303cda88623000000030000020e
R""(

# Examples

* Convert a secret key to a public key:

  ```console
  # echo cache.example.org-0:E7lAO+MsPwTFfPXsdPtW8GKui/5ho4KQHVcAGnX+Tti1V4dUxoVoqLyWJ4YESuZJwQ67GVIksDt47og+tPVUZw== \
    | nix key convert-secret-to-public
  cache.example.org-0:tVeHVMaFaKi8lieGBErmScEOuxlSJLA7eO6IPrT1VGc=
  ```

# Description

This command reads a Ed25519 secret key from standard input, and
writes the corresponding public key to standard output. For more
details, see [nix key generate-secret](./nix3-key-generate-secret.md).

)""

Chunks
15743664 (1st chunk of `src/nix/key-convert-secret-to-public.md`)
Title: nix key convert-secret-to-public: Convert Ed25519 Secret Key to Public Key
Summary
The `nix key convert-secret-to-public` command derives a public key from an Ed25519 secret key. This is a key operation in public-key cryptography, enabling secure communication. The command reads the secret key string from standard input, calculates the corresponding public key, and writes it to standard output. This tool is useful when you need to share a public key derived from a secret key without revealing the secret key itself. For instance, it might be used in setting up secure caches or verifying signatures. The output format is compatible with other Nix commands for managing binary caches. Refer to `nix key generate-secret` for more information on generating secret keys. This command ensures that you can easily obtain the public key equivalent of a secret key, facilitating security-related tasks within the Nix ecosystem, and provides a method for key management in secure environments.