src/HOL/Auth/TLS.thy
changeset 32960 69916a850301
parent 29888 ab97183f1694
child 35416 d8d7d1b785af
equal deleted inserted replaced
32959:23a8c5ac35f8 32960:69916a850301
    34 decrypt, so the problem does not arise.
    34 decrypt, so the problem does not arise.
    35 
    35 
    36 Proofs would be simpler if ClientKeyExch included A's name within
    36 Proofs would be simpler if ClientKeyExch included A's name within
    37 Crypt KB (Nonce PMS).  As things stand, there is much overlap between proofs
    37 Crypt KB (Nonce PMS).  As things stand, there is much overlap between proofs
    38 about that message (which B receives) and the stronger event
    38 about that message (which B receives) and the stronger event
    39 	Notes A {|Agent B, Nonce PMS|}.
    39 Notes A {|Agent B, Nonce PMS|}.
    40 *)
    40 *)
    41 
    41 
    42 header{*The TLS Protocol: Transport Layer Security*}
    42 header{*The TLS Protocol: Transport Layer Security*}
    43 
    43 
    44 theory TLS imports Public Nat_Int_Bij begin
    44 theory TLS imports Public Nat_Int_Bij begin
   110           ==> Says Spy B X # evsf \<in> tls"
   110           ==> Says Spy B X # evsf \<in> tls"
   111 
   111 
   112  | SpyKeys: --{*The spy may apply @{term PRF} and @{term sessionK}
   112  | SpyKeys: --{*The spy may apply @{term PRF} and @{term sessionK}
   113                 to available nonces*}
   113                 to available nonces*}
   114          "[| evsSK \<in> tls;
   114          "[| evsSK \<in> tls;
   115 	     {Nonce NA, Nonce NB, Nonce M} <= analz (spies evsSK) |]
   115              {Nonce NA, Nonce NB, Nonce M} <= analz (spies evsSK) |]
   116           ==> Notes Spy {| Nonce (PRF(M,NA,NB)),
   116           ==> Notes Spy {| Nonce (PRF(M,NA,NB)),
   117 			   Key (sessionK((NA,NB,M),role)) |} # evsSK \<in> tls"
   117                            Key (sessionK((NA,NB,M),role)) |} # evsSK \<in> tls"
   118 
   118 
   119  | ClientHello:
   119  | ClientHello:
   120 	 --{*(7.4.1.2)
   120          --{*(7.4.1.2)
   121 	   PA represents @{text CLIENT_VERSION}, @{text CIPHER_SUITES} and @{text COMPRESSION_METHODS}.
   121            PA represents @{text CLIENT_VERSION}, @{text CIPHER_SUITES} and @{text COMPRESSION_METHODS}.
   122 	   It is uninterpreted but will be confirmed in the FINISHED messages.
   122            It is uninterpreted but will be confirmed in the FINISHED messages.
   123 	   NA is CLIENT RANDOM, while SID is @{text SESSION_ID}.
   123            NA is CLIENT RANDOM, while SID is @{text SESSION_ID}.
   124            UNIX TIME is omitted because the protocol doesn't use it.
   124            UNIX TIME is omitted because the protocol doesn't use it.
   125            May assume @{term "NA \<notin> range PRF"} because CLIENT RANDOM is 
   125            May assume @{term "NA \<notin> range PRF"} because CLIENT RANDOM is 
   126            28 bytes while MASTER SECRET is 48 bytes*}
   126            28 bytes while MASTER SECRET is 48 bytes*}
   127          "[| evsCH \<in> tls;  Nonce NA \<notin> used evsCH;  NA \<notin> range PRF |]
   127          "[| evsCH \<in> tls;  Nonce NA \<notin> used evsCH;  NA \<notin> range PRF |]
   128           ==> Says A B {|Agent A, Nonce NA, Number SID, Number PA|}
   128           ==> Says A B {|Agent A, Nonce NA, Number SID, Number PA|}
   129 	        # evsCH  \<in>  tls"
   129                 # evsCH  \<in>  tls"
   130 
   130 
   131  | ServerHello:
   131  | ServerHello:
   132          --{*7.4.1.3 of the TLS Internet-Draft
   132          --{*7.4.1.3 of the TLS Internet-Draft
   133 	   PB represents @{text CLIENT_VERSION}, @{text CIPHER_SUITE} and @{text COMPRESSION_METHOD}.
   133            PB represents @{text CLIENT_VERSION}, @{text CIPHER_SUITE} and @{text COMPRESSION_METHOD}.
   134            SERVER CERTIFICATE (7.4.2) is always present.
   134            SERVER CERTIFICATE (7.4.2) is always present.
   135            @{text CERTIFICATE_REQUEST} (7.4.4) is implied.*}
   135            @{text CERTIFICATE_REQUEST} (7.4.4) is implied.*}
   136          "[| evsSH \<in> tls;  Nonce NB \<notin> used evsSH;  NB \<notin> range PRF;
   136          "[| evsSH \<in> tls;  Nonce NB \<notin> used evsSH;  NB \<notin> range PRF;
   137              Says A' B {|Agent A, Nonce NA, Number SID, Number PA|}
   137              Says A' B {|Agent A, Nonce NA, Number SID, Number PA|}
   138 	       \<in> set evsSH |]
   138                \<in> set evsSH |]
   139           ==> Says B A {|Nonce NB, Number SID, Number PB|} # evsSH  \<in>  tls"
   139           ==> Says B A {|Nonce NB, Number SID, Number PB|} # evsSH  \<in>  tls"
   140 
   140 
   141  | Certificate:
   141  | Certificate:
   142          --{*SERVER (7.4.2) or CLIENT (7.4.6) CERTIFICATE.*}
   142          --{*SERVER (7.4.2) or CLIENT (7.4.6) CERTIFICATE.*}
   143          "evsC \<in> tls ==> Says B A (certificate B (pubK B)) # evsC  \<in>  tls"
   143          "evsC \<in> tls ==> Says B A (certificate B (pubK B)) # evsC  \<in>  tls"
   146          --{*CLIENT KEY EXCHANGE (7.4.7).
   146          --{*CLIENT KEY EXCHANGE (7.4.7).
   147            The client, A, chooses PMS, the PREMASTER SECRET.
   147            The client, A, chooses PMS, the PREMASTER SECRET.
   148            She encrypts PMS using the supplied KB, which ought to be pubK B.
   148            She encrypts PMS using the supplied KB, which ought to be pubK B.
   149            We assume @{term "PMS \<notin> range PRF"} because a clash betweem the PMS
   149            We assume @{term "PMS \<notin> range PRF"} because a clash betweem the PMS
   150            and another MASTER SECRET is highly unlikely (even though
   150            and another MASTER SECRET is highly unlikely (even though
   151 	   both items have the same length, 48 bytes).
   151            both items have the same length, 48 bytes).
   152            The Note event records in the trace that she knows PMS
   152            The Note event records in the trace that she knows PMS
   153                (see REMARK at top). *}
   153                (see REMARK at top). *}
   154          "[| evsCX \<in> tls;  Nonce PMS \<notin> used evsCX;  PMS \<notin> range PRF;
   154          "[| evsCX \<in> tls;  Nonce PMS \<notin> used evsCX;  PMS \<notin> range PRF;
   155              Says B' A (certificate B KB) \<in> set evsCX |]
   155              Says B' A (certificate B KB) \<in> set evsCX |]
   156           ==> Says A B (Crypt KB (Nonce PMS))
   156           ==> Says A B (Crypt KB (Nonce PMS))
   157 	      # Notes A {|Agent B, Nonce PMS|}
   157               # Notes A {|Agent B, Nonce PMS|}
   158 	      # evsCX  \<in>  tls"
   158               # evsCX  \<in>  tls"
   159 
   159 
   160  | CertVerify:
   160  | CertVerify:
   161 	--{*The optional Certificate Verify (7.4.8) message contains the
   161         --{*The optional Certificate Verify (7.4.8) message contains the
   162           specific components listed in the security analysis, F.1.1.2.
   162           specific components listed in the security analysis, F.1.1.2.
   163           It adds the pre-master-secret, which is also essential!
   163           It adds the pre-master-secret, which is also essential!
   164           Checking the signature, which is the only use of A's certificate,
   164           Checking the signature, which is the only use of A's certificate,
   165           assures B of A's presence*}
   165           assures B of A's presence*}
   166          "[| evsCV \<in> tls;
   166          "[| evsCV \<in> tls;
   167              Says B' A {|Nonce NB, Number SID, Number PB|} \<in> set evsCV;
   167              Says B' A {|Nonce NB, Number SID, Number PB|} \<in> set evsCV;
   168 	     Notes A {|Agent B, Nonce PMS|} \<in> set evsCV |]
   168              Notes A {|Agent B, Nonce PMS|} \<in> set evsCV |]
   169           ==> Says A B (Crypt (priK A) (Hash{|Nonce NB, Agent B, Nonce PMS|}))
   169           ==> Says A B (Crypt (priK A) (Hash{|Nonce NB, Agent B, Nonce PMS|}))
   170               # evsCV  \<in>  tls"
   170               # evsCV  \<in>  tls"
   171 
   171 
   172 	--{*Finally come the FINISHED messages (7.4.8), confirming PA and PB
   172         --{*Finally come the FINISHED messages (7.4.8), confirming PA and PB
   173           among other things.  The master-secret is PRF(PMS,NA,NB).
   173           among other things.  The master-secret is PRF(PMS,NA,NB).
   174           Either party may send its message first.*}
   174           Either party may send its message first.*}
   175 
   175 
   176  | ClientFinished:
   176  | ClientFinished:
   177         --{*The occurrence of Notes A {|Agent B, Nonce PMS|} stops the
   177         --{*The occurrence of Notes A {|Agent B, Nonce PMS|} stops the
   179           repaying messages sent by the true client; in that case, the
   179           repaying messages sent by the true client; in that case, the
   180           Spy does not know PMS and could not send ClientFinished.  One
   180           Spy does not know PMS and could not send ClientFinished.  One
   181           could simply put @{term "A\<noteq>Spy"} into the rule, but one should not
   181           could simply put @{term "A\<noteq>Spy"} into the rule, but one should not
   182           expect the spy to be well-behaved.*}
   182           expect the spy to be well-behaved.*}
   183          "[| evsCF \<in> tls;
   183          "[| evsCF \<in> tls;
   184 	     Says A  B {|Agent A, Nonce NA, Number SID, Number PA|}
   184              Says A  B {|Agent A, Nonce NA, Number SID, Number PA|}
   185 	       \<in> set evsCF;
   185                \<in> set evsCF;
   186              Says B' A {|Nonce NB, Number SID, Number PB|} \<in> set evsCF;
   186              Says B' A {|Nonce NB, Number SID, Number PB|} \<in> set evsCF;
   187              Notes A {|Agent B, Nonce PMS|} \<in> set evsCF;
   187              Notes A {|Agent B, Nonce PMS|} \<in> set evsCF;
   188 	     M = PRF(PMS,NA,NB) |]
   188              M = PRF(PMS,NA,NB) |]
   189           ==> Says A B (Crypt (clientK(NA,NB,M))
   189           ==> Says A B (Crypt (clientK(NA,NB,M))
   190 			(Hash{|Number SID, Nonce M,
   190                         (Hash{|Number SID, Nonce M,
   191 			       Nonce NA, Number PA, Agent A,
   191                                Nonce NA, Number PA, Agent A,
   192 			       Nonce NB, Number PB, Agent B|}))
   192                                Nonce NB, Number PB, Agent B|}))
   193               # evsCF  \<in>  tls"
   193               # evsCF  \<in>  tls"
   194 
   194 
   195  | ServerFinished:
   195  | ServerFinished:
   196 	--{*Keeping A' and A'' distinct means B cannot even check that the
   196         --{*Keeping A' and A'' distinct means B cannot even check that the
   197           two messages originate from the same source. *}
   197           two messages originate from the same source. *}
   198          "[| evsSF \<in> tls;
   198          "[| evsSF \<in> tls;
   199 	     Says A' B  {|Agent A, Nonce NA, Number SID, Number PA|}
   199              Says A' B  {|Agent A, Nonce NA, Number SID, Number PA|}
   200 	       \<in> set evsSF;
   200                \<in> set evsSF;
   201 	     Says B  A  {|Nonce NB, Number SID, Number PB|} \<in> set evsSF;
   201              Says B  A  {|Nonce NB, Number SID, Number PB|} \<in> set evsSF;
   202 	     Says A'' B (Crypt (pubK B) (Nonce PMS)) \<in> set evsSF;
   202              Says A'' B (Crypt (pubK B) (Nonce PMS)) \<in> set evsSF;
   203 	     M = PRF(PMS,NA,NB) |]
   203              M = PRF(PMS,NA,NB) |]
   204           ==> Says B A (Crypt (serverK(NA,NB,M))
   204           ==> Says B A (Crypt (serverK(NA,NB,M))
   205 			(Hash{|Number SID, Nonce M,
   205                         (Hash{|Number SID, Nonce M,
   206 			       Nonce NA, Number PA, Agent A,
   206                                Nonce NA, Number PA, Agent A,
   207 			       Nonce NB, Number PB, Agent B|}))
   207                                Nonce NB, Number PB, Agent B|}))
   208               # evsSF  \<in>  tls"
   208               # evsSF  \<in>  tls"
   209 
   209 
   210  | ClientAccepts:
   210  | ClientAccepts:
   211 	--{*Having transmitted ClientFinished and received an identical
   211         --{*Having transmitted ClientFinished and received an identical
   212           message encrypted with serverK, the client stores the parameters
   212           message encrypted with serverK, the client stores the parameters
   213           needed to resume this session.  The "Notes A ..." premise is
   213           needed to resume this session.  The "Notes A ..." premise is
   214           used to prove @{text Notes_master_imp_Crypt_PMS}.*}
   214           used to prove @{text Notes_master_imp_Crypt_PMS}.*}
   215          "[| evsCA \<in> tls;
   215          "[| evsCA \<in> tls;
   216 	     Notes A {|Agent B, Nonce PMS|} \<in> set evsCA;
   216              Notes A {|Agent B, Nonce PMS|} \<in> set evsCA;
   217 	     M = PRF(PMS,NA,NB);
   217              M = PRF(PMS,NA,NB);
   218 	     X = Hash{|Number SID, Nonce M,
   218              X = Hash{|Number SID, Nonce M,
   219 	               Nonce NA, Number PA, Agent A,
   219                        Nonce NA, Number PA, Agent A,
   220 		       Nonce NB, Number PB, Agent B|};
   220                        Nonce NB, Number PB, Agent B|};
   221              Says A  B (Crypt (clientK(NA,NB,M)) X) \<in> set evsCA;
   221              Says A  B (Crypt (clientK(NA,NB,M)) X) \<in> set evsCA;
   222              Says B' A (Crypt (serverK(NA,NB,M)) X) \<in> set evsCA |]
   222              Says B' A (Crypt (serverK(NA,NB,M)) X) \<in> set evsCA |]
   223           ==>
   223           ==>
   224              Notes A {|Number SID, Agent A, Agent B, Nonce M|} # evsCA  \<in>  tls"
   224              Notes A {|Number SID, Agent A, Agent B, Nonce M|} # evsCA  \<in>  tls"
   225 
   225 
   226  | ServerAccepts:
   226  | ServerAccepts:
   227 	--{*Having transmitted ServerFinished and received an identical
   227         --{*Having transmitted ServerFinished and received an identical
   228           message encrypted with clientK, the server stores the parameters
   228           message encrypted with clientK, the server stores the parameters
   229           needed to resume this session.  The "Says A'' B ..." premise is
   229           needed to resume this session.  The "Says A'' B ..." premise is
   230           used to prove @{text Notes_master_imp_Crypt_PMS}.*}
   230           used to prove @{text Notes_master_imp_Crypt_PMS}.*}
   231          "[| evsSA \<in> tls;
   231          "[| evsSA \<in> tls;
   232 	     A \<noteq> B;
   232              A \<noteq> B;
   233              Says A'' B (Crypt (pubK B) (Nonce PMS)) \<in> set evsSA;
   233              Says A'' B (Crypt (pubK B) (Nonce PMS)) \<in> set evsSA;
   234 	     M = PRF(PMS,NA,NB);
   234              M = PRF(PMS,NA,NB);
   235 	     X = Hash{|Number SID, Nonce M,
   235              X = Hash{|Number SID, Nonce M,
   236 	               Nonce NA, Number PA, Agent A,
   236                        Nonce NA, Number PA, Agent A,
   237 		       Nonce NB, Number PB, Agent B|};
   237                        Nonce NB, Number PB, Agent B|};
   238              Says B  A (Crypt (serverK(NA,NB,M)) X) \<in> set evsSA;
   238              Says B  A (Crypt (serverK(NA,NB,M)) X) \<in> set evsSA;
   239              Says A' B (Crypt (clientK(NA,NB,M)) X) \<in> set evsSA |]
   239              Says A' B (Crypt (clientK(NA,NB,M)) X) \<in> set evsSA |]
   240           ==>
   240           ==>
   241              Notes B {|Number SID, Agent A, Agent B, Nonce M|} # evsSA  \<in>  tls"
   241              Notes B {|Number SID, Agent A, Agent B, Nonce M|} # evsSA  \<in>  tls"
   242 
   242 
   243  | ClientResume:
   243  | ClientResume:
   244          --{*If A recalls the @{text SESSION_ID}, then she sends a FINISHED
   244          --{*If A recalls the @{text SESSION_ID}, then she sends a FINISHED
   245              message using the new nonces and stored MASTER SECRET.*}
   245              message using the new nonces and stored MASTER SECRET.*}
   246          "[| evsCR \<in> tls;
   246          "[| evsCR \<in> tls;
   247 	     Says A  B {|Agent A, Nonce NA, Number SID, Number PA|}: set evsCR;
   247              Says A  B {|Agent A, Nonce NA, Number SID, Number PA|}: set evsCR;
   248              Says B' A {|Nonce NB, Number SID, Number PB|} \<in> set evsCR;
   248              Says B' A {|Nonce NB, Number SID, Number PB|} \<in> set evsCR;
   249              Notes A {|Number SID, Agent A, Agent B, Nonce M|} \<in> set evsCR |]
   249              Notes A {|Number SID, Agent A, Agent B, Nonce M|} \<in> set evsCR |]
   250           ==> Says A B (Crypt (clientK(NA,NB,M))
   250           ==> Says A B (Crypt (clientK(NA,NB,M))
   251 			(Hash{|Number SID, Nonce M,
   251                         (Hash{|Number SID, Nonce M,
   252 			       Nonce NA, Number PA, Agent A,
   252                                Nonce NA, Number PA, Agent A,
   253 			       Nonce NB, Number PB, Agent B|}))
   253                                Nonce NB, Number PB, Agent B|}))
   254               # evsCR  \<in>  tls"
   254               # evsCR  \<in>  tls"
   255 
   255 
   256  | ServerResume:
   256  | ServerResume:
   257          --{*Resumption (7.3):  If B finds the @{text SESSION_ID} then he can 
   257          --{*Resumption (7.3):  If B finds the @{text SESSION_ID} then he can 
   258              send a FINISHED message using the recovered MASTER SECRET*}
   258              send a FINISHED message using the recovered MASTER SECRET*}
   259          "[| evsSR \<in> tls;
   259          "[| evsSR \<in> tls;
   260 	     Says A' B {|Agent A, Nonce NA, Number SID, Number PA|}: set evsSR;
   260              Says A' B {|Agent A, Nonce NA, Number SID, Number PA|}: set evsSR;
   261 	     Says B  A {|Nonce NB, Number SID, Number PB|} \<in> set evsSR;
   261              Says B  A {|Nonce NB, Number SID, Number PB|} \<in> set evsSR;
   262              Notes B {|Number SID, Agent A, Agent B, Nonce M|} \<in> set evsSR |]
   262              Notes B {|Number SID, Agent A, Agent B, Nonce M|} \<in> set evsSR |]
   263           ==> Says B A (Crypt (serverK(NA,NB,M))
   263           ==> Says B A (Crypt (serverK(NA,NB,M))
   264 			(Hash{|Number SID, Nonce M,
   264                         (Hash{|Number SID, Nonce M,
   265 			       Nonce NA, Number PA, Agent A,
   265                                Nonce NA, Number PA, Agent A,
   266 			       Nonce NB, Number PB, Agent B|})) # evsSR
   266                                Nonce NB, Number PB, Agent B|})) # evsSR
   267 	        \<in>  tls"
   267                 \<in>  tls"
   268 
   268 
   269  | Oops:
   269  | Oops:
   270          --{*The most plausible compromise is of an old session key.  Losing
   270          --{*The most plausible compromise is of an old session key.  Losing
   271            the MASTER SECRET or PREMASTER SECRET is more serious but
   271            the MASTER SECRET or PREMASTER SECRET is more serious but
   272            rather unlikely.  The assumption @{term "A\<noteq>Spy"} is essential: 
   272            rather unlikely.  The assumption @{term "A\<noteq>Spy"} is essential: 
   273            otherwise the Spy could learn session keys merely by 
   273            otherwise the Spy could learn session keys merely by 
   274            replaying messages!*}
   274            replaying messages!*}
   275          "[| evso \<in> tls;  A \<noteq> Spy;
   275          "[| evso \<in> tls;  A \<noteq> Spy;
   276 	     Says A B (Crypt (sessionK((NA,NB,M),role)) X) \<in> set evso |]
   276              Says A B (Crypt (sessionK((NA,NB,M),role)) X) \<in> set evso |]
   277           ==> Says A Spy (Key (sessionK((NA,NB,M),role))) # evso  \<in>  tls"
   277           ==> Says A Spy (Key (sessionK((NA,NB,M),role))) # evso  \<in>  tls"
   278 
   278 
   279 (*
   279 (*
   280 Protocol goals:
   280 Protocol goals:
   281 * M, serverK(NA,NB,M) and clientK(NA,NB,M) will be known only to the two
   281 * M, serverK(NA,NB,M) and clientK(NA,NB,M) will be known only to the two
   326 text{*Possibility properties state that some traces run the protocol to the
   326 text{*Possibility properties state that some traces run the protocol to the
   327 end.  Four paths and 12 rules are considered.*}
   327 end.  Four paths and 12 rules are considered.*}
   328 
   328 
   329 
   329 
   330 (** These proofs assume that the Nonce_supply nonces
   330 (** These proofs assume that the Nonce_supply nonces
   331 	(which have the form  @ N. Nonce N \<notin> used evs)
   331         (which have the form  @ N. Nonce N \<notin> used evs)
   332     lie outside the range of PRF.  It seems reasonable, but as it is needed
   332     lie outside the range of PRF.  It seems reasonable, but as it is needed
   333     only for the possibility theorems, it is not taken as an axiom.
   333     only for the possibility theorems, it is not taken as an axiom.
   334 **)
   334 **)
   335 
   335 
   336 
   336 
   379           Notes A {|Number SID, Agent A, Agent B, Nonce M|} \<in> set evs0;
   379           Notes A {|Number SID, Agent A, Agent B, Nonce M|} \<in> set evs0;
   380           Notes B {|Number SID, Agent A, Agent B, Nonce M|} \<in> set evs0;
   380           Notes B {|Number SID, Agent A, Agent B, Nonce M|} \<in> set evs0;
   381           \<forall>evs. (@ N. Nonce N \<notin> used evs) \<notin> range PRF;
   381           \<forall>evs. (@ N. Nonce N \<notin> used evs) \<notin> range PRF;
   382           A \<noteq> B |]
   382           A \<noteq> B |]
   383       ==> \<exists>NA PA NB PB X. \<exists>evs \<in> tls.
   383       ==> \<exists>NA PA NB PB X. \<exists>evs \<in> tls.
   384 		X = Hash{|Number SID, Nonce M,
   384                 X = Hash{|Number SID, Nonce M,
   385 			  Nonce NA, Number PA, Agent A,
   385                           Nonce NA, Number PA, Agent A,
   386 			  Nonce NB, Number PB, Agent B|}  &
   386                           Nonce NB, Number PB, Agent B|}  &
   387 		Says A B (Crypt (clientK(NA,NB,M)) X) \<in> set evs  &
   387                 Says A B (Crypt (clientK(NA,NB,M)) X) \<in> set evs  &
   388 		Says B A (Crypt (serverK(NA,NB,M)) X) \<in> set evs"
   388                 Says B A (Crypt (serverK(NA,NB,M)) X) \<in> set evs"
   389 apply (intro exI bexI)
   389 apply (intro exI bexI)
   390 apply (rule_tac [2] tls.ClientHello
   390 apply (rule_tac [2] tls.ClientHello
   391                     [THEN tls.ServerHello,
   391                     [THEN tls.ServerHello,
   392                      THEN tls.ServerResume, THEN tls.ClientResume], possibility, blast+)
   392                      THEN tls.ServerResume, THEN tls.ClientResume], possibility, blast+)
   393 done
   393 done
   568      "evs \<in> tls
   568      "evs \<in> tls
   569       ==> \<forall>KK. (Key(priK B) \<in> analz (Key`KK Un (spies evs))) =
   569       ==> \<forall>KK. (Key(priK B) \<in> analz (Key`KK Un (spies evs))) =
   570           (priK B \<in> KK | B \<in> bad)"
   570           (priK B \<in> KK | B \<in> bad)"
   571 apply (erule tls.induct)
   571 apply (erule tls.induct)
   572 apply (simp_all (no_asm_simp)
   572 apply (simp_all (no_asm_simp)
   573 		del: image_insert
   573                 del: image_insert
   574                 add: image_Un [THEN sym]
   574                 add: image_Un [THEN sym]
   575                      insert_Key_image Un_assoc [THEN sym])
   575                      insert_Key_image Un_assoc [THEN sym])
   576 txt{*Fake*}
   576 txt{*Fake*}
   577 apply spy_analz
   577 apply spy_analz
   578 done
   578 done
   596 **)
   596 **)
   597 
   597 
   598 lemma analz_image_keys [rule_format]:
   598 lemma analz_image_keys [rule_format]:
   599      "evs \<in> tls ==>
   599      "evs \<in> tls ==>
   600       \<forall>KK. KK <= range sessionK -->
   600       \<forall>KK. KK <= range sessionK -->
   601 	      (Nonce N \<in> analz (Key`KK Un (spies evs))) =
   601               (Nonce N \<in> analz (Key`KK Un (spies evs))) =
   602 	      (Nonce N \<in> analz (spies evs))"
   602               (Nonce N \<in> analz (spies evs))"
   603 apply (erule tls.induct, frule_tac [7] CX_KB_is_pubKB)
   603 apply (erule tls.induct, frule_tac [7] CX_KB_is_pubKB)
   604 apply (safe del: iffI)
   604 apply (safe del: iffI)
   605 apply (safe del: impI iffI intro!: analz_image_keys_lemma)
   605 apply (safe del: impI iffI intro!: analz_image_keys_lemma)
   606 apply (simp_all (no_asm_simp)               (*faster*)
   606 apply (simp_all (no_asm_simp)               (*faster*)
   607                 del: image_insert imp_disjL (*reduces blow-up*)
   607                 del: image_insert imp_disjL (*reduces blow-up*)
   608 		add: image_Un [THEN sym]  Un_assoc [THEN sym]
   608                 add: image_Un [THEN sym]  Un_assoc [THEN sym]
   609 		     insert_Key_singleton
   609                      insert_Key_singleton
   610 		     range_sessionkeys_not_priK analz_image_priK)
   610                      range_sessionkeys_not_priK analz_image_priK)
   611 apply (simp_all add: insert_absorb)
   611 apply (simp_all add: insert_absorb)
   612 txt{*Fake*}
   612 txt{*Fake*}
   613 apply spy_analz
   613 apply spy_analz
   614 done
   614 done
   615 
   615 
   899 
   899 
   900 (*10/2/99: loads in 139s (pike)
   900 (*10/2/99: loads in 139s (pike)
   901            down to 433s on albatross*)
   901            down to 433s on albatross*)
   902 
   902 
   903 (*5/5/01: conversion to Isar script
   903 (*5/5/01: conversion to Isar script
   904 	  loads in 137s (perch)
   904           loads in 137s (perch)
   905           the last ML version loaded in 122s on perch, a 600MHz machine:
   905           the last ML version loaded in 122s on perch, a 600MHz machine:
   906 		twice as fast as pike.  No idea why it's so much slower!
   906                 twice as fast as pike.  No idea why it's so much slower!
   907 	  The Isar script is slower still, perhaps because simp_all simplifies
   907           The Isar script is slower still, perhaps because simp_all simplifies
   908 	  the assumptions be default.
   908           the assumptions be default.
   909 *)
   909 *)
   910 
   910 
   911 end
   911 end