print("failed to get challange") cleanup(-1, con) RP = OSPTUTIL.Extract_RP(resp) rp = OSPTUTIL.Extract_rp(resp) print("RP : " + "".join("%2.2X " % c for c in RP)) print("rp : " + "".join("%2.2X " % c for c in rp)) cp = sec.mutual_auth(RP, rp) print("CP: " + "".join("%2.2X " % c for c in cp)) print() print("Do Mutual Authentication") apdu = [0x00, 0x82, 0x00, 0x01, 0x26] apdu.extend(cp) apdu.extend(sec.RT) apdu.extend(sec.rt) apdu.extend([0x10]) print("--> " + "".join("%2.2X " % c for c in apdu)) resp = con.transceive(bytes(apdu)) print("<-- " + "".join("%2.2X " % c for c in resp)) status = get_response_status(resp) if (status != 0x9000): print("Failed to make mutual authentication") cleanup(-2, con) ver = sec.validate_sessionkey(get_response_data(resp)) if (ver == False): print("Mutual Authentication: FAILED") cleanup(-3, con) else: print("Mutual Authentication: PASS") cleanup(0, con)
import osptutil as OSPTUTIL import osptsecure as sec """ parameter yang diketahui: """ RP = [0x2A,0x92,0xB2,0x18,0x3A,0x0A,0xE4,0x0F,0xDB,0xB9,0x3E,0xF8,0x6D,0x0F,0xA0,0x41] rp = [0x6C,0x20,0x07,0xBE,0xC5,0xF9] cp = sec.mutual_auth(RP,rp) print("CP = "+"".join("%2.2X " % c for c in cp)) sekey = [0xC0,0x97,0x55,0x78,0x85,0x07,0xC6,0x6A,0xFC,0xD4,0x13,0x1E,0xA5,0x4E,0xEC,0x2A] val = sec.validate_sessionkey(sekey) print(val)
cleanup(-1,con) RP = OSPTUTIL.Extract_RP(resp) rp = OSPTUTIL.Extract_rp(resp) print("RP : "+"".join("%2.2X " % c for c in RP)) print("rp : "+"".join("%2.2X " % c for c in rp)) cp = sec.mutual_auth(RP,rp) print("CP: "+"".join("%2.2X " % c for c in cp)) print() print("Do Mutual Authentication") apdu = [0x00,0x82,0x00,0x01,0x26] apdu.extend(cp) apdu.extend(sec.RT) apdu.extend(sec.rt) apdu.extend([0x10]) print("--> "+"".join("%2.2X " % c for c in apdu)) resp = con.transceive(bytes(apdu)) print("<-- " + "".join("%2.2X " % c for c in resp)) status = get_response_status(resp) if(status != 0x9000): print("Failed to make mutual authentication") cleanup(-2,con) ver = sec.validate_sessionkey(get_response_data(resp)) if(ver == False): print("Mutual Authentication: FAILED") cleanup(-3,con) else: print("Mutual Authentication: PASS") cleanup(0,con)
import osptutil as OSPTUTIL import osptsecure as sec """ parameter yang diketahui: """ RP = [ 0x2A, 0x92, 0xB2, 0x18, 0x3A, 0x0A, 0xE4, 0x0F, 0xDB, 0xB9, 0x3E, 0xF8, 0x6D, 0x0F, 0xA0, 0x41 ] rp = [0x6C, 0x20, 0x07, 0xBE, 0xC5, 0xF9] cp = sec.mutual_auth(RP, rp) print("CP = " + "".join("%2.2X " % c for c in cp)) sekey = [ 0xC0, 0x97, 0x55, 0x78, 0x85, 0x07, 0xC6, 0x6A, 0xFC, 0xD4, 0x13, 0x1E, 0xA5, 0x4E, 0xEC, 0x2A ] val = sec.validate_sessionkey(sekey) print(val)