krb5_gss/lib.rs
1//! Pure Rust Kerberos protocol engine + krb5 GSS-API mechanism (initiator).
2//!
3//! This crate provides two major capabilities, both independent of any specific
4//! service (e.g. Kafka), and can be used standalone in any Kerberos KDC scenario:
5//!
6//! ## 1. Kerberos KDC Protocol Engine
7//!
8//! - [`KerberosCredentials`]: Pure Rust credential model (principal / service_name / keytab).
9//! - [`KerberosClient`]: KDC protocol state machine that communicates with KDC via
10//! [`KdcTransport`] to perform AS-REQ → AS-REP → TGS-REQ → TGS-REP, producing
11//! [`AcquiredTicket`] (service ticket + session key).
12//! - [`Krb5Client`]: High-level KDC client facade that holds credentials + transport
13//! for direct KDC access without needing to inject transport on every call.
14//! - [`KdcTransport`]: KDC transport contract; integrators implement it, or use the
15//! built-in [`TokioKdcTransport`].
16//! - [`TokioKdcTransport`]: Out-of-the-box KDC transport based on tokio `TcpStream`.
17//!
18//! ## 2. krb5 GSS-API Mechanism (initiator)
19//!
20//! - [`gss`] module: Implements krb5 GSS context (AP-REQ / AP-REP construction,
21//! GSS token wrapping, RFC 4121 WRAP, multi-round handshake) based on
22//! [`AcquiredTicket`], compatible with any SASL/GSSAPI server-first service
23//! (Kafka, LDAP, etc.).
24//! - [`gss::GssClient`]: High-level GSS facade combining KDC ticket acquisition + GSS
25//! context for single-call access. Pair with [`gss::GssContext::step`] for the
26//! standard GSS handshake loop compatible with any acceptor.
27//!
28//! Cryptography is built on RustCrypto primitives (`aes` / `cipher` / `hmac` / `sha1` / `sha2`)
29//! with zero FFI, enabling cross-compilation to any target. Network I/O is abstracted
30//! via the [`KdcTransport`] trait; the built-in [`TokioKdcTransport`] (tokio-based) can
31//! connect to a KDC directly, or integrators may implement the trait themselves.
32pub mod client;
33pub mod credentials;
34pub mod error;
35pub mod gss;
36pub mod kerberos;
37
38pub use client::Krb5Client;
39pub use credentials::KerberosCredentials;
40pub use error::{KerberosError, Result};
41pub use gss::GssClient;
42pub use kerberos::client::{AcquiredTicket, KerberosClient};
43pub use kerberos::crypto::Etype;
44#[cfg(feature = "tokio-transport")]
45pub use kerberos::transport::TokioKdcTransport;
46pub use kerberos::transport::{KdcBoxFuture, KdcTransport};