Research Article

An Identity Authentication Scheme Based on SM2 Algorithm in UAV Communication Network

Algorithm 2

Core algorithm of the control station end.
IDu,Ru = clientSocket. recv(1024)#The control station receives the IDu and Ru
res = check(IDu) #The control station checks the IDu
res, content = sm2_station.negotiation(Ru, PU, IDU, option, Rs, Rs)#Key negotiation
if not res:
     print(’error:’, content)
     return
if option:#Generates the negotiation key, the KS
     KS, SS = content
else:
     KS = content
clientSocket. send(message(IDs,Rs)#Send the IDs and Rs to the drone
encData = SM4. encryptSM4(KS, command)#The control station encrypts the instructions using a KS key
clientSocket. send(encData)#Send the text to the drone