Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Isabelle/HOL/Auth/   (Beweissystem Isabelle Version 2025-1©)  Datei vom 16.11.2025 mit GrรถรŸe 19 kB image not shown  

Quelle  ZhouGollmann.thy

  Sprache: Isabelle
 

(*  Title:      HOL/Auth/ZhouGollmann.thy
  Author: Giampaolo Bella and L C Paulson, Cambridge Univ Computer Lab
  Copyright 2003 University of Cambridge
 
 The protocol of
  Jianying Zhou and Dieter Gollmann,
  A Fair Non-Repudiation Protocol,
  Security and Privacy 1996 (Oakland)
  55-61
*)

theory ZhouGollmann imports Public begin

abbreviation
  TTP :: agent where "TTP == Server"

abbreviation f_sub :: nat where "f_sub == 5"
abbreviation f_nro :: nat where "f_nro == 2"
abbreviation f_nrr :: nat where "f_nrr == 3"
abbreviation f_con :: nat where "f_con == 4"


definition broken :: "agent set" where    
    ๐Ÿ‹ โ€นthe compromised honest agents; TTP is included as it's not allowed to
  use the protocolโ€บ
   "broken == bad - {Spy}"

declare broken_def [simp]

inductive_set zg :: "event list set"
  where

  Nil:  "[] โˆˆ zg"

| Fake: "[evsf โˆˆ zg; X โˆˆ synth (analz (spies evsf))]
         ==> Says Spy B X # evsf โˆˆ zg"

| Reception:  "[evsr โˆˆ zg; Says A B X โˆˆ set evsr] ==> Gets B X # evsr โˆˆ zg"

  (*L is fresh for honest agents.
  We don't require K to be fresh because we don't bother to prove secrecy!
  We just assume that the protocol's objective is to deliver K fairly,
    rather than to keep M secret.*)
| ZG1: "[evs1 โˆˆ zg; Nonce L โˆ‰ used evs1; C = Crypt K (Number m);
           K โˆˆ symKeys;
           NRO = Crypt (priK A) {Number f_nro, Agent B, Nonce L, C}]
       ==> Says A B {Number f_nro, Agent B, Nonce L, C, NRO} # evs1 โˆˆ zg"

  (*B must check that NRO is A's signature to learn the sender's name*)
| ZG2: "[evs2 โˆˆ zg;
           Gets B {Number f_nro, Agent B, Nonce L, C, NRO} โˆˆ set evs2;
           NRO = Crypt (priK A) {Number f_nro, Agent B, Nonce L, C};
           NRR = Crypt (priK B) {Number f_nrr, Agent A, Nonce L, C}]
       ==> Says B A {Number f_nrr, Agent A, Nonce L, NRR} # evs2 โˆˆ zg"

  (*A must check that NRR is B's signature to learn the sender's name;
    without spy, the matching label would be enough*)
| ZG3: "[evs3 โˆˆ zg; C = Crypt K M; K โˆˆ symKeys;
           Says A B {Number f_nro, Agent B, Nonce L, C, NRO} โˆˆ set evs3;
           Gets A {Number f_nrr, Agent A, Nonce L, NRR} โˆˆ set evs3;
           NRR = Crypt (priK B) {Number f_nrr, Agent A, Nonce L, C};
           sub_K = Crypt (priK A) {Number f_sub, Agent B, Nonce L, Key K}]
       ==> Says A TTP {Number f_sub, Agent B, Nonce L, Key K, sub_K}
             # evs3 โˆˆ zg"

 (*TTP checks that sub_K is A's signature to learn who issued K, then
  gives credentials to A and B. The Notes event models the availability of
  the credentials, but the act of fetching them is not modelled. We also
  give con_K to the Spy. This makes the threat model more dangerous, while
  also allowing lemma @{text Crypt_used_imp_spies} to omit the condition
   @{term "K \<noteq> priK TTP"}. *)
