Integrations

Integration of applications ready for 400TR to 330TR.

Libs

For 330TR add the libs below.

Manifest

330TR:

<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>

KMS

400TR: new CtKMS2System().checkKey(VersionParams.keyset, 0);

330TR: kms.checkKeyExist(VersionParams.tpk);

Service Binding:

kms = new TokenKMS();
kms.init(getApplicationContext(), new KMSWrapperInterface.InitCallbacks() {
    @Override
    public void onInitSuccess() {
        Log.v("Token KMS onInitSuccess", "KMS Init OK");
    }
    @Override
    public void onInitFailed() {
        Log.v("Token KMS onInitFailed", "KMS Init Failed");
    }
});

Enc/Dec

400TR:

CtKMS2FixedKey enckey = new CtKMS2FixedKey();
enckey.setCipherMethod(CTOS.CtKMS2FixedKey.DATA_ENCRYPT_METHOD_ECB);


CtKMS2FixedKey deckey = new CtKMS2FixedKey();
deckey.setCipherMethod(CTOS.CtKMS2FixedKey.DATA_ENCRYPT_METHOD_ECB);

330TR:

kms.encryptData(VersionParams.kek, tdata2encrypt, TokenKMSConstants.TOKENKMS_PROTECTION_MODE_ECB, ICV);

kms.decryptData(VersionParams.pek, data, TokenKMSConstants.TOKENKMS_PROTECTION_MODE_CBC, ICV);

Write Key

400TR:

CtKMS2KPK kpk = new CtKMS2KPK();

kpk.setCipherKeyLocation(KEK_keyset, KEK_keyindex);
kpk.setKeyLocation(keyset, keyindex);

kpk.writekey();

300TR

kms.injectKeybyKEK(VersionParams.kek, 1, TokenKMSConstants.TOKENKMS_KEYTYPE_TDK, TokenKMSConstants.TOKENKMS_KEY_ALG_TYPE_3DES,

Printer

400TR:

printService = new PrintServiceBinding(); // Bind Service
printService.print(printText); // Print

330TR:

StyledString styledText = new StyledString();
/* Add text…*/
styledText.print(PrinterService.getService(getApplicationContext())); // Print, without service binding

EMV:

All ICC transactions must be completed in 330TR. The card read process is not completed until completeEmvTxn is called. Other than requested actions by API, ICC transactions can be completed as follows:

if (card.getmCardReadType() == CardReadType.ICC.value) {
    byte action = (byte) 0x01;
    int emvResult = cardServiceBinding.completeEmvTxn(action, new byte[]{0, 0}, new byte[]{0, 0}, 0, new byte[]{0, 0}, 0);
}

Note: The setEMVConfiguration should be called first and followed by the setEMVCLConfiguration.

Android Studio Configuration:

You need to edit your configurations in 330TR unlike 400/1000TR because its version is more than Android 11. Therefore you need to open Edit Configurations and then select "Always install with package manager". If you don't select that configuration, your latest changes won't work on your 330TR device.

Last updated