usertype Sessionkey;
usertype Ticket;

protocol isoiec11770213(I,R,S)
{
	role I
	{
		fresh ni: Nonce;
		var nr: Nonce;
		var kir: Sessionkey;

		send_1 (I,R, ni);
		recv_4 (R,I, { ni,kir,R }k(I,S) );

		claim_5 (I, Secret, kir);
	}	
	
	role R
	{
		var ni: Nonce;
		fresh nr: Nonce;
		fresh kir: Sessionkey;
		var T;

		recv_1 (I,R, ni);
		send_2 (R,S, { nr,ni,I,kir }k(R,S) );
		recv_3 (S,R, { nr, I }k(R,S), T );
		send_4 (R,I, T );

		claim_6 (R, Secret, kir);
	}

	role S
	{
		var ni,nr: Nonce;
		var kir: Sessionkey;

		recv_2 (R,S, { nr,ni,I,kir }k(R,S) );
		send_3 (S,R, { nr, I }k(R,S), { ni,kir,R }k(I,S) );
	}
}

