fabaccess-bffh/bffhd/authentication/fabfire/mod.rs

39 lines
974 B
Rust
Raw Permalink Normal View History

2022-03-16 19:29:36 +01:00
mod server;
pub use server::FabFire;
use rsasl::mechname::Mechname;
2023-02-09 17:07:22 +01:00
use rsasl::registry::{Matches, Mechanism, Named, Side, MECHANISMS};
2022-03-16 19:29:36 +01:00
const MECHNAME: &'static Mechname = &Mechname::const_new_unchecked(b"X-FABFIRE");
#[linkme::distributed_slice(MECHANISMS)]
2023-02-09 17:07:22 +01:00
pub static FABFIRE: Mechanism = Mechanism::build(
MECHNAME,
300,
None,
Some(FabFire::new_server),
Side::Client,
|_| Some(Matches::<Select>::name()),
|_| true,
);
struct Select;
impl Named for Select {
fn mech() -> &'static Mechanism {
&FABFIRE
}
}
2022-03-16 19:29:36 +01:00
2022-10-05 17:28:47 +02:00
use rsasl::property::SizedProperty;
use std::marker::PhantomData;
2022-10-05 17:28:47 +02:00
2022-03-16 19:29:36 +01:00
// All Property types must implement Debug.
#[derive(Debug)]
// The `PhantomData` in the constructor is only used so external crates can't construct this type.
pub struct FabFireCardKey(PhantomData<()>);
2022-10-05 17:28:47 +02:00
impl SizedProperty<'_> for FabFireCardKey {
type Value = [u8; 16];
const DESCRIPTION: &'static str = "A AES128 key for a FabFire card";
2022-03-16 19:29:36 +01:00
}