Skip to main content

generate

Function generate 

Source
pub fn generate(
    output_path: &Path,
    bits: u32,
    comment: Option<&str>,
) -> Result<GeneratedKey>
Expand description

Generate an RSA SSH key pair

§Arguments

  • output_path - Path where the private key will be written
  • bits - Key size in bits (2048-16384)
  • comment - Optional comment to include in the public key

§Returns

Returns GeneratedKey containing the private key, public key, and fingerprint

§Errors

Returns an error if:

  • Key size is less than 2048 bits
  • Key size exceeds 16384 bits
  • Key generation fails