|
Introduction
Applet
Examples
Download
Research Papers
Changelog
To Do List
|
import prelude;
public providing : Word;
public to : Word;
public in : Word;
public challenge : Word;
public response : Word;
public acknowledging : Word;
public being : Word;
public contacted : Word;
public as : Word;
public part : Word;
public of : Word;
public run : Word;
type ChallengeAToS ( a:Any, b:Any, rid:Any )
= SoshChall( !begun(b acknowledging to a being contacted as part of run rid) );
type ResponseSToA ( s:Any, a:Any, kab:Any, na:Any )
= SoshResp ( begun(s providing kab to a in response to challenge na) );
type ChallengeBToS
= SoshChall ();
type ResponseSToB ( s:Any, b:Any, kab:Any, nb:Any )
= SoshResp ( begun(s providing kab to b in response to challenge nb) );
pattern Msg1 (a:Any, s:Any)
= ( na:ChallengeAToS(a,b,rid), rid:Un, _, b:Host );
pattern Msg2 (b:Any, s:Any)
= ( nb:ChallengeBToS, rid:Un, a:Un, _ )
[ !begun(b acknowledging to a being contacted as part of run rid) ];
pattern Msg3 (b:Any, s:Any)
= ( nb:ResponseSToB(s,b,kab,nb), kab:Private );
pattern Msg4 (a:Any, s:Any)
= ( na:ResponseSToA(s,a,kab,na), kab:Private );
tag msg1(Msg1(a,s)) : Auth (a:Any,s:Any);
tag msg2(Msg2(b,s)) : Auth (b:Any,s:Any);
tag msg3(Msg3(b,s)) : Auth (b:Any,s:Any);
tag msg4(Msg4(a,s)) : Auth (a:Any,s:Any);
fun lkupKey(p:Any,q:Any) : SharedKey(p,q);
client Initiator
(a:Host, b:Host, s:Server, kas:SharedKey(a,s))
at a is
{
establish Responder at b is (socket:Socket);
new (rid : Public);
new ( nonceA : ChallengeAToS(a,b,rid) );
output socket is ( rid, a, b, { msg1(nonceA,rid,a,b) }kas );
input socket is ( rid, { msg4(nonceA,kab:Private) }kas )
[ begun(s providing kab to a in response to challenge nonceA),
!begun(b acknowledging to a being contacted as part of run rid) ];
end(s providing kab to a in response to challenge nonceA);
end(b acknowledging to a being contacted as part of run rid);
}
server Responder
(b:Host, s:Server, kbs:SharedKey(b,s))
at b is (socketA:Socket)
{
input socketA is (rid:Un, a:Un, b, ticketS:Un);
establish Intermediary at s is (socketS:Socket);
new (nonceB : ChallengeBToS);
begin! (b acknowledging to a being contacted as part of run rid);
output socketS is (rid, ticketS, { msg2(nonceB,rid,a,b) }kbs);
input socketS is ( rid, ticketA:Un, { msg3(nonceB,kab:Private) }kbs )
[ begun(s providing kab to b in response to challenge nonceB) ];
end(s providing kab to b in response to challenge nonceB);
output socketA is (rid,ticketA);
}
server Intermediary (s:Server) at s is (socket:Socket) {
input socket is (rid:Un,a:Un,b:Un,requestA:Un,requestB:Un);
let kas:SharedKey(a,s) = lkupKey(a,s);
let kbs:SharedKey(b,s) = lkupKey(b,s);
match requestA is { msg1(nonceA:ChallengeAToS(a,b,rid), rid, a, b) }kas;
match requestB is { msg2(nonceB:ChallengeBToS, rid, a, b) }kbs
[ !begun(b acknowledging to a being contacted as part of run rid) ];
new (kab:SharedKey(a,b));
begin (s providing kab to a in response to challenge nonceA);
begin (s providing kab to b in response to challenge nonceB);
output socket is ( { msg4(nonceA,kab) }kas, { msg3(nonceB,kab) }kbs );
}
|