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 Normal View History

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