Skip to content

phoegasus/JDukpt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

JDukpt

A Java implementation of Dukpt.NET.

Table of contents

Introduction

This is a Java implementation of Dukpt.NET,

a C# implementation of the Derived Unique Key Per Transaction (DUKPT) process that's described in Annex A of ANS X9.24-2004.

For people who can't or won't pay 140$ for the ANS X9.24-2004 (and for those who do).

If you implement this in a different programming language, please consider sharing it with the community.

Java version support

Version Status
Java 1.6 and older ⚠️ Not tested ⚠️
Java 1.7 ✅ Functional ✅
Java 8 ✅ Functional ✅
Java 9 ✅ Functional ✅
Java 10 ✅ Functional ✅
Java 11 ✅ Functional ✅
Java 12 and newer ⚠️ Not tested ⚠️

How to use

Instanciate the JDukpt class and call the appropriate method.

JDukpt jdukpt = new JDukpt();

jdukpt.generateIpek(bdk, ksn);

jdukpt.derivePINEncryptionKey(bdk, ksn);
jdukpt.deriveDataEncryptionKey(bdk, ksn);

jdukpt.encryptPIN(bdk, ksn, data);
jdukpt.decryptPIN(bdk, ksn, encryptedData);
jdukpt.encryptData(bdk, ksn, data);
jdukpt.decryptData(bdk, ksn, encryptedData);

The parameters and return value are either String, byte[], or BigInteger.

You can provide your own DES and 3DES implementation by implementing the Crypto interface, and providing it as an argument to the JDukpt constructor.

Crypto crypto = new MyCryptoImpl();

JDukpt jdukpt = new JDukpt(crypto);