Linux command
age-keygen 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Generate
age-keygen
Save
age-keygen -o [key.txt]
Extract public key
age-keygen -y [key.txt]
Extract public key
age-keygen -y [~/.ssh/id_ed25519]
Generate
age-keygen -pq -o [key.txt]
说明
age-keygen generates X25519 key pairs for use with the age encryption tool. The private key (identity) is printed to stdout or written to a file, while the public key is included as a comment in the output. The generated keys are simple text strings: public keys start with "age1" and private keys start with "AGE-SECRET-KEY-1". The -y flag extracts the public key from an existing identity, useful for sharing your recipient without exposing the private key.
参数
- -o _file_
- Write key to file instead of stdout. Will not overwrite if file exists.
- -y _file_
- Read an identity file (or stdin) and output the corresponding public key (recipient). Works with age private keys and ed25519 SSH keys.
- -pq
- Generate hybrid post-quantum keys using ML-KEM-768 + X25519 (age v1.3.0+).
- --version
- Print version and exit.
FAQ
What is the age-keygen command used for?
age-keygen generates X25519 key pairs for use with the age encryption tool. The private key (identity) is printed to stdout or written to a file, while the public key is included as a comment in the output. The generated keys are simple text strings: public keys start with "age1" and private keys start with "AGE-SECRET-KEY-1". The -y flag extracts the public key from an existing identity, useful for sharing your recipient without exposing the private key.
How do I run a basic age-keygen example?
Run `age-keygen` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -o _file_ do in age-keygen?
Write key to file instead of stdout. Will not overwrite if file exists.