53 lines
762 B
Plaintext
53 lines
762 B
Plaintext
// Yahalom protocol
|
|
|
|
const a,b,s : Agent;
|
|
secret k : Function;
|
|
|
|
|
|
protocol yahalom(A,B,S)
|
|
{
|
|
role A
|
|
{
|
|
const na;
|
|
var nb;
|
|
var ticket;
|
|
var kab;
|
|
|
|
send_1(A,B, A,na);
|
|
read_3(S,A, nb, {B,kab,na,nb}k(A,S), ticket );
|
|
send_4(A,B, ticket, {nb}kab );
|
|
|
|
claim_5(A, Secret,kab);
|
|
}
|
|
|
|
role B
|
|
{
|
|
const nb;
|
|
var na;
|
|
var ticket;
|
|
var kab;
|
|
|
|
read_1(A,B, A,na);
|
|
send_2(B,S, B,nb, {A,na,nb}k(B,S) );
|
|
read_4(A,B, {A,kab}k(B,S) , {nb}kab );
|
|
|
|
claim_6(B, Secret,kab);
|
|
}
|
|
|
|
role S
|
|
{
|
|
const kab;
|
|
var na,nb;
|
|
|
|
read_2(B,S, B,nb, {A,na}k(B,S) );
|
|
send_3(S,A, nb, {B,kab,na,nb}k(A,S), {A,kab}k(B,S) );
|
|
}
|
|
}
|
|
|
|
run yahalom.A(Agent,Agent,s);
|
|
run yahalom.A(Agent,Agent,s);
|
|
run yahalom.B(Agent,Agent,s);
|
|
run yahalom.B(Agent,Agent,s);
|
|
run yahalom.S(Agent,Agent,s);
|
|
|