def create_static_password(key_hex): ''' According to yubikey manual 5.5.5 the static-ticket is the same algorith with no moving factors. The msg_hex that is encoded with the aes key is '000000000000ffffffffffffffff0f2e' ''' msg_hex = "000000000000ffffffffffffffff0f2e" msg_bin = binascii.unhexlify(msg_hex) aes = AES.new(binascii.unhexlify(key_hex), AES.MODE_ECB) password_bin = aes.encrypt(msg_bin) password = modhex_encode(password_bin) return password
def create_static_password(key_hex): """ According to yubikey manual 5.5.5 the static-ticket is the same algorith with no moving factors. The msg_hex that is encoded with the aes key is '000000000000ffffffffffffffff0f2e' """ msg_hex = "000000000000ffffffffffffffff0f2e" msg_bin = binascii.unhexlify(msg_hex) aes = AES.new(binascii.unhexlify(key_hex), AES.MODE_ECB) password_bin = aes.encrypt(msg_bin) password = modhex_encode(password_bin) return password
def test_mod2hex(): m = 'fifjgjgkhchb' h = '474858596061' assert modhex_encode(h) == m