| ZG4: "[evs4 โˆˆ zg; K โˆˆ symKeys;
           Gets TTP {Number f_sub, Agent B, Nonce L, Key K, sub_K}
             โˆˆ set evs4;
           sub_K = Crypt (priK A) {Number f_sub, Agent B, Nonce L, Key K};
           con_K = Crypt (priK TTP) {Number f_con, Agent A, Agent B,
                                      Nonce L, Key K}]
       ==> Says TTP Spy con_K
           #
           Notes TTP {Number f_con, Agent A, Agent B, Nonce L, Key K, con_K}
           # evs4 โˆˆ zg"


declare Says_imp_knows_Spy [THEN analz.Inj, dest]
declare Fake_parts_insert_in_Un  [dest]
declare analz_into_parts [dest]

declare symKey_neq_priEK [simp]
declare symKey_neq_priEK [THEN not_sym, simp]


textโ€นA "possibility property": there are traces that reach the endโ€บ
lemma "[A โ‰  B; TTP โ‰  A; TTP โ‰  B; K โˆˆ symKeys] ==>
     โˆƒL. โˆƒevs โˆˆ zg.
           Notes TTP {Number f_con, Agent A, Agent B, Nonce L, Key K,
               Crypt (priK TTP) {Number f_con, Agent A, Agent B, Nonce L, Key K}}
               โˆˆ set evs"
apply (intro exI bexI)
apply (rule_tac [2] zg.Nil
                    [THEN zg.ZG1, THEN zg.Reception [of _ A B],
                     THEN zg.ZG2, THEN zg.Reception [of _ B A],
                     THEN zg.ZG3, THEN zg.Reception [of _ A TTP], 
                     THEN zg.ZG4])
apply (basic_possibility, auto)
done

subsection โ€นBasic Lemmasโ€บ

lemma Gets_imp_Says:
     "[Gets B X โˆˆ set evs; evs โˆˆ zg] ==> โˆƒA. Says A B X โˆˆ set evs"
apply (erule rev_mp)
apply (erule zg.induct, auto)
done

lemma Gets_imp_knows_Spy:
     "[Gets B X โˆˆ set evs; evs โˆˆ zg] ==> X โˆˆ spies evs"
by (blast dest!: Gets_imp_Says Says_imp_knows_Spy)


textโ€นLets us replace proofs about ๐Ÿ‹โ€นused evsโ€บ by simpler proofs
 about ๐Ÿ‹โ€นparts (spies evs)โ€บ.โ€บ
lemma Crypt_used_imp_spies:
     "[Crypt K X โˆˆ used evs; evs โˆˆ zg]
      ==> Crypt K X โˆˆ parts (spies evs)"
apply (erule rev_mp)
apply (erule zg.induct)
apply (simp_all add: parts_insert_knows_A) 
done

lemma Notes_TTP_imp_Gets:
     "[Notes TTP {Number f_con, Agent A, Agent B, Nonce L, Key K, con_K}
           โˆˆ set evs;
        sub_K = Crypt (priK A) {Number f_sub, Agent B, Nonce L, Key K};
        evs โˆˆ zg]
    ==> Gets TTP {Number f_sub, Agent B, Nonce L, Key K, sub_K} โˆˆ set evs"
apply (erule rev_mp)
apply (erule zg.induct, auto)
done

textโ€นFor reasoning about C, which is encrypted in message ZG2โ€บ
lemma ZG2_msg_in_parts_spies:
     "[Gets B {F, B', L, C, X} โˆˆ set evs; evs โˆˆ zg]
      ==> C โˆˆ parts (spies evs)"
by (blast dest: Gets_imp_Says)

(*classical regularity lemma on priK*)
lemma Spy_see_priK [simp]:
     "evs โˆˆ zg ==> (Key (priK A) โˆˆ parts (spies evs)) = (A โˆˆ bad)"
apply (erule zg.induct)
apply (frule_tac [5] ZG2_msg_in_parts_spies, auto)
done

textโ€นSo that blast can use it tooโ€บ
declare  Spy_see_priK [THEN [2] rev_iffD1, dest!]

lemma Spy_analz_priK [simp]:
     "evs โˆˆ zg ==> (Key (priK A) โˆˆ analz (spies evs)) = (A โˆˆ bad)"
by auto 


subsectionโ€นAbout NRO: Validity for ๐Ÿ‹โ€นBโ€บ\
textโ€นBelow we prove that if ๐Ÿ‹โ€นNROโ€บ exists then ๐Ÿ‹โ€นAโ€บ
definitely
 sent it, provided ๐Ÿ‹โ€นAโ€บ is not broken.โ€บ

