|
Introduction
Applet
Examples
Download
Research Papers
Changelog
To Do List
|
import oldprelude;
public Initiator : Client;
public Responder : Server;
public Intermediary : Server;
public KDC : Server;
public KDCHost : Host;
public initiator : Word;
public responder : Word;
public shares : Word;
public with : Word;
public for : Word;
public and : Word;
public generated : Word;
public contacts : Word;
type ISO4NonceB (a : Host, b : Host, nonceS : Challenge)
= Nonce ( end (initiator a contacts responder b), check (nonceS) );
type ISO4SMsg4 (a : Host, b : Host)
= Struct ( a' : Host, nonceB : Challenge );
type ISO4SMsg5 (a : Host, b : Host)
= Struct ( nonceS : Challenge, nonceB' : ISO4NonceB (a, b, nonceS) );
type ISO4SMsg (a : Host, b : Host)
= Union ( msg4 : ISO4SMsg4 (a, b), msg5 : ISO4SMsg5 (a, b) );
type ISO4SKey (a : Host, b : Host)
= Key (ISO4SMsg (a, b));
type ISO4NonceA (a : Host, b : Host, sKey : ISO4SKey (a, b), nonceS : Challenge)
= Nonce (end (Sam generated sKey for initiator a and responder b), check (nonceS));
type ISO4NonceS (a : Host, b : Host, sKey : ISO4SKey (a, b))
= Nonce (end (Sam generated sKey for responder b and initiator a));
type ISO4Msg2 (a : Host)
= Struct ( b : Host, sKey : ISO4SKey (a, b), nonceS : Challenge, nonceA' : ISO4NonceA (a, b, sKey, nonceS) );
type ISO4Msg3 (b : Host)
= Struct ( a : Host, sKey : ISO4SKey (a, b), nonceS' : ISO4NonceS (a, b, sKey) );
type ISO4Msg (h : Host)
= Union ( msg2 : ISO4Msg2 (h), msg3 : ISO4Msg3 (h) );
type ISO4Key (h : Host)
= Key (ISO4Msg (h));
type ISO4KDCMsg
= Struct (h : Host, keyH : ISO4Key (h));
type ISO4KDCKey
= Key (ISO4KDCMsg);
private keyA : ISO4Key (Alice);
private keyB : ISO4Key (Bob);
private keyKDC : ISO4KDCKey;
client Initiator at Alice is {
new (nonceA : Challenge);
establish Intermediary at Sam is (socketS : Socket);
output socketS is (Alice, Bob, nonceA);
input socketS is (
{ msg2 (
Bob,
sKey : ISO4SKey (Alice, Bob),
nonceS : Challenge,
nonceA' : ISO4NonceA (Alice, Bob, sKey, nonceS)
) }keyA,
ticket : Un
);
check nonceA is nonceA';
end (Sam generated sKey for initiator Alice and responder Bob);
begin (initiator Alice contacts responder Bob);
establish Responder at Bob is (socketB : Socket);
output socketB is (ticket);
input socketB is ( { msg4 ( Alice, nonceB : Challenge ) }sKey );
cast nonceB is (nonceB' : ISO4NonceB (Alice, Bob, nonceS));
output socketB is ( { msg5 ( nonceS, nonceB' ) }sKey );
}
server Responder at Bob is (socketA : Socket) {
new (nonceB : Challenge);
input socketA is ( { msg3 (
a : Host,
sKey : ISO4SKey (a, Bob),
nonceS' : ISO4NonceS (a, Bob, sKey)
) }keyB );
output socketA is ( { msg4 ( a, nonceB ) }sKey );
input socketA is ( { msg5 (
nonceS : Challenge,
nonceB' : ISO4NonceB (a, Bob, nonceS)
) }sKey );
check nonceB is nonceB';
check nonceS is nonceS';
end (Sam generated sKey for responder Bob and initiator a);
end (initiator a contacts responder Bob);
}
server Intermediary at Sam is (socketA : Socket) {
input socketA is (a : Host, b : Host, nonceA : Challenge);
establish KDC at KDCHost is (socketKDC : Socket);
output socketKDC is (a);
input socketKDC is ({ a, keyA : ISO4Key (a) }keyKDC);
output socketKDC is (b);
input socketKDC is ({ b, keyB : ISO4Key (b) }keyKDC);
new (nonceS : Challenge);
new (sKey : ISO4SKey (a, b));
begin (Sam generated sKey for initiator a and responder b);
begin (Sam generated sKey for responder b and initiator a);
cast nonceA is (nonceA' : ISO4NonceA (a, b, sKey, nonceS));
cast nonceS is (nonceS' : ISO4NonceS (a, b, sKey));
output socketA is (
{ msg2 ( b, sKey, nonceS, nonceA' ) }keyA,
{ msg3 ( a, sKey, nonceS' ) }keyB
);
}
|