This repository has been archived on 2024-01-04. You can view files and clone it, but cannot push or open issues or pull requests.
ComputerSecurity/secondcw/ag01598_6644818_1_2.spdl

96 lines
2.0 KiB
Plaintext
Raw Normal View History

2023-12-01 17:55:41 +00:00
/*
* Coursework 2 PI protocol
*/
2023-12-01 19:55:06 +00:00
usertype String;
2023-12-01 17:55:41 +00:00
usertype Timestamp;
usertype Sessionkey;
hashfunction Mac;
protocol protocolPI(Network, Application, Phone) {
/* Role R - Phone
*
* has keys k(N,R)
*
*/
role Phone {
var SesK: SessionKey;
var tl: Timestamp;
recv_keysPhone(Network, Phone, Mac({SesK, tl}k(Network, Phone)), {SesK, tl}k(Network, Phone));
2023-12-01 19:55:06 +00:00
var mApp: String;
2023-12-01 17:55:41 +00:00
recv_1(Application,Phone, {mApp}k(SesK));
2023-12-01 19:55:06 +00:00
fresh mPhone: String;
claim_phone1(Phone, Running, Application, mApp);
2023-12-01 17:55:41 +00:00
send_2(Phone,Application, {mApp, mPhone}k(SesK));
2023-12-01 19:55:06 +00:00
claim_phone2(Phone, Secret, SesK);
claim_application1(Phone, Commit, Application, mApp);
claim_network2(Phone, Commit, Network, SesK, tl);
claim_phone3(Phone, Nisynch);
2023-12-01 17:55:41 +00:00
}
/* Role S - Application
*
* has keys k(N,S)
*
*/
role Application {
send_refreshKeys(Application,Network, Application, Phone);
var SesK: SessionKey;
var tl: Timestamp;
recv_keysApp(Network,Application, Mac({SesK, tl}k(Network, Application)), {SesK, tl}k(Network, Application));
2023-12-01 19:55:06 +00:00
fresh mApp: String;
var mPhone: String;
claim_application1(Application, Running, Phone, mApp);
2023-12-01 17:55:41 +00:00
send_1(Application,Phone, {mApp}k(SesK));
recv_2(Phone,Application, {mApp, mPhone}k(SesK));
2023-12-01 19:55:06 +00:00
claim_application2(Application, Secret, SesK);
claim_phone1(Application, Commit, Phone, mApp);
claim_network1(Application, Commit, Network, SesK, tl);
claim_application3(Application, Nisynch);
2023-12-01 17:55:41 +00:00
}
/* Role N - Network
*
* has keys k(N,R) and k(N,S)
*
*/
role Network {
recv_refreshKeys(Application,Network, Application, Phone);
fresh SesK: SessionKey;
fresh tl: Timestamp;
2023-12-01 19:55:06 +00:00
claim_netwrok1(Network, Running, Application, SesK, tl);
2023-12-01 17:55:41 +00:00
send_keysApp(Network,Application, Mac({SesK, tl}k(Network, Application)), {SesK, tl}k(Network, Application));
2023-12-01 19:55:06 +00:00
claim_network2(Network, Running, Phone, SesK, tl);
2023-12-01 17:55:41 +00:00
send_keysPhone(Network,Phone, Mac({SesK, tl}k(Network, Phone)), {SesK, tl}k(Network, Phone));
2023-12-01 19:55:06 +00:00
claim_network3(Network, Secret, SesK);
claim_network4(Network, Nisynch);
2023-12-01 17:55:41 +00:00
}
}