| (gateway ) | | let processGateway(xgwn: bitstring) = | | ( Message 2) | | in(cug,(A:G, ki:bitstring, M1:bitstring, T1:bitstring)); | | let ei’ = hash(con(ki,xgwn)) in | | let (tem:bitstring) = xor(M1, ei’) in | | let (idi’:bitstring, tem1: bitstring) = Split(tem) in | | let di’= hash(con(idi’,xgwn)) in | | let (sidj’: bitstring, m2’: bitstring) = Split(tem1) in | | if (m2’) = hash(con(g2h(A),con(sidj’,hash(con(idi’,xgwn))))) then | | event acceptUserbyGateway(di’); | | new T2: bitstring; | | let xj’=hash(con(sidj’,xgwn)) in | | let m3 = hash(con(g2h(A),con(sidj’,con(xj’,T2)))) in | | out(csg,(A,m3,T2)); | | ( Message 4) | | in(csg,(B:G, m4:bitstring, m5:bitstring)); | | if (m5) = hash(con(xj’,con(m3,con(m4,g2h(B))))) then | | new k3:bitstring; | | let einew = hash(con(k3,xgwn)) in | | let m7 = hash(con(einew,con(k3,con(di’,con(T1,m4))))) in | | event acceptSensorbyGateway(xj’); | | event termGatewaywithSensor(xj’); | | let m6 = xor(con(einew,con(k3,m7)),ei’) in | | out(cug,(B,m6)); | | event termGatewaywithUser(di’). | | ( User registration ) | | let processUserRegistration(xgwn: bitstring) = | | in(scUser, (idi: bitstring, mpi:bitstring)); | | let di = hash(con(idi,xgwn)) in | | let fi = xor(di,mpi) in | | new ki:bitstring; | | let ei= hash(con(idi,xgwn)) in | | let li= xor(ei,mpi) in | | out(scUser,(fi,li,ki)). | | ( Sensor registration ) | | let processSensorRegistration(xgwn: bitstring) = | | in(scSensor, sidj:bitstring); | | let xj = hash(con(sidj,xgwn)) in | | out(scSensor,xj). |
|