usertype Sessionkey;
const pk: Function;
secret sk: Function;
inversekeys (pk,sk);

protocol sophkx(I,R)
{
	role I
	{
		const ni: Nonce;
		const kir: Sessionkey;
		var nr: Nonce;

		send_1(I,R, ni, {I,kir}pk(R) );
		read_2(R,I, {ni}kir );
		claim_4(I,Secret,kir);
	}	
	
	role R
	{
		var ni: Nonce;
		var kir: Sessionkey;
		const nr: Nonce;

		read_1(I,R, ni, {I,kir}pk(R) );
		send_2(R,I, {ni}kir );
	}
}

const Alice,Bob,Eve: Agent;

untrusted Eve;
const nc: Nonce;
const ke: Sessionkey;
compromised sk(Eve);

run sophkx.I(Agent,Agent);
run sophkx.R(Agent,Agent);
run sophkx.I(Agent,Agent);
