Expand description
§ryke
A clean-room IKEv2 / IKE implementation in Rust — ryke = Rust + IKE.
It implements both sides independently: a client (Role::Initiator)
that starts exchanges and a server (Role::Responder) that answers them.
The protocol is built from the RFCs; it does not wrap OpenSSL or any existing
IKE/IPsec daemon, and copies no third-party code.
§Scope & architecture
- Control plane (this crate): UDP 500/4500, message framing, exchange state machines, crypto + key schedule, and authentication (certificate and EAP-MSCHAPv2 for native iOS/Android clients on the server side).
- Data plane: a userspace ESP implementation in Rust (AES-GCM).
rykeencrypts/decrypts the tunneled packets itself — it does not use the OS kernel’s IPsec stack, and no external software is involved. The library moves packets you hand it (viaTunnel, or the lower-levelEspSa/ChildSa); capturing a machine’s real traffic (e.g. a TUN device) is the consumer’s job, deliberately out of scope.
§What works today
- Message framing: header + generic payload chain (RFC 7296 §3.1–3.2).
- Payloads: Security Association (proposals/transforms), Key Exchange, Nonce.
- Crypto core for
IKE_SA_INIT: X25519 (RFC 7748), HMAC-SHA256 PRF (RFC 4231),prf+, and the SKEYSEED / SK_* key schedule (§2.13–2.14).
See docs/implementation-plan.md for the milestone roadmap.
Re-exports§
pub use ikev2::client::Client;pub use crypto::derive_child_keys;pub use crypto::derive_session_keys;pub use crypto::prf;pub use crypto::prf_plus;pub use crypto::ChildKeys;pub use crypto::DhGroup;pub use crypto::KeyLengths;pub use crypto::SessionKeys;pub use ikev2::eap_auth::EapEvent;pub use ikev2::eap_auth::EapInitiator;pub use ikev2::eap_auth::EapResponder;pub use ikev2::eap_auth::ServerAuth;pub use ikev2::eap_auth::ServerVerify;pub use entropy::Entropy;pub use entropy::SeedEntropy;pub use error::IkeError;pub use esp::ChildSa;pub use esp::EspSa;pub use ikev2::exchange::default_offer;pub use ikev2::exchange::initiator_complete;pub use ikev2::exchange::initiator_request;pub use ikev2::exchange::responder_respond;pub use ikev2::exchange::responder_respond_natt;pub use ikev2::exchange::CompletedSaInit;pub use ikev2::exchange::CookiePolicy;pub use ikev2::exchange::LocalSecret;pub use ikev2::exchange::SaInitResult;pub use ikev2::natt::is_ike_on_4500;pub use ikev2::natt::unwrap_ike_4500;pub use ikev2::natt::wrap_ike_4500;pub use ikev2::natt::NON_ESP_MARKER;pub use ikev2::informational::build_informational;pub use ikev2::informational::dpd_request;pub use ikev2::informational::open_informational;pub use ikev2::rekey::responder_process_rekey;pub use ikev2::ike_rekey::is_ike_sa_rekey;pub use ikev2::ike_rekey::responder_process_ike_rekey;pub use ikev2::ike_auth::client_sent_certreq;pub use ikev2::ike_auth::esp_offer;pub use ikev2::ike_auth::initiator_auth_request;pub use ikev2::ike_auth::initiator_eap_request;pub use ikev2::ike_auth::initiator_verify_auth;pub use ikev2::ike_auth::is_eap_request;pub use ikev2::ike_auth::peer_id_from_auth;pub use ikev2::ike_auth::peer_id_from_request;pub use ikev2::ike_auth::responder_process_auth;pub use ikev2::ike_auth::AssignedConfig;pub use ikev2::ike_auth::AuthConfig;pub use ikev2::ike_auth::LocalAuth;pub use ikev2::ike_auth::PeerAuth;pub use ikev2::message::payloads;pub use ikev2::message::ExchangeType;pub use ikev2::message::Flags;pub use ikev2::message::IkeHeader;pub use ikev2::message::MessageBuilder;pub use ikev2::message::PayloadIter;pub use ikev2::message::PayloadType;pub use ikev2::message::RawPayload;pub use ikev2::negotiate::ChosenSuite;pub use ikev2::auth::initiator_signed_octets;pub use ikev2::auth::psk_auth;pub use ikev2::auth::responder_signed_octets;pub use ikev2::payload::cfg_type;pub use ikev2::payload::config_attr;pub use ikev2::payload::notify_type;pub use ikev2::payload::Authentication;pub use ikev2::payload::CertRequest;pub use ikev2::payload::Certificate;pub use ikev2::payload::ConfigAttr;pub use ikev2::payload::Configuration;pub use ikev2::payload::Delete;pub use ikev2::payload::Identification;pub use ikev2::payload::KeyExchange;pub use ikev2::payload::Nonce;pub use ikev2::payload::Notify;pub use ikev2::payload::Proposal;pub use ikev2::payload::SecurityAssociation;pub use ikev2::payload::TrafficSelector;pub use ikev2::payload::TrafficSelectors;pub use ikev2::payload::Transform;pub use ikev2::sign::SigningKey;pub use ikev2::sign::VerifyingKey;pub use role::Role;pub use ikev2::sk::build_encrypted_gcm;pub use ikev2::sk::open_encrypted_gcm;pub use ikev2::server::Server;pub use ikev2::server::ServerEvent;pub use transport::DriverError;pub use transport::UdpTransport;pub use tunnel::Tunnel;pub use entropy::OsEntropy;
Modules§
- crypto
- Cryptographic core for
IKE_SA_INIT(M1): X25519 Diffie-Hellman, the HMAC-SHA256 PRF,prf+(RFC 7296 §2.13), and the SKEYSEED / SK_* key schedule (§2.14). - entropy
- Randomness for ephemeral keys, nonces, and SPIs.
- error
- esp
- Userspace ESP (RFC 4303) in tunnel mode with AES-256-GCM (RFC 4106).
- ikev1
- IKEv1 (RFC 2409 / ISAKMP RFC 2408) — a self-contained implementation for the Aggressive Mode + Xauth + Mode-Config + Quick Mode flow that Android’s built-in “IPSec Xauth PSK” client (Android ≤ 10) uses.
- ikev2
- IKEv2 (RFC 7296) — the full initiator/responder implementation: framing, PSK + certificate (RFC 7427) + EAP-MSCHAPv2 auth, NAT-T, fragmentation, rekey, DELETE/DPD, and MOBIKE. Built on the shared crypto core at the crate root (crypto, esp, tunnel, transport, error, entropy, role).
- role
- The role an endpoint plays in an IKEv2 exchange.
- transport
- UDP transport for IKE messages.
- tunnel
- The ESP data-plane driver.