Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Isabelle/HOL/Auth/Smartcard/   (Beweissystem Isabelle Version 2025-1©)  Datei vom 16.11.2025 mit Größe 14 kB image not shown  

Quelle  Smartcard.thy   Sprache: Isabelle

 
(* Author:     Giampaolo Bella, Catania University
*)


section\<open>Theory of smartcards\<close>

theory
imports "..All_Symmetric"
begin EventSC/java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34

text\<open>\<close>
smartcards   
supersedes theory Private:" >key"and

An     : agent  (*pin to activate the smart cards*)
  in card 's being bad implies about herjava.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
,  independently  or.
\<close>

axiomatization
  shrK    :: inj  comment
  crdK    :: "card => key" and  (*smart cards' symmetric keys*)
  pin     :: "agent => key" and  (*pin to activate the smart cards*)

  (*Mostly for Shoup-Rubin*)    [] (A  (,) (=A& ) java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
"agent* =nat java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
  pairK   :: "agent * agent => key"
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
inj_shrK   
  inj_crdKcrdK  comment
  inj_pin  injand

  (*pairK is injective on each component, if we assume encryption to be a PRF
    or at least collision free *)

  inj_pairK    [iff]: "(pairK(A,B) = pairK(A',B')) = (A = A' & B = B')" and
  comm_Pairkey [iff]: "Pairkey(A,B) = Pairkey(B,A)" and

  (*long-term keys differ from each other*)
  pairK_disj_crdK [iff]: "pairK(A,B) \ crdK C" and
  pairK_disj_shrK [iff]:  rdK_disj_pin]:   "crdK C \ pin P"
pairK_disj_pin]:  pairK
  shrK_disj_crdK [iff= \stolen  :: " => " java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(*Server knows all long-term keys; adding cards' keys may be redundant but

definition legalUse :: "card => bool" (\<open>legalUse (_)\<close>) where
  "legalUse C == C \<notin> stolen"

primrec illegalUse :: "card  => bool" where
  illegalUse_def: "illegalUse (Card A) = ( (Card A \<in> stolen \<and> A \<in> bad)  \<or>  Card A \<in> cloned )"


text\<open>initState must be defined with care\<close>

overloading
  initState \<equiv> initState
begin

primrec initState where
(*Server knows all long-term keys; adding cards' keys may be redundant but
  helps prove crdK_in_initState and crdK_in_used to distinguish cards' keys
  from fresh (session) keys*)

  initState_Server:  "initState Server =
        (Key`(range shrK \<union> range crdK \<union> range pin \<union> range pairK)) \<union> 
        (Nonce`(range Pairkey))" |

(*Other agents know only their own*)
  initState_Friend:  "initState (Friend i) = {Key (pin (Friend i))}" |

(*Spy knows bad agents' pins, cloned cards' keys, pairKs, and Pairkeys *)
  initState_Spy: "initState Spy =
                 (Key`((pin`bad) \<union> (pin `{A. Card A \<in> cloned}) \<union> 
                                      (shrK`{A. Card A \<in> cloned}) \<union> 
                        (crdK`cloned) \<union> 
                        (pairK`{(X,A). Card A \<in> cloned})))
           \<union> (Nonce`(Pairkey`{(A,B). Card A \<in> cloned & Card B \<in> cloned}))"

end

