import oldprelude;
public Initiator : Client;
public Responder : Server;
public Intermediary : Server;
public KDC : Server;
public KDCHost : Host;
public authenticates : Word;
public to : Word;
type WLNonce (a : Host, b : Host) =
Nonce (end (a authenticates to b));
type WLMsg3 (a : Host) =
Struct (nonce : WLNonce (a, b));
type WLMsg4 =
Struct (a : Host, b : Host, cText : CText);
type WLMsg5 (b : Host) =
Struct (nonce : WLNonce (a, b));
type WLMsg (h : Host) =
Union (msg3 : WLMsg3 (h), msg5 : WLMsg5 (h));
type WLKey (h : Host) =
Key (WLMsg (h));
type WLKDCMsg = Struct (h : Host, keyH : WLKey (h));
type WLKDCKey = Key (WLKDCMsg);
private keyA : WLKey (Alice);
private keyB : WLKey (Bob);
private keyKDC : WLKDCKey;
client Initiator at Alice is {
begin (Alice authenticates to Bob);
establish Responder at Bob is (socket : Socket);
output socket is (Alice);
input socket is (nonce : Challenge);
cast nonce is (nonce' : WLNonce (Alice, Bob));
output socket is ({ msg3 (nonce') }keyA);
}
server Responder at Bob is (socketA : Socket) {
input socketA is (a : Host);
new (nonce : Challenge);
output socketA is (nonce);
input socketA is (cText : CText);
establish Intermediary at Sam is (socketS : Socket);
output socketS is (Bob, { msg4 (a, cText) }keyB);
input socketS is ({ msg5 (nonce' : WLNonce (a, Bob)) }keyB);
check nonce is nonce';
end (a authenticates to Bob);
}
server Intermediary at Sam is (socketB : Socket) {
input socketB is (b : Host, cText : CText);
establish KDC at KDCHost is (socketKDC : Socket);
output socketKDC is (b);
input socketKDC is ({ b, keyB : WLKey (b) }keyKDC);
decrypt cText is ({ msg4 (a : Host, cText' : CText) }keyB);
output socketKDC is (a);
input socketKDC is ({ a, keyA : WLKey (a) }keyKDC);
decrypt cText is ({ msg3 (nonce' : WLNonce (a, b)) }keyA);
output socketB is ({ msg5 (nonce') }keyB);
}
|