milenage

package
v1.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	K_LEN            = 16
	OP_LEN           = 16
	OPC_LEN          = 16
	SQN_LEN          = 6
	RAND_LEN         = 16
	AMF_LEN          = 2
	MAC_LEN          = 8
	RES_LEN          = 8
	SRES_LEN         = 4
	KC_LEN           = 8
	CK_LEN           = 16
	IK_LEN           = 16
	AK_LEN           = 6
	AUTN_LEN         = 16
	AUTS_LEN         = 14
	CIPHER_BLOCK_LEN = 16
)

Variables

This section is empty.

Functions

func CutAUTN

func CutAUTN(autn []byte) ([]byte, []byte, []byte)

AUTN = (SQNms ^ AK) || AMF || MAC-A

func CutAUTS

func CutAUTS(auts []byte) ([]byte, []byte)

AUTS = (SQNms ^ AK-S) || MAC-S

func F2345 added in v1.3.3

func F2345(opc, k, _rand []uint8) (res, ck, ik, ak, akstar []byte, err error)

*

  • f2345 - Milenage f2, f3, f4, f5, f5* algorithms
  • @opc: OPc = 128-bit value derived from OP and K
  • @k: K = 128-bit subscriber key
  • @_rand: RAND = 128-bit random challenge
  • Returns:
  • @res: RES = 64-bit signed response (f2)
  • @ck: CK = 128-bit confidentiality key (f3)
  • @ik: IK = 128-bit integrity key (f4)
  • @ak: AK = 48-bit anonymity key (f5)
  • @akstar: AK = 48-bit anonymity key (f5*)

func GenerateAKAParameters

func GenerateAKAParameters(opc, k, rand, sqn, amf []byte) (ik, ck, xres, autn []byte, err error)

func GenerateAUTS

func GenerateAUTS(opc, k, rand, sqnms []byte) (auts []byte, err error)

func GenerateKeysWithAUTN

func GenerateKeysWithAUTN(opc, k, rand, autn []byte) (sqnhe, ak, ik, ck, res []byte, err error)

func GenerateOPc

func GenerateOPc(k, op []uint8) (opc []uint8, err error)

func GenerateOPcFromHex

func GenerateOPcFromHex(k, op string) (opc string, err error)

func ValidateAUTS

func ValidateAUTS(opc, k, rand, auts []byte) (sqnms []byte, err error)

Types

type MACFailureError

type MACFailureError struct {
	MACName     string
	ExpectedMAC []byte
	ExactMAC    []byte
}

func (*MACFailureError) Error

func (m *MACFailureError) Error() string

type ParameterLengthError

type ParameterLengthError struct {
	Name     string
	Exact    int
	Expected int
}

func (*ParameterLengthError) Error

func (e *ParameterLengthError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL