import prelude;
public sending : Word;
public to : Word;
public and : Word;
public with : Word;
pattern Digest (a:Host, b:Host)
= ( hash( hash(text:Public), hash(time:Public), hash(msgid:Public) ) )
[ !begun(a sending text with msgid and time to b) ];
tag digest (Digest(a,b)) : Auth(a:Host,b:Host);
fun lkupHashKey (p:Any,q:Any) : HashKey(p,q);
client Initiator (a:Host, b:Host, kab:HashKey(a,b)) at a is
{
establish Receiver at b is (socket : Socket);
new (text : Public);
new (msgid : Public);
new (time : Public);
begin! (a sending text with msgid and time to b);
output socket is
(text, a, b, time, msgid,
keyedhash( kab, digest( hash( hash(text), hash(time), hash(msgid) ) ) ));
}
server Receiver (b:Host) at b is (socket : Socket)
{
input socket is (text:Un, a:Un, b, time:Un, msgid:Un, digest':Un);
let kab:HashKey(a,b) = lkupHashKey (a,b);
match digest' is
keyedhash( kab, digest( hash( hash(text), hash(time), hash(msgid) ) ) )
[ !begun (a sending text with msgid and time to b) ];
end (a sending text with msgid and time to b);
}
|