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_1.spdl

75 lines
1.3 KiB
Plaintext
Raw Permalink Normal View History

2023-12-01 17:55:41 +00:00
/*
* Coursework 2 PI protocol
*/
2023-12-07 20:21:10 +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;
2023-12-07 20:21:10 +00:00
recv_keysPhone(Network, Phone, {Mac(SesK, tl)}k(Network, Phone), {SesK, tl}k(Network, Phone));
2023-12-01 17:55:41 +00:00
2023-12-07 20:21:10 +00:00
var mApp: String;
2023-12-01 17:55:41 +00:00
2023-12-07 20:21:10 +00:00
recv_1(Application,Phone, {mApp}SesK);
2023-12-01 17:55:41 +00:00
2023-12-07 20:21:10 +00:00
fresh mPhone: String;
2023-12-01 17:55:41 +00:00
2023-12-07 20:21:10 +00:00
send_2(Phone,Application, {mApp, mPhone}SesK);
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;
2023-12-07 20:21:10 +00:00
recv_keysApp(Network,Application, {Mac(SesK, tl)}k(Network, Application), {SesK, tl}k(Network, Application));
2023-12-01 17:55:41 +00:00
2023-12-07 20:21:10 +00:00
fresh mApp: String;
var mPhone: String;
2023-12-01 17:55:41 +00:00
2023-12-07 20:21:10 +00:00
send_1(Application,Phone, {mApp}SesK);
2023-12-01 17:55:41 +00:00
2023-12-07 20:21:10 +00:00
recv_2(Phone,Application, {mApp, mPhone}SesK);
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-07 20:21:10 +00:00
send_keysApp(Network,Application, {Mac(SesK, tl)}k(Network, Application), {SesK, tl}k(Network, Application));
2023-12-01 17:55:41 +00:00
2023-12-07 20:21:10 +00:00
send_keysPhone(Network,Phone, {Mac(SesK, tl)}k(Network, Phone), {SesK, tl}k(Network, Phone));
2023-12-01 17:55:41 +00:00
}
}