11 unstable releases (3 breaking)

0.3.6 Dec 23, 2020
0.3.5 Jun 13, 2020
0.3.4 May 24, 2020
0.2.0 May 10, 2020
0.0.2 May 1, 2020

#1373 in Cryptography

Download history 39/week @ 2023-12-11 107/week @ 2023-12-18 19/week @ 2023-12-25 28/week @ 2024-01-01 87/week @ 2024-01-08 123/week @ 2024-01-15 104/week @ 2024-01-22 96/week @ 2024-01-29 73/week @ 2024-02-05 54/week @ 2024-02-12 54/week @ 2024-02-19 80/week @ 2024-02-26 97/week @ 2024-03-04 76/week @ 2024-03-11 45/week @ 2024-03-18 79/week @ 2024-03-25

300 downloads per month
Used in 4 crates (3 directly)

AGPL-3.0

135KB
3.5K SLoC

Kerbeiros

Kerberos client

Concepts

  • KDC (Key Distribution Center): Service that distributes the tickets. The host that provides this server is also called KDC.
  • TGS (Ticket Granting Server): Ticket used to authenticate the user against a specified service.
  • TGT (Ticket Granting Ticket): Ticket used to retrieve the TGS's from the KDC.

Examples

Asking for a TGT:

use kerbeiros::*;
use ascii::AsciiString;
use std::net::*;

// Prepare the arguments
let realm = AsciiString::from_ascii("CONTOSO.COM").unwrap();
let kdc_address = IpAddr::V4(Ipv4Addr::new(192, 168, 0, 1));
let username = AsciiString::from_ascii("Bob").unwrap();
let user_key = Key::Password("S3cr3t".to_string());

// Request the TGT
let tgt_requester = TgtRequester::new(realm, kdc_address);
let credential = tgt_requester.request(&username, Some(&user_key)).unwrap();

// Save the ticket into a Windows format file
credential.save_into_krb_cred_file("bob_tgt.krb").unwrap();

// Save the ticket into a Linux format file
credential.save_into_ccache_file("bob_tgt.ccache").unwrap();

Development

Code style

Follow the rustfmt code style.

To format code:

cargo fmt

Test

To run tests:

cargo test

References


lib.rs:

Kerberos crypto

Library to implement the cryptographic algorithms involved in the kerberos protocol.

The library provides different ciphers. The ciphers are classes which implements the diferent algorithms. All of them implement the KerberosCipher trait.

Supported algorithms

  • RC4-HMAC
  • AES128-CTS-HMAC-SHA1-96
  • AES256-CTS-HMAC-SHA1-96

Dependencies

~6MB
~91K SLoC