text\<open>Still relying on axioms\<close>
axiomatization where
  Key_supply_ax:  "finite KK \ \ K. K \ KK & Key K \ used evs" and

  (*Needed because of Spy's knowledge of Pairkeys*)
  Nonce_supply_ax: "finite NN \ \ N. N \ NN & Nonce N \ used evs"







subsection\<open>Basic properties of shrK\<close>

(*Injectiveness: Agents' long-term keys are distinct.*)
declare inj_shrK [THEN inj_eq, iff]
declare inj_crdK [THEN inj_eq, iff]
declare inj_pin  [THEN inj_eq, iff]

lemma invKey_K [simp]: "invKey K = K"
apply (insert isSym_keys)
apply (simp add: symKeys_def) 
done


lemma analz_Decrypt' [dest]:
     "\ Crypt K X \ analz H; Key K \ analz H \ \ X \ analz H"
by auto

text\<open>Now cancel the \<open>dest\<close> attribute given to
 \<open>analz.Decrypt\<close> in its declaration.\<close>
declare analz.Decrypt [rule del]

text\<open>Rewrites should not refer to  \<^term>\<open>initState(Friend i)\<close> because
that is normal

text\<open>Added to extend initstate with set of nonces\<close>
lemma parts_image_Nonce
  by auto

lemma  initState_Friend  " (Friend i) = {Key( (Friend i))}"|
unfolding keysFor_def
apply (induct_tac "C", auto)
done

(*Specialized to shared-key model: no @{term invKey}*) "nitState Spy =java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
lemma:
     "\ K \ keysFor (parts (insert X G)); X \ synth (analz H) \
     \<Longrightarrow> K \<in> keysFor (parts (G \<union> H)) | Key K \<in> parts H"
                        `cloned

lemma Crypt_imp_keysFor
by (drule


\open ""\<close>

(*Spy knows the pins of bad agents!*)
lemma( because 's of Pairkeys*java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
apply ( "evs"java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
 (simp_all) add  knows_Cons: eventsplit
done

(*Spy knows the long-term keys of cloned cards!*)  the keys cloned!*)
!]: 
     "Card A \ cloned \ Key (crdK (Card A)) \ knows Spy evs &
Key A)\<
                           Key (pin A)  \<in> knows Spy evs &  
                          \<>   (pairKjava.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
apply java.lang.NullPointerException
 (simp_all (no_asm_simp) add: imageI split event)
donetextopen> should refer  \<^term>\<open>initState(Friend i)\<close> because

lemma Spy_knows_cloned1\<open>Added to extend initstate with set of nonces\<close>
 induct_tac
apply ( java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
done

 Spy_knows_cloned2!] 
   \<Longrightarrow> Nonce (Pairkey(A,B))\<in> knows Spy evs"
apply (induct_tac
apply (simp_all (no_asm_simp:


(*Spy only knows pins of bad agents!*)
lemma[!] 
apply (induct_tac "evs")
apply (simp_all
done


(*For case analysis on whether or not an agent is compromised*)
lemma Crypt_Spy_analz_bad: 
  \lbrakkCryptjava.lang.NullPointerException

apply (force dest!: analz.Decrypt
done

(** Fresh keys never clash with other keys **) [!]: 

lemma []: Key)
apply (induct_tac "A")
apply 
done

lemma shrK_in_used [iff\<forall> B. Key (pairK(B,A)) \<in> knows Spy evs)"
apply (rule initState_into_used "evs")
apply blast
done

lemmaSpy_knows_cloned1!]: "C cloned \ Key (crdK C) \ knows Spy evs"
apply (induct_tac "A")
apply auto
done

lemma crdK_in_used [iffsimp_all : imageI: event
apply java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
apply blast
done

 pin_in_initState]: "ey pin
apply (induct_tac "java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
apply auto
done

lemma ( "evs")
apply ( initState_into_used
apply blast
done

lemma pairK_in_initState [iff]: lemma
apply (induct_tac "X")
apply auto
done

lemma pairK_in_used [iff]: "Key (pairK X) \ used evs"
apply (rule      <> X <inanalz Spy
apply blastforce.Decrypt
done



lemma shrK_in_initState [iff]: "Key (shrK A) \<in> initState Server"
  from long-term shared keys*)

lemma java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 10
by blast

lemmajava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
by blast

applyjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
apply clarify
done

  []:" <> evs\<>crdKC\
apply clarify
done  [iffpin

lemma [simp 
apply clarifyjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
done

lemmajava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
apply clarify
done

lemma [simpKeyjava.lang.StringIndexOutOfBoundsException: Index 95 out of bounds for length 95
 clarify
done

lemma  [simp
apply clarify
done

 shrK_neq, simp
declareclarify
declare
declare  [THEN,simp


subsection\<open>Fresh nonces\<close>

lemma Nonce_notin_initState [iff]: "Nonce N \ parts (initState (Friend i))"
by auto


(*This lemma no longer holds of smartcard protocols, where the cards can store]Key\java.lang.StringIndexOutOfBoundsException: Index 95 out of bounds for length 95
  nonces.

lemma Nonce_notin_used_empty [simp]: "Nonce N \<notin> used []"
unfolding used_Nil
done

So, we must use old-style supply fresh nonce theorems relying on the appropriate axiom*)



subsection\<open>Supply fresh nonces for possibility theorems.\<close>


lemmaNonce_supply1java.lang.NullPointerException

done

lemma
  \<exists>N N'. Nonce N \<notin> used evs & Nonce N' \<notin> used evs' & N \<noteq> N'"
apply (
apply (erule exE
apply (cut_tac  nonces
apply auto
done


lemma Nonce_supply3: "\N N' N''. Nonce N \ used evs & Nonce N' \ used evs' &
                    Nonce N'java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
apply cut_tac  inemptyI])
apply (erule exE)
apply (cut_tac evs = evs' and a1 = Njava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
apply erule
apply (cut_tac exE
apply blast
done

lemma" .N\java.lang.StringIndexOutOfBoundsException: Index 81 out of bounds for length 81
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
apply ( someI blast
done                     N'' <notin> used evs'' & N \<noteq> N' & N' \<noteq> N'' & N \<noteq> N''"



textcut_tacevs    finite Nonce_supply_ax
    ^>\<open>finite KK \<Longrightarrow> \<exists>K. K \<notin> KK & Key K \<notin> used evs\<close>.
    We have infinitely apply(cut_tac  ''and   a2 finite finite  finite Nonce_supply_ax
    long-term
    possibility Nonce notin


\<>Specialized Theorems ^term>\<open>analz\<close> and Image\<close>

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
by blast

lemma subset_Compl_range_crdK: "A \ - (range crdK) \ crdK x \ A"
applyblast
done

lemma     long-term from allnatural  Instead
apply blast
done

lemma java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
apply blast
done
lemma" (Key K Key`{}\java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
by blast: "

lemma insert_Key_image
by blast

(** Reverse the normal simplification of "image" to build up (not break down)
    the set of keys.  Use analz_insert_eq with (Un_upper2 RS analz_mono) to
    erase occurrences of forwarded message components (X). **)


lemmas =
       simp_thmslemma"nsertKeyK =Key ` K
       disj_comms
image_insert] image_Un]empty_subsetI
       analz_insert_eq Un_upper2 [THEN analz_mono
       insert_Key_singleton 
       subset_Compl_range_pin subset_Compl_range_pairK
       Key_not_used insert_Key_image Un_assoc [THEN    erase

(*Lemma for the trivial direction of the if-and-only-if*)
 analz_image_freshK_lemma
> analz (Key`nE \<union> H)) \<longrightarrow> (K \<in> nE | Key K \<in> analz H)  \<Longrightarrow>  
         (Key K \<in> analz (Key`nE \<union> H)) = (K \<in> nE | Key K \<in> analz H)"
by (blast java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54


subsection

ML
\<open>
structurejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
struct

(*Omitting used_Says makes the tactic much faster: it leaves expressions\<open>
    such as  Nonce ?N \<notin> used evs that match Nonce_supply*)

fun possibility_tacjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   (REPEAT 
    (ALLGOALS
 @ }
      |> 
           (resolve_tac ]))
     REPEAT_FIRST'
resolve_tac[, , @thmjava.lang.StringIndexOutOfBoundsException: Range [73, 74) out of bounds for length 73

(*For harder protocols (such as Recur) where we have to set up some
  nonces and keys initially*)

fun basic_possibility_tac
    REPEAT 
    (ALLGOALS
     java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
REPEAT_FIRST (resolve_tac [reflconjI]))

val analz_image_freshK_ss
  simpset_of
(contextSimplifier image_insert
byauto
               |> Simplifier
end
\<close>



lemma invKey_shrK_iff   thms},
" ( K)\in )=( K
by auto

(*Specialized methods*)

 java.lang.NullPointerException
    Scan
     (SIMPLE_METHOD ( ctxt
EVERY  ctxt  ballI,
          REPEAT_FIRST (resolve_tac ctxt @{thms" "
          ALLGOALS method_setup = \<open>
" proving the Session Compromise theorem"

method_setup         (Smartcard ctxt)\<close>
    Scan.succeed (fn
        lemmaknows_subset_knows_Cons" A evs \ knows A (e # evs)"
    "for proving possibility theorems"

method_setup basic_possibility = \<open>
    Scan.succeed [THEN,]
SIMPLE_METHODbasic_possibility_tac
    "for proving possibility theorems"

lemma knows_subset_knows_Cons[ not_sym
by  pairK_disj_pin, ]

(*Needed for actual protocols that will follow*)
declare [iff []
declare shrK_disj_pin
declare pairK_disj_shrK[THEN not_sym, iff]
declare pairK_disj_crdK[THEN not_sym, iff]
declare pairK_disj_pin[THEN not_sym, iff]
declare crdK_disj_pin[THEN not_sym, iff]

declare legalUse_def [iff] illegalUse_def [iff]

end

100%


¤ 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.0.7Bemerkung:  ¤

*© 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 ist noch experimentell.