(* 

? -> A : pkB
A -> B : { N_A, pkA }_pkB
B -> A : { N_A, N_B, pkB }_pkA
A -> B : { N_B }_pkB
B -> A : { S }_hNa,Nb

This protocol takes into account Lowe's correction.

*)

pred c/1 decompData, elimVar.

(* Public key cryptography *)

fun pk/1.
fun encrypt/2.
(* reduc decrypt(encrypt(x,pk(y)),y) = x. *)

(* Hash function *)

fun hash/2.

(* Shared-key cryptography *)

fun sencrypt/2.
(* reduc sdecrypt(sencrypt(x,y),y) = x. *)

query c:secret[].

reduc

c:encrypt(Nb[encrypt((v6,pk(skA[])),pk(skB[]))],pk(skB[])) & c:encrypt((v6,pk(skA[])),pk(skB[])) -> c:sencrypt(secret[],hash(v6,Nb[encrypt((v6,pk(skA[])),pk(skB[]))]));
c:encrypt((v4,v5),pk(skB[])) -> c:encrypt((v4,Nb[encrypt((v4,v5),pk(skB[]))],pk(skB[])),v5);
c:encrypt((Na[v3],v2,v3),pk(skA[])) & c:v3 -> c:encrypt(v2,v3);
c:v1 -> c:encrypt((Na[v1],pk(skA[])),v1);
c:pk(skB[]);
c:pk(skA[]);
c:c[];

(* The attacker *)

c:any7 & c:any6 -> c:sencrypt(any7,any6);
c:encrypt(x,pk(y)) & c:y -> c:x;
c:any5 -> c:pk(any5);
c:any4 & c:any3 -> c:encrypt(any4,any3);
c:any2 & c:any1 -> c:hash(any2,any1);
c:sencrypt(x,y) & c:y -> c:x.

(* EXPECTPV
RESULT goal unreachable: c:secret[]
0.008s (user 0.004s + system 0.004s), max rss 7996K
END *)