textโ€นStrong conclusion for a good agentโ€บ
lemma NRO_validity_good:
     "[NRO = Crypt (priK A) {Number f_nro, Agent B, Nonce L, C};
        NRO โˆˆ parts (spies evs);
        A โˆ‰ bad; evs โˆˆ zg]
     ==> Says A B {Number f_nro, Agent B, Nonce L, C, NRO} โˆˆ set evs"
apply clarify
apply (erule rev_mp)
apply (erule zg.induct)
apply (frule_tac [5] ZG2_msg_in_parts_spies, auto)  
done

lemma NRO_sender:
     "[Says A' B {n, b, l, C, Crypt (priK A) X} โˆˆ set evs; evs โˆˆ zg]
    ==> A' โˆˆ {A,Spy}"
apply (erule rev_mp)  
apply (erule zg.induct, simp_all)
done

textโ€นHolds also for ๐Ÿ‹โ€นA = Spyโ€บ!โ€บ
theorem NRO_validity:
     "[Gets B {Number f_nro, Agent B, Nonce L, C, NRO} โˆˆ set evs;
        NRO = Crypt (priK A) {Number f_nro, Agent B, Nonce L, C};
        A โˆ‰ broken; evs โˆˆ zg]
     ==> Says A B {Number f_nro, Agent B, Nonce L, C, NRO} โˆˆ set evs"
apply (drule Gets_imp_Says, assumption) 
apply clarify 
apply (frule NRO_sender, auto)
txtโ€นWe are left with the case where the sender is ๐Ÿ‹โ€นSpyโ€บ and not
  equal to ๐Ÿ‹โ€นAโ€บ, because ๐Ÿ‹โ€นA โˆ‰ badโ€บ.
  Thus theorem โ€นNRO_validity_goodโ€บ applies.โ€บ
apply (blast dest: NRO_validity_good [OF refl])
done


subsectionโ€นAbout NRR: Validity for ๐Ÿ‹โ€นAโ€บ\โ€บ

textโ€นBelow we prove that if ๐Ÿ‹โ€นNRRโ€บ exists then ๐Ÿ‹โ€นBโ€บ definitely
 sent it, provided ๐Ÿ‹โ€นBโ€บ is not broken.โ€บ

textโ€นStrong conclusion for a good agentโ€บ
lemma NRR_validity_good:
     "[NRR = Crypt (priK B) {Number f_nrr, Agent A, Nonce L, C};
        NRR โˆˆ parts (spies evs);
        B โˆ‰ bad; evs โˆˆ zg]
     ==> Says B A {Number f_nrr, Agent A, Nonce L, NRR} โˆˆ set evs"
apply clarify
apply (erule rev_mp)
apply (erule zg.induct) 
apply (frule_tac [5] ZG2_msg_in_parts_spies, auto)  
done

lemma NRR_sender:
     "[Says B' A {n, a, l, Crypt (priK B) X} โˆˆ set evs; evs โˆˆ zg]
    ==> B' โˆˆ {B,Spy}"
apply (erule rev_mp)  
apply (erule zg.induct, simp_all)
done

textโ€นHolds also for ๐Ÿ‹โ€นB = Spyโ€บ!โ€บ
theorem NRR_validity:
     "[Says B' A {Number f_nrr, Agent A, Nonce L, NRR} โˆˆ set evs;
        NRR = Crypt (priK B) {Number f_nrr, Agent A, Nonce L, C};
        B โˆ‰ broken; evs โˆˆ zg]
    ==> Says B A {Number f_nrr, Agent A, Nonce L, NRR} โˆˆ set evs"
apply clarify 
apply (frule NRR_sender, auto)
txtโ€นWe are left with the case where ๐Ÿ‹โ€นB' = Spyโ€บ and ๐Ÿ‹โ€นB' โ‰  Bโ€บ,
  i.e. ๐Ÿ‹โ€นB โˆ‰ badโ€บ, when we can apply โ€นNRR_validity_goodโ€บ.โ€บ
 apply (blast dest: NRR_validity_good [OF refl])
