import prelude;
public sending : Word;
public to : Word;
public and : Word;
public with : Word;
pattern Digest (a:Host)
= ( hash( hash(text:Public), hash(b:Host), hash(time:Public),
hash(msgid:Public) )
) [ !begun(a sending text with msgid and time to b) ];
tag digest (Digest(a)) : Auth<a:Host>;
fun lkupAuthKey (p:Any) : AuthKey(p);
client Initiator (a:Host, b:Host, sA:SignKey(a)) 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,
{| digest( hash( hash(text), hash(b), hash(time), hash(msgid) ) ) |}sA);
}
server Receiver (b:Host) at b is (socket : Socket)
{
input socket is (text:Un, a:Un, b, time:Un, msgid:Un, signed:Un);
let sA:AuthKey(a) = lkupAuthKey (a);
match signed is
{| digest( hash( hash(text), hash(b), hash(time), hash(msgid) ) ) |}sA^-1
[ !begun (a sending text with msgid and time to b) ];
end (a sending text with msgid and time to b);
}
|