milenage

Java™ library designed to support 3GPP™ Milenage algorithm calculations according to 3GPP TS 35.206

License

License

GroupId

GroupId

com.github.brake.threegpp
ArtifactId

ArtifactId

milenage
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

milenage
Java™ library designed to support 3GPP™ Milenage algorithm calculations according to 3GPP TS 35.206
Project URL

Project URL

https://github.com/brake/milenage
Source Code Management

Source Code Management

https://github.com/brake/milenage

Download milenage

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.brake.threegpp/milenage/ -->
<dependency>
    <groupId>com.github.brake.threegpp</groupId>
    <artifactId>milenage</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.brake.threegpp/milenage/
implementation 'com.github.brake.threegpp:milenage:1.0.0'
// https://jarcasting.com/artifacts/com.github.brake.threegpp/milenage/
implementation ("com.github.brake.threegpp:milenage:1.0.0")
'com.github.brake.threegpp:milenage:jar:1.0.0'
<dependency org="com.github.brake.threegpp" name="milenage" rev="1.0.0">
  <artifact name="milenage" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.brake.threegpp', module='milenage', version='1.0.0')
)
libraryDependencies += "com.github.brake.threegpp" % "milenage" % "1.0.0"
[com.github.brake.threegpp/milenage "1.0.0"]

Dependencies

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

Milenage for Java

License: MIT GitHub version Maven Central Java version 1.7+

Java™ library designed to support 3GPP™ Milenage algorithm calculations according to 3GPP TS 35.206. Has written from scratch i.e. is not based on C sourse code from 3GPP™ TS 35.206 Annex 3.

Table of Contents

Features

  • OPc calculation based on OP and K

  • All Authentication and Key Generation fn functions including f1* and f5*

  • Algorithm customization with R and C constants

  • Implementation customization:

    There is a MilenageBuffer interface supporting all operations Milenage uses under the hood, like bit shift, XOR etc. You can provide your own implementation, but library offers default implementation based on BigInteger class. For cryptography purposes library uses Cipher object from javax.crypto package so you can use any ciphering algorithm having the buffer size 128 bits as well as "default" Rijndael.

  • You can choose method of invocation of Milenage functions:

    • call each function separetely

    • call a full set of functions at once, in this case a call of every function can be asynchronous.

      It's configurable through ExecutorService object.

Requirements

Java 1.7 or higher.

Download

Gradle

compile 'com.github.brake.threegpp:milenage:1.0.0'

Maven

<dependency>
  <groupId>com.github.brake.threegpp</groupId>
  <artifactId>milenage</artifactId>
  <version>1.0.0</version>
</dependency>

Usage

Basic

// 1. Create instance of MilenageBufferFactory<BigIntegerBuffer> interface by
//    instantiating BigIngegerBufferFactory object.
MilenageBufferFactory<BigIntegerBuffer> bufferFactory = BigIntegerBufferFactory.getInstance();

// 2. Create instance of javax.crypto.Cypher from a key
//    using a helper class threegpp.milenage.cipher.Ciphers.

Cipher cipher = Ciphers.createRijndaelCipher(keyBytes);

// 3. Create OPc value from OP bytes and K, represented by the
//    previously created Cipher object.

byte [] OPc = Milenage.calculateOPc(opBytes, cipher, bufferFactory);

// 4. Create the Milenage instance for `OPc` and Cipher instances with MilenageBufferFactory.

Milenage<BigIntegerBuffer> milenage = new Milenage<>(OPc, cipher, bufferFactory);

// 5. Use the Milenage instance with input data (RAND, SQN, AMF)

try {
    Map<MilenageResult, byte []> result = melenage.calculateAll(rand, sqn, amf, Executors.newCachedThreadPull);

} catch(InterruptedException | ExecutionExceprtion e) {
// handle exception
}

// 6. Use the result

useMacA(result.get(MilenageResult.MAC_A));
useMacS(result.get(MilenateResult.MAC_S));
useResponse(result.get(MilenageResult.RES));
useConfinentialityKey(result.get(MilenageResult.CK));
useIntegrityKey(result.get(MilenageResult.IK));
useAnonimityKey(result.get(MilenageResult.AK));
useResynchAnonimityKey(result.get(MilenageResult.AK_R))

You can see working example in test code.

Advanced Usage

TBD

Documentation

Javadoc

License

Copyright © 2015-2016 Constantin Roganov

Distributed under the MIT License.

Alternatives

  1. This project has a Milenage implementation (LGPL 2.1) Javadoc.

Versions

Version
1.0.0