Expand description
OpenSSH key generation, loading, and fingerprinting.
Pure-Rust via the [ssh-key] crate. Generated keys are written in the
standard OpenSSH private-key format (PEM-armored, PKCS#8-style) and the
accompanying public key in the single-line authorized_keys format.
§Examples
use std::path::Path;
use gitway_lib::keygen::{KeyType, generate, write_keypair};
let key = generate(KeyType::Ed25519, None, "user@host").unwrap();
write_keypair(&key, Path::new("/tmp/id_ed25519"), None).unwrap();§Errors
All operations return GitwayError. Cryptographic failures (RNG,
encryption) and I/O failures are both folded into that type; the caller
distinguishes via the is_* predicates.
§Zeroization
ssh_key::PrivateKey holds its secret scalar inside a type that
zeroes itself on drop. Passphrase material supplied to
write_keypair and change_passphrase is passed by reference
wrapped in Zeroizing so the caller retains ownership of the
zeroization lifecycle.
Enums§
- KeyType
- The set of key algorithms
gitway keygencan produce.
Functions§
- change_
passphrase - Changes (or adds, or removes) the passphrase on an existing OpenSSH private key.
- extract_
public - Extracts the public key from a private-key file and writes it to
out. - fingerprint
- Returns the OpenSSH-style fingerprint string for a public key.
- generate
- Generates a new keypair of the requested type.
- write_
keypair - Writes a keypair to disk.