Skip to main content

puressh/
lib.rs

1#![cfg_attr(not(feature = "std"), no_std)]
2#![cfg_attr(not(feature = "ffi"), forbid(unsafe_code))]
3#![deny(rust_2018_idioms)]
4#![warn(missing_docs)]
5
6//! puressh — a pure-Rust SSH (Secure Shell) protocol library.
7//!
8//! Built on [`purecrypto`] for all cryptographic primitives, with no
9//! foreign code in the dependency tree.
10//!
11//! The crate is split along the layers of RFC 4251–4254:
12//!
13//! - [`mod@format`] — SSH wire format primitives (`mpint`, `string`, `name-list`).
14//! - [`transport`] — binary packet protocol, version exchange, KEX state machine.
15//! - [`kex`]      — key-exchange algorithms (`curve25519-sha256`, `ecdh-sha2-nistp*`).
16//! - [`cipher`]   — symmetric ciphers (`aes*-ctr`, `aes*-gcm`, `chacha20-poly1305`).
17//! - [`mac`]      — message authentication codes (`hmac-sha2-*`, `*-etm`).
18//! - [`hostkey`]  — host-key/signature algorithms (`ssh-ed25519`, `ecdsa-sha2-*`, `rsa-sha2-*`).
19//! - [`auth`]     — userauth (RFC 4252).
20//! - [`channel`]  — channels (RFC 4254).
21//! - [`key`]      — OpenSSH key file parsing and serialisation.
22//! - [`client`]   — high-level client API (feature `client`).
23//! - [`server`]   — high-level server API (feature `server`).
24//!
25//! [`purecrypto`]: https://crates.io/crates/purecrypto
26
27#[cfg(feature = "alloc")]
28extern crate alloc;
29
30pub mod auth;
31pub mod channel;
32pub mod cipher;
33pub mod error;
34pub mod format;
35pub mod hostkey;
36pub mod kex;
37pub mod key;
38pub mod mac;
39pub mod transport;
40
41#[cfg(feature = "alloc")]
42pub mod compress;
43
44#[cfg(feature = "std")]
45pub mod stream;
46
47#[cfg(feature = "client")]
48pub mod client;
49
50#[cfg(feature = "multichannel")]
51pub mod shared;
52
53#[cfg(feature = "server")]
54pub mod server;
55
56#[cfg(feature = "std")]
57pub mod sftp;
58
59#[cfg(feature = "std")]
60pub mod scp;
61
62#[cfg(feature = "std")]
63pub mod known_hosts;
64
65#[cfg(all(feature = "std", unix))]
66pub mod agent;
67
68// `forwarding` exposes both server-side handlers (DefaultDirectTcpipHandler,
69// DefaultAgentForwardHandler, DefaultX11ForwardHandler, …) AND the matching
70// client-side splice callbacks (splice_to_local_agent_callback, splice_to_
71// local_display_callback) used by the `ssh` binary's `-A` / `-X` flags. Gate
72// it on either feature so a client-only build still picks up the callbacks.
73#[cfg(all(feature = "std", any(feature = "client", feature = "server")))]
74pub mod forwarding;
75
76#[cfg(feature = "ffi")]
77pub mod ffi;
78
79pub use error::{Error, Result};