I am having troubling with generating IPEK from BDK and KSN from python, after that i want to generate dataKey from kSN and IPEK. Is there any way to do this two functions using python? Wanted Scenario below
def decryptinfo(ksn, data):
BDK = unhexlify("0123456789ABCDEFFEDCBA9876543210")
ksn = unhexlify(ksn)
IPEK = GenerateIPEK(ksn, BDK)
DATAKEY = GetDataKey(ksn, IPEK)
res = TDES_Dec(data, DATA_KEY)
return hexlify(res)
def GetDataKey(ksn, ipek):
key = GetDukptKey(ksn, ipek)
key = bytearray(key)
key[5] ^= 0xFF
key[13] ^= 0xFF
return str(key)
I want to know is there any way to get GenerateIPEK(ksn, BDK) and GetDukptKey(ksn, ipek) from python..
he code provided in the GitHub repository you shared uses an older version of the pycryptodome library, and it seems to work with Python 2. If you are using Python 3, refer the example code
https://github.com/allen246/dukpt/blob/main/example.py