Created
May 15, 2017 12:56
-
-
Save mimoo/93c78a5aa5aa89e446445b73790edff0 to your computer and use it in GitHub Desktop.
Opportunistic Diffie-Hellman input for Tamarin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
theory Diffie_Hellman | |
begin | |
builtins: diffie-hellman | |
// | |
// Rules | |
// | |
rule client_init: | |
let pubKey = 'g'^~privKey | |
in | |
[Fr(~privKey)] | |
--[]-> | |
[InitClient(~privKey, pubKey), Out(pubKey)] | |
rule server_response: | |
[Fr(~privKey), In(clientPubKey)] | |
--[SessionCreateServer(clientPubKey^~privKey)]-> | |
[Out('g'^~privKey), Session(clientPubkey^~privKey)] | |
rule client_receive: | |
[InitClient(~privKey, pubKey), In(serverPubKey)] | |
--[SessionCreateClient(serverPubKey^~privKey)]-> | |
[Session(serverPubKey^~privKey)] | |
rule terminate: | |
[Session(A)] | |
--> | |
[] | |
// | |
// Lemmas | |
// | |
// just making sure it works | |
lemma ExchangeWorks: | |
exists-trace | |
"Ex S #i #j. SessionCreateClient(S) @ #i & SessionCreateServer(S) @ #j & #j < #i & not(Ex #k. K(S) @ #k)" | |
lemma RecoverSessionKeyImpossible: | |
"All S #i #j. (SessionCreateClient(S) @ #i & SessionCreateServer(S) @ #j & #j < #i) ==> not(Ex #k. K(S) @ #k)" | |
lemma MITMImpossible: | |
"All S1 S2 #i #j. (SessionCreateClient(S1) @ #i & SessionCreateServer(S2) @ #j & #j < #i) ==> not(Ex #k1 #k2. K(S1) @ #k1 & K(S2) @ #k2)" | |
// | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you very much for sharing this readable example of how to use Tamarin :)