Struct milenage::Milenage

source ·
pub struct Milenage {
    pub ak: Option<[u8; 6]>,
    pub ck: Option<[u8; 16]>,
    pub ik: Option<[u8; 16]>,
    pub k: [u8; 16],
    pub maca: Option<[u8; 8]>,
    pub macs: Option<[u8; 8]>,
    pub op: Option<[u8; 16]>,
    pub opc: [u8; 16],
    pub res: Option<[u8; 8]>,
    pub res_star: Option<[u8; 16]>,
}
Expand description

Milenage instance

Fields§

§ak: Option<[u8; 6]>

AK is a 48-bit anonymity key that is the output of either of the functions f5.

§ck: Option<[u8; 16]>

CK is a 128-bit confidentiality key that is the output of the function f3.

§ik: Option<[u8; 16]>

IK is a 128-bit integrity key that is the output of the function f4.

§k: [u8; 16]

K is a 128-bit subscriber key that is an input to the functions f1, f1*, f2, f3, f4, f5 and f5*.

§maca: Option<[u8; 8]>

MACA is a 64-bit network authentication code that is the output of the function f1.

§macs: Option<[u8; 8]>

MACS is a 64-bit resynchronisation authentication code that is the output of the function f1*.

§op: Option<[u8; 16]>

OP is a 128-bit Operator Variant Algorithm Configuration Field that is a component of the functions f1, f1*, f2, f3, f4, f5 and f5*.

§opc: [u8; 16]

OPc is a 128-bit value derived from OP and K and used within the computation of the functions.

§res: Option<[u8; 8]>

RES is a 64-bit signed response that is the output of the function f2.

§res_star: Option<[u8; 16]>

RES* is a 128-bit response that is used in 5G.

Implementations§

source§

impl Milenage

source

pub fn new_with_op(k: [u8; 16], op: [u8; 16]) -> Milenage

Returns a new initialized Milenage from K and OP

source

pub fn new_with_opc(k: [u8; 16], opc: [u8; 16]) -> Milenage

Returns a new initialized Milenage from K and OPc

source

pub fn f1(&mut self, rand: &[u8; 16], sqn: &[u8; 6], amf: &[u8; 2]) -> [u8; 8]

F1 is the network authentication function. F1 computes network authentication code MAC-A from key K, random challenge RAND, sequence number SQN and authentication management field AMF.

source

pub fn f1star( &mut self, rand: &[u8; 16], sqn: &[u8; 6], amf: &[u8; 2] ) -> [u8; 8]

F1Star is the re-synchronisation message authentication function. F1Star computes resynch authentication code MAC-S from key K, random challenge RAND, sequence number SQN and authentication management field AMF.

source

pub fn f2345( &mut self, rand: &[u8; 16] ) -> ([u8; 8], [u8; 16], [u8; 16], [u8; 6])

F2345 takes key K and random challenge RAND, and returns response RES, confidentiality key CK, integrity key IK and anonymity key AK.

source

pub fn f5star(&mut self, rand: &[u8; 16]) -> [u8; 6]

F5Star is the anonymity key derivation function for the re-synchronisation message. F5Star takes key K and random challenge RAND, and returns resynch anonymity key AK.

source

pub fn compute_res_star( &mut self, mcc: &str, mnc: &str, rand: &[u8; 16], res: &[u8; 8] ) -> Result<[u8; 16], String>

Computes RESStar from serving network name, RAND and RES as described in A.4 RES* and XRES* derivation function, TS 33.501.

Trait Implementations§

source§

impl Debug for Milenage

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Milenage

source§

fn default() -> Milenage

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.