How to get the Plain PIN and PAN from this encrypted PINBLOCK

QuestionsCategory: QuestionsHow to get the Plain PIN and PAN from this encrypted PINBLOCK
Brightn-n-Fresh Staff asked 1 year ago

In the cause of running a test, I would like to know the flow in decrypting this already encrypted PINBLOCK in getting it's plainText using 3DES and DUKPT (JAVA language).

BDK: 0123456789ABCDEFFEDCBA9876543210

Initially Loaded Key Serial Number (KSN): FFFF9876543210E00001

PIN Encryption key variant: 042666B49184CF5C68DE9628D0397B36

PIN: 4315

PAN: 5413339000001513

PIN Block (Plaintext): 044326C6FFFFFEAE

(Encrypt by 3DES-128 bits CBC Mode (padding zero)) PIN Block (Encrypted): 8918C8AAB0C6210A

I tried using this method, which isn't giving the accurate result

public String getClearPin(String key, String encryptedPinBlock, String pan){
    String pinBlock = null;
    int len = pan.length();
    String pin = null;
    try {
        pan = "0000" + pan.substring(len - 13, len - 1);
        pinBlock = do3DESDecryption(key, encryptedPinBlock);
        pin = xor(pinBlock, pan).substring(2, 6);
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
    }
    return pin;
}

Would appreciate a clear explanation of this and how to go about the bolded encrypted PIN Block which is to be decrypted. Thanks

(160)