Documentation
¶
Overview ¶
Package milenage provides the set of functions of MILENAGE algorithm set defined in 3GPP TS 35.205 and some helpers to be used during the authentication procedure.
Index ¶
- func ComputeOPc(k, op []byte) ([]byte, error)
- type Milenage
- func (m *Milenage) ComputeAll() error
- func (m *Milenage) ComputeRESStar(mcc, mnc string) ([]byte, error)
- func (m *Milenage) F1() ([]byte, error)
- func (m *Milenage) F1Star(sqn, amf []byte) ([]byte, error)
- func (m *Milenage) F2345() (res, ck, ik, ak []byte, err error)
- func (m *Milenage) F5Star() (aks []byte, err error)
- func (m *Milenage) GenerateAUTN() ([]byte, error)
- func (m *Milenage) GenerateAUTS() ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeOPc ¶
ComputeOPc is a helper that provides users to retrieve OPc value from the K and OP given.
Types ¶
type Milenage ¶
type Milenage struct { // K is a 128-bit subscriber key that is an input to the functions f1, f1*, f2, f3, f4, f5 and f5*. K []byte // 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*. OP []byte // OPc is a 128-bit value derived from OP and K and used within the computation of the functions. OPc []byte // RAND is a 128-bit random challenge that is an input to the functions f1, f1*, f2, f3, f4, f5 and f5*. RAND []byte // SQN is a 48-bit sequence number that is an input to either of the functions f1 and f1*. // (For f1* this input is more precisely called SQNMS.) SQN []byte // AMF is a 16-bit authentication management field that is an input to the functions f1 and f1*. AMF []byte // MACA is a 64-bit network authentication code that is the output of the function f1. MACA []byte // MACS is a 64-bit resynchronisation authentication code that is the output of the function f1*. MACS []byte // RES is a 64-bit signed response that is the output of the function f2. RES []byte // CK is a 128-bit confidentiality key that is the output of the function f3. CK []byte // IK is a 128-bit integrity key that is the output of the function f4. IK []byte // AK is a 48-bit anonymity key that is the output of either of the functions f5. AK []byte // AKS is a 48-bit anonymity key that is the output of either of the functions f5*. AKS []byte // RESStar or RES* is a 128-bit response that is used in 5G. RESStar []byte }
Milenage is a set of parameters used/generated in MILENAGE algorithm.
func NewWithOPc ¶
NewWithOPc initializes a new MILENAGE algorithm using OPc instead of OP.
func (*Milenage) ComputeAll ¶
ComputeAll fills all the fields in *Milenage struct.
func (*Milenage) ComputeRESStar ¶ added in v1.1.0
ComputeRESStar computes RESStar from serving network name, RAND and RES as described in A.4 RES* and XRES* derivation function, TS 33.501.
Note that this function should be called after all other calculations is done (to generate RAND and RES).
func (*Milenage) F1 ¶
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.
func (*Milenage) F1Star ¶
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.
Note that the AMF value should be zero to be compliant with the specification TS 33.102 6.3.3 (This method just computes with the given value).
func (*Milenage) F2345 ¶
F2345 takes key K and random challenge RAND, and returns response RES, confidentiality key CK, integrity key IK and anonymity key AK.
func (*Milenage) F5Star ¶
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.
func (*Milenage) GenerateAUTN ¶ added in v1.2.0
GenerateAUTN generates AUTN uing the current values in Milenage in the way described in 5.1.1.1, TS 33.105 and 6.3.2, TS 33.102.
func (*Milenage) GenerateAUTS ¶ added in v1.2.0
GenerateAUTS generates AUTS using the current values in Milenage in the way described in 5.1.1.3, TS 33.105 and 6.3.3, TS 33.102.
Note: MAC-S and AK-S are re-calculated with AMF=0x0000.