done


subsectionโ€นProofs About ๐Ÿ‹โ€นsub_Kโ€บ\โ€บ

textโ€นBelow we prove that if ๐Ÿ‹โ€นsub_Kโ€บ exists then ๐Ÿ‹โ€นAโ€บ definitely
 sent it, provided ๐Ÿ‹โ€นAโ€บ is not broken.โ€บ

textโ€นStrong conclusion for a good agentโ€บ
lemma sub_K_validity_good:
     "[sub_K = Crypt (priK A) {Number f_sub, Agent B, Nonce L, Key K};
        sub_K โˆˆ parts (spies evs);
        A โˆ‰ bad; evs โˆˆ zg]
     ==> Says A TTP {Number f_sub, Agent B, Nonce L, Key K, sub_K} โˆˆ set evs"
apply clarify
apply (erule rev_mp)
apply (erule zg.induct)
apply (frule_tac [5] ZG2_msg_in_parts_spies, simp_all)
txtโ€นFakeโ€บ
apply (blast dest!: Fake_parts_sing_imp_Un)
done

lemma sub_K_sender:
     "[Says A' TTP {n, b, l, k, Crypt (priK A) X} โˆˆ set evs; evs โˆˆ zg]
    ==> A' โˆˆ {A,Spy}"
apply (erule rev_mp)  
apply (erule zg.induct, simp_all)
done

textโ€นHolds also for ๐Ÿ‹โ€นA = Spyโ€บ!โ€บ
theorem sub_K_validity:
     "[Gets TTP {Number f_sub, Agent B, Nonce L, Key K, sub_K} โˆˆ set evs;
        sub_K = Crypt (priK A) {Number f_sub, Agent B, Nonce L, Key K};
        A โˆ‰ broken; evs โˆˆ zg]
     ==> Says A TTP {Number f_sub, Agent B, Nonce L, Key K, sub_K} โˆˆ set evs"
apply (drule Gets_imp_Says, assumption) 
apply clarify 
apply (frule sub_K_sender, auto)
txtโ€นWe are left with the case where the sender is ๐Ÿ‹โ€นSpyโ€บ and not
  equal to ๐Ÿ‹โ€นAโ€บ, because ๐Ÿ‹โ€นA โˆ‰ badโ€บ.
  Thus theorem โ€นsub_K_validity_goodโ€บ applies.โ€บ
apply (blast dest: sub_K_validity_good [OF refl])
done



subsectionโ€นProofs About ๐Ÿ‹โ€นcon_Kโ€บ\โ€บ

textโ€นBelow we prove that if ๐Ÿ‹โ€นcon_Kโ€บ exists, then ๐Ÿ‹โ€นTTPโ€บ has it,
 and therefore ๐Ÿ‹โ€นAโ€บ and ๐Ÿ‹โ€นBโ€บ) can get it too. Moreover, we know
 that ๐Ÿ‹โ€นAโ€บ sent ๐Ÿ‹โ€นsub_Kโ€บ\โ€บ

lemma con_K_validity:
     "[con_K โˆˆ used evs;
        con_K = Crypt (priK TTP)
                  {Number f_con, Agent A, Agent B, Nonce L, Key K};
        evs โˆˆ zg]
    ==> Notes TTP {Number f_con, Agent A, Agent B, Nonce L, Key K, con_K}
          โˆˆ set evs"
apply clarify
apply (erule rev_mp)
apply (erule zg.induct)
apply (frule_tac [5] ZG2_msg_in_parts_spies, simp_all)
txtโ€นFakeโ€บ
apply (blast dest!: Fake_parts_sing_imp_Un)
txtโ€นZG2โ€บ
apply (blast dest: parts_cut)
done

textโ€นIf ๐Ÿ‹โ€นTTPโ€บ holds ๐Ÿ‹โ€นcon_Kโ€บ then ๐Ÿ‹โ€นAโ€บ sent
  ๐Ÿ‹โ€นsub_Kโ€บ. We assume that ๐Ÿ‹โ€นAโ€บ is not broken. Importantly, nothing
  needs to be assumed about the form of ๐Ÿ‹โ€นcon_Kโ€บ!โ€บ
