def AS_to_Client(ip_Client, r): Key_c = (r.get('Key_Client')).decode() Key_c = tostr.key_tostr(Key_c) QW.Key_client = Key_c Key_ctgs = (r.get('Key_ctgs')).decode() # 理论上从数据库获取 Key_ctgs = tostr.key_tostr(Key_ctgs) print("Key_ctgs = ", Key_ctgs) ip_TGS = (r.get('ip_TGS')).decode() # 从数据库获取TGS的IP地址 ip_TGS = tostr.ip_tostr(ip_TGS) ts2 = time.time() ts2 = tostr.ts_tostr(ts2) lifetime2 = 666 lifetime2 = tostr.lifetime_tostr(lifetime2) ip_Client = tostr.ip_tostr(ip_Client) ticket_tgs = get_ticket(Key_ctgs, ip_Client, ip_TGS, ts2, lifetime2, r) message = Key_ctgs + ip_TGS + ts2 + lifetime2 + ticket_tgs QW.message2_Plaintext = message message = des_en.test(message, Key_c) QW.message2_Ciphertext = message return message
def get_ticket(ip_Client, AD_Client, ip_Server, Key_cv, Key_server): ts4 = time.time() ts4 = tostr.ts_tostr(ts4) lifetime4 = 666 lifetime4 = tostr.lifetime_tostr(lifetime4) ticket_Server = Key_cv + ip_Client + AD_Client + ip_Server + ts4 + lifetime4 ticket_Server = des_en.test(ticket_Server, Key_server) print("ticket_server = ", ticket_Server) return ticket_Server, ts4