1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
use clap::{Parser, ValueEnum};
/// Generate an OpenSSH keypair.
///
/// Outputs the keys to `<name>.public` and `<name>.private`.
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
pub(crate) struct Args {
/// The type of key to generate.
///
/// Options are `ed25519-expanded`, `x25519`.
#[arg(long)]
pub(crate) key_type: KeyType,
/// The algorithm name. Only used if the key type is expanded-ed25519 or x25519.
///
/// If no algorithm is specified, it defaults to:
/// * `[email protected]` for ed25519-expanded keys
/// * `[email protected]` for x25519
#[arg(long)]
pub(crate) algorithm: Option<String>,
/// The comment.
#[arg(long)]
pub(crate) comment: Option<String>,
/// The output file name.
#[arg(long)]
pub(crate) name: String,
/// Whether to output a public key file.
#[arg(long)]
pub(crate) public: bool,
/// Whether to output a private key file.
#[arg(long)]
pub(crate) private: bool,
}
#[derive(Copy, Clone, Debug, PartialEq, ValueEnum)]
pub(crate) enum KeyType {
/// An Ed25519 key.
Ed25519,
/// A DSA key.
Dsa,
/// An expanded Ed25519 key.
ExpandedEd25519,
/// An X25519 key.
X25519,
}
|