lemma Notes_TTP_imp_Says_A:
     "[Notes TTP {Number f_con, Agent A, Agent B, Nonce L, Key K, con_K}
           โˆˆ set evs;
        sub_K = Crypt (priK A) {Number f_sub, Agent B, Nonce L, Key K};
        A โˆ‰ broken; evs โˆˆ zg]
     ==> Says A TTP {Number f_sub, Agent B, Nonce L, Key K, sub_K} โˆˆ set evs"
apply clarify
apply (erule rev_mp)
apply (erule zg.induct)
apply (frule_tac [5] ZG2_msg_in_parts_spies, simp_all)
txtโ€นZG4โ€บ
apply clarify 
apply (rule sub_K_validity, auto) 
done

textโ€นIf ๐Ÿ‹โ€นcon_Kโ€บ exists, then ๐Ÿ‹โ€นAโ€บ sent ๐Ÿ‹โ€นsub_Kโ€บ. We again
  assume that ๐Ÿ‹โ€นAโ€บ is not broken.โ€บ
theorem B_sub_K_validity:
     "[con_K โˆˆ used evs;
        con_K = Crypt (priK TTP) {Number f_con, Agent A, Agent B,
                                   Nonce L, Key K};
        sub_K = Crypt (priK A) {Number f_sub, Agent B, Nonce L, Key K};
        A โˆ‰ broken; evs โˆˆ zg]
     ==> Says A TTP {Number f_sub, Agent B, Nonce L, Key K, sub_K} โˆˆ set evs"
by (blast dest: con_K_validity Notes_TTP_imp_Says_A)


subsectionโ€นProving fairnessโ€บ

textโ€นCannot prove that, if ๐Ÿ‹โ€นBโ€บ has NRO, then ๐Ÿ‹โ€นAโ€บ has her NRR.
 It would appear that ๐Ÿ‹โ€นBโ€บ has a small advantage, though it is
 useless to win disputes: ๐Ÿ‹โ€นBโ€บ needs to present ๐Ÿ‹โ€นcon_Kโ€บ as well.โ€บ

textโ€นStrange: unicity of the label protects ๐Ÿ‹โ€นAโ€บ?โ€บ
lemma A_unicity: 
     "[NRO = Crypt (priK A) {Number f_nro, Agent B, Nonce L, Crypt K M};
        NRO โˆˆ parts (spies evs);
        Says A B {Number f_nro, Agent B, Nonce L, Crypt K M', NRO'}
          โˆˆ set evs;
        A โˆ‰ bad; evs โˆˆ zg]
     ==> M'=M"
apply clarify
apply (erule rev_mp)
apply (erule rev_mp)
apply (erule zg.induct)
apply (frule_tac [5] ZG2_msg_in_parts_spies, auto) 
txtโ€นZG1: freshnessโ€บ
apply (blast dest: parts.Body) 
done


textโ€นFairness lemma: if ๐Ÿ‹โ€นsub_Kโ€บ exists, then ๐Ÿ‹โ€นAโ€บ holds
 NRR. Relies on unicity of labels.โ€บ
lemma sub_K_implies_NRR:
     "[NRO = Crypt (priK A) {Number f_nro, Agent B, Nonce L, Crypt K M};
         NRR = Crypt (priK B) {Number f_nrr, Agent A, Nonce L, Crypt K M};
         sub_K โˆˆ parts (spies evs);
         NRO โˆˆ parts (spies evs);
         sub_K = Crypt (priK A) {Number f_sub, Agent B, Nonce L, Key K};
         A โˆ‰ bad; evs โˆˆ zg]
     ==> Gets A {Number f_nrr, Agent A, Nonce L, NRR} โˆˆ set evs"
apply clarify
apply hypsubst_thin
apply (erule rev_mp)
apply (erule rev_mp)
apply (erule zg.induct)
apply (frule_tac [5] ZG2_msg_in_parts_spies, simp_all)
txtโ€นFakeโ€บ
apply blast 
txtโ€นZG1: freshnessโ€บ
apply (blast dest: parts.Body) 
txtโ€นZG3โ€บ
apply (blast dest: A_unicity [OF refl]) 
done


