GenerateDUKPT.java
Exemplo de geração de DUKPT.
- Veja Nota sobre os exemplos.
package doxy.examples;
public class GenerateDUKPT {
private static String strAddr = "10.0.62.47";
private static String strUsrId = "master";
private static String strPwd = "12345678";
private static int nPort = 4433;
private static String strBDK = "KSI_FFFF987654";
public static void main(String[] args) {
int nFlags = 0;
Dinamo api = new Dinamo();
try {
api.openSession(strAddr, strUsrId, strPwd, nPort, nFlags);
//Cleanup test
byte[] pbKSNKeyData = { (byte)0x01, (byte)0x23, (byte)0x45, (byte)0x67,
(byte)0x89, (byte)0xAB, (byte)0xCD, (byte)0xEF,
(byte)0xFE, (byte)0xDC, (byte)0xBA, (byte)0x98,
(byte)0x76, (byte)0x54, (byte)0x32, (byte)0x10 };
api.importKey( strBDK,
TacNDJavaLib.PLAINTEXTKEY_BLOB,
TacNDJavaLib.ALG_3DES_112,
TacNDJavaLib.EXPORTABLE_KEY,
pbKSNKeyData,
pbKSNKeyData.length );
byte[] baKSI = { (byte)0xFF, (byte)0xFF, (byte)0x98,
(byte)0x76, (byte)0x54 };
byte[] baDID_CTR = { (byte)0x32, (byte)0x10, (byte)0xE0,
(byte)0x00, (byte)0x01 };
String strDukpt = api.generateDUKPT( baKSI,
baDID_CTR,
TacNDJavaLib.NEW_DUKPT_MODE_DUK |
TacNDJavaLib.NEW_DUKPT_MODE_DE |
TacNDJavaLib.NEW_DUKPT_MODE_TMP);
System.out.println("DUKPT name: " + strDukpt);
api.closeSession();
} catch (TacException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
}