import prelude;
public sending : Word;
public to : Word;
type Challenge = PoshChall ();
type Response (a:Host,b:Host,text:Payload)
= PoshResp ( begun(a sending text to b) );
pattern Msg (a:Host,b:Host)
= ( nonceA:Response(a,b,text), text:Payload );
tag msg(Msg(a,b)) : Auth(a:Host,b:Host);
fun lkupKey(p:Any,q:Any) : SharedKey(p,q);
client Sender (a:Host, b:Host, kab:SharedKey(a,b)) at a is {
establish Receiver at b is (socket : Socket);
output socket is a;
input socket is (nonce : Challenge);
new (text : Payload);
begin(a sending text to b);
output socket is { msg(nonce,text) }kab;
}
server Receiver(b:Host) at b is (socket : Socket) {
input socket is (a:Un);
let kab:SharedKey(a,b) = lkupKey (a,b);
new (nonce : Challenge);
output socket is nonce;
input socket is { msg(nonce,text:Payload) }kab
[ begun(a sending text to b) ];
end(a sending text to b);
}
|