lemma Crypt_used_imp_L_used:
     "[Crypt (priK TTP) {F, A, B, L, K} โˆˆ used evs; evs โˆˆ zg]
      ==> L โˆˆ used evs"
apply (erule rev_mp)
apply (erule zg.induct, auto)
txtโ€นFakeโ€บ
apply (blast dest!: Fake_parts_sing_imp_Un)
txtโ€นZG2: freshnessโ€บ
apply (blast dest: parts.Body) 
done


textโ€นFairness for ๐Ÿ‹โ€นAโ€บ: if ๐Ÿ‹โ€นcon_Kโ€บ and ๐Ÿ‹โ€นNROโ€บ exist,
 then ๐Ÿ‹โ€นAโ€บ holds NRR. ๐Ÿ‹โ€นAโ€บ must be uncompromised, but there is no
 assumption about ๐Ÿ‹โ€นBโ€บ.โ€บ
theorem A_fairness_NRO:
     "[con_K โˆˆ used evs;
        NRO โˆˆ parts (spies evs);
        con_K = Crypt (priK TTP)
                      {Number f_con, Agent A, Agent B, Nonce L, Key K};
        NRO = Crypt (priK A) {Number f_nro, Agent B, Nonce L, Crypt K M};
        NRR = Crypt (priK B) {Number f_nrr, Agent A, Nonce L, Crypt K M};
        A โˆ‰ bad; evs โˆˆ zg]
    ==> Gets A {Number f_nrr, Agent A, Nonce L, NRR} โˆˆ set evs"
apply clarify
apply (erule rev_mp)
apply (erule rev_mp)
apply (erule zg.induct)
apply (frule_tac [5] ZG2_msg_in_parts_spies, simp_all)
   txtโ€นFakeโ€บ
   apply (simp add: parts_insert_knows_A) 
   apply (blast dest: Fake_parts_sing_imp_Un) 
  txtโ€นZG1โ€บ
  apply (blast dest: Crypt_used_imp_L_used) 
 txtโ€นZG2โ€บ
 apply (blast dest: parts_cut)
txtโ€นZG4โ€บ
apply (blast intro: sub_K_implies_NRR [OF refl] 
             dest: Gets_imp_knows_Spy [THEN parts.Inj])
done

textโ€นFairness for ๐Ÿ‹โ€นBโ€บ: NRR exists at all, then ๐Ÿ‹โ€นBโ€บ holds NRO.
 ๐Ÿ‹โ€นBโ€บ must be uncompromised, but there is no assumption about ๐Ÿ‹โ€นAโ€บ.โ€บ
theorem B_fairness_NRR:
     "[NRR โˆˆ used evs;
        NRR = Crypt (priK B) {Number f_nrr, Agent A, Nonce L, C};
        NRO = Crypt (priK A) {Number f_nro, Agent B, Nonce L, C};
        B โˆ‰ bad; evs โˆˆ zg]
    ==> Gets B {Number f_nro, Agent B, Nonce L, C, NRO} โˆˆ set evs"
apply clarify
apply (erule rev_mp)
apply (erule zg.induct)
apply (frule_tac [5] ZG2_msg_in_parts_spies, simp_all)
txtโ€นFakeโ€บ
apply (blast dest!: Fake_parts_sing_imp_Un)
txtโ€นZG2โ€บ
apply (blast dest: parts_cut)
done


textโ€นIf ๐Ÿ‹โ€นcon_Kโ€บ exists at all, then ๐Ÿ‹โ€นBโ€บ can get it, by โ€นcon_K_validityโ€บ. Cannot conclude that also NRO is available to ๐Ÿ‹โ€นBโ€บ,
 because if ๐Ÿ‹โ€นAโ€บ were unfair, ๐Ÿ‹โ€นAโ€บ could build message 3 without
 building message 1, which contains NRO.โ€บ

end

Messung V0.5 in Prozent
C=65 H=40 G=53

ยค Dauer der Verarbeitung: 0.12 Sekunden  (vorverarbeitet am  2026-04-28) ยค

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfรคltig zusammengestellt. Es wird jedoch weder Vollstรคndigkeit, noch Richtigkeit, noch Qualitรคt der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.