You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
you can calculate the OPC from the OP and KI (OPC = AES128(ki,OP) XOR OP)
I did something in python to do this:
from Crypto.Cipher import AES
import binascii
def calculate_opc(ki, op):
# Convert the Ki and OP values from hex strings to byte arrays
ki_bytes = binascii.unhexlify(ki)
op_bytes = binascii.unhexlify(op)
# Create a new AES object with the Ki value as the key
aes = AES.new(ki_bytes, AES.MODE_ECB)
# Use the AES object to encrypt the OP value
encrypted_op = aes.encrypt(op_bytes)
# XOR the encrypted OP value with the original OP value to get the OPC value
opc = bytearray(len(op_bytes))
for i in range(len(op_bytes)):
opc[i] = encrypted_op[i] ^ op_bytes[i]
# Convert the OPC value to a hex string and return it
return binascii.hexlify(opc).decode('utf-8')
ki = (input('Enter Ki: '))
op = (input('Enter Op: '))
opc = calculate_opc(ki, op)
print('OPc: ' + opc)
Hi
Thanks for your great repo!
I was wondering if it is possible to use OP instead of OP for AUC authentication?
Thanks
Best regards
The text was updated successfully, but these errors were encountered: