Skip to main content

Module openssh

Module openssh 

Source
Expand description

OpenSSH Key Format Support

This module provides functionality to import and export Ed25519 keys in OpenSSH formats. Supports both public key format (ssh-ed25519) and private key format (OpenSSH private key).

§Examples

use chie_crypto::openssh::{SshPublicKey, SshPrivateKey};
use chie_crypto::signing::KeyPair;

// Generate a keypair
let keypair = KeyPair::generate();

// Export as SSH public key
let ssh_pub = SshPublicKey::from_ed25519(&keypair.public_key());
let ssh_pub_str = ssh_pub.to_string_with_comment("user@host");

// Parse SSH public key
let parsed = SshPublicKey::parse(&ssh_pub_str).unwrap();
assert_eq!(parsed.key_data, ssh_pub.key_data);

// Export as SSH private key
let ssh_priv = SshPrivateKey::from_ed25519(&keypair);
let pem = ssh_priv.to_pem();

Structs§

SshPrivateKey
SSH private key in OpenSSH format
SshPublicKey
SSH public key in OpenSSH format

Enums§

SshKeyError
SSH key format errors

Type Aliases§

SshKeyResult
Result type for SSH key operations