MCPcopy Index your code
hub / github.com/coreos/openssh-keys

github.com/coreos/openssh-keys @v0.6.5

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.6.5 ↗ · + Follow
83 symbols 106 edges 4 files 15 documented · 18%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

openssh-keys   Latest Version Docs Badge

A pure-Rust library to handle OpenSSH public keys.

openssh-keys can parse, print, and fingerprint OpenSSH public keys. It supports the following algorithms:

  • RSA
  • DSA
  • ECDSA (nistp256, nistp384, nistp521)
  • ED25519

It can construct RSA and DSA keys from their components using the PublicKey::from_rsa() and PublicKey::from_dsa() functions respectively.

Example

extern crate openssh_keys;

use std::{env, fs, io, path};
use std::io::BufRead;

fn main() {
    let home = env::home_dir().unwrap_or(path::PathBuf::from("/home/core/"));
    let pub_path = home.join(".ssh").join("id_rsa.pub");
    println!("Inspecting '{}':", pub_path.to_string_lossy());
    let file = fs::File::open(&pub_path).expect("unable to open RSA pubkey");
    let reader = io::BufReader::new(file);

    for (i, line) in reader.lines().enumerate() {
        let line = line.expect(&format!("unable to read key at line {}", i + 1));
        let pubkey = openssh_keys::PublicKey::parse(&line).expect("unable to parse RSA pubkey");
        println!(" * Pubkey #{} -> {}", i + 1, pubkey.to_fingerprint_string());
    }
}

Some more examples are available under examples.

Release process

Releases can be performed by creating a new release ticket and following the steps in the checklist there.

License

Licensed under either of

  • Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Core symbols most depended-on inside this repo

write_bytes
called by 9
src/writer.rs
read_bytes
called by 8
src/reader.rs
write_mpint
called by 7
src/writer.rs
read_mpint
called by 6
src/reader.rs
write_string
called by 3
src/writer.rs
read_string
called by 3
src/reader.rs
curvetype
called by 2
src/lib.rs
data
called by 2
src/lib.rs

Shape

Function 47
Method 30
Class 3
Enum 3

Languages

Rust100%

Modules by API surface

src/lib.rs67 symbols
src/writer.rs8 symbols
src/reader.rs7 symbols
examples/inspect_rsa.rs1 symbols

For agents

$ claude mcp add openssh-keys \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact