src/HOL/Auth/TLS.thy
author berghofe
Mon, 30 Sep 2002 16:48:15 +0200
changeset 13612 55d32e76ef4e
parent 13507 febb8e5d2a9d
child 13922 75ae4244a596
permissions -rw-r--r--
Adapted to new simplifier.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3474
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
     1
(*  Title:      HOL/Auth/TLS
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
     2
    ID:         $Id$
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
     4
    Copyright   1997  University of Cambridge
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
     5
3759
3d1ac6b82b28 Fixed ServerResume to check for ServerHello instead of making a new NB
paulson
parents: 3757
diff changeset
     6
Inductive relation "tls" for the TLS (Transport Layer Security) protocol.
3672
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
     7
This protocol is essentially the same as SSL 3.0.
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
     8
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
     9
Abstracted from "The TLS Protocol, Version 1.0" by Tim Dierks and Christopher
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
    10
Allen, Transport Layer Security Working Group, 21 May 1997,
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
    11
INTERNET-DRAFT draft-ietf-tls-protocol-03.txt.  Section numbers below refer
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
    12
to that memo.
3474
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
    13
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
    14
An RSA cryptosystem is assumed, and X.509v3 certificates are abstracted down
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
    15
to the trivial form {A, publicKey(A)}privateKey(Server), where Server is a
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
    16
global signing authority.
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
    17
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
    18
A is the client and B is the server, not to be confused with the constant
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
    19
Server, who is in charge of all public keys.
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
    20
3480
d59bbf053258 More realistic model: the Spy can compute clientK and serverK
paulson
parents: 3474
diff changeset
    21
The model assumes that no fraudulent certificates are present, but it does
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3515
diff changeset
    22
assume that some private keys are to the spy.
3474
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
    23
3745
4c5d3b1ddc75 Client, Server certificates now sent using the separate Certificate rule,
paulson
parents: 3729
diff changeset
    24
REMARK.  The event "Notes A {|Agent B, Nonce PMS|}" appears in ClientKeyExch,
3515
d8a71f6eaf40 Now uses the Notes constructor to distinguish the Client (who has chosen M)
paulson
parents: 3506
diff changeset
    25
CertVerify, ClientFinished to record that A knows M.  It is a note from A to
3745
4c5d3b1ddc75 Client, Server certificates now sent using the separate Certificate rule,
paulson
parents: 3729
diff changeset
    26
herself.  Nobody else can see it.  In ClientKeyExch, the Spy can substitute
3515
d8a71f6eaf40 Now uses the Notes constructor to distinguish the Client (who has chosen M)
paulson
parents: 3506
diff changeset
    27
his own certificate for A's, but he cannot replace A's note by one for himself.
d8a71f6eaf40 Now uses the Notes constructor to distinguish the Client (who has chosen M)
paulson
parents: 3506
diff changeset
    28
3672
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
    29
The Note event avoids a weakness in the public-key model.  Each
3515
d8a71f6eaf40 Now uses the Notes constructor to distinguish the Client (who has chosen M)
paulson
parents: 3506
diff changeset
    30
agent's state is recorded as the trace of messages.  When the true client (A)
3672
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
    31
invents PMS, he encrypts PMS with B's public key before sending it.  The model
3515
d8a71f6eaf40 Now uses the Notes constructor to distinguish the Client (who has chosen M)
paulson
parents: 3506
diff changeset
    32
does not distinguish the original occurrence of such a message from a replay.
d8a71f6eaf40 Now uses the Notes constructor to distinguish the Client (who has chosen M)
paulson
parents: 3506
diff changeset
    33
In the shared-key model, the ability to encrypt implies the ability to
d8a71f6eaf40 Now uses the Notes constructor to distinguish the Client (who has chosen M)
paulson
parents: 3506
diff changeset
    34
decrypt, so the problem does not arise.
3685
5b8c0c8f576e Full version of TLS including session resumption, but no Oops
paulson
parents: 3683
diff changeset
    35
3745
4c5d3b1ddc75 Client, Server certificates now sent using the separate Certificate rule,
paulson
parents: 3729
diff changeset
    36
Proofs would be simpler if ClientKeyExch included A's name within
3685
5b8c0c8f576e Full version of TLS including session resumption, but no Oops
paulson
parents: 3683
diff changeset
    37
Crypt KB (Nonce PMS).  As things stand, there is much overlap between proofs
5b8c0c8f576e Full version of TLS including session resumption, but no Oops
paulson
parents: 3683
diff changeset
    38
about that message (which B receives) and the stronger event
5b8c0c8f576e Full version of TLS including session resumption, but no Oops
paulson
parents: 3683
diff changeset
    39
	Notes A {|Agent B, Nonce PMS|}.
3474
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
    40
*)
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
    41
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
    42
theory TLS = Public:
3474
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
    43
5653
204083e3f368 changed tags from 0, 1 to None, Some() to avoid special treatment of 0
paulson
parents: 5434
diff changeset
    44
constdefs
204083e3f368 changed tags from 0, 1 to None, Some() to avoid special treatment of 0
paulson
parents: 5434
diff changeset
    45
  certificate      :: "[agent,key] => msg"
204083e3f368 changed tags from 0, 1 to None, Some() to avoid special treatment of 0
paulson
parents: 5434
diff changeset
    46
    "certificate A KA == Crypt (priK Server) {|Agent A, Key KA|}"
204083e3f368 changed tags from 0, 1 to None, Some() to avoid special treatment of 0
paulson
parents: 5434
diff changeset
    47
6284
147db42c1009 tidying in conjuntion with the TISSEC paper; replaced (unit option)
paulson
parents: 5653
diff changeset
    48
datatype role = ClientRole | ServerRole
147db42c1009 tidying in conjuntion with the TISSEC paper; replaced (unit option)
paulson
parents: 5653
diff changeset
    49
3474
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
    50
consts
3672
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
    51
  (*Pseudo-random function of Section 5*)
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
    52
  PRF  :: "nat*nat*nat => nat"
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
    53
3704
2f99d7a0dccc sessionK now indexed by nat instead of bool.
paulson
parents: 3687
diff changeset
    54
  (*Client, server write keys are generated uniformly by function sessionK
5653
204083e3f368 changed tags from 0, 1 to None, Some() to avoid special treatment of 0
paulson
parents: 5434
diff changeset
    55
    to avoid duplicating their properties.  They are distinguished by a
204083e3f368 changed tags from 0, 1 to None, Some() to avoid special treatment of 0
paulson
parents: 5434
diff changeset
    56
    tag (not a bool, to avoid the peculiarities of if-and-only-if).
3704
2f99d7a0dccc sessionK now indexed by nat instead of bool.
paulson
parents: 3687
diff changeset
    57
    Session keys implicitly include MAC secrets.*)
6284
147db42c1009 tidying in conjuntion with the TISSEC paper; replaced (unit option)
paulson
parents: 5653
diff changeset
    58
  sessionK :: "(nat*nat*nat) * role => key"
3474
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
    59
3677
f2569416d18b Now with the sessionK constant and new events ClientAccepts and ServerAccepts
paulson
parents: 3676
diff changeset
    60
syntax
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
    61
    clientK :: "nat*nat*nat => key"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
    62
    serverK :: "nat*nat*nat => key"
3677
f2569416d18b Now with the sessionK constant and new events ClientAccepts and ServerAccepts
paulson
parents: 3676
diff changeset
    63
f2569416d18b Now with the sessionK constant and new events ClientAccepts and ServerAccepts
paulson
parents: 3676
diff changeset
    64
translations
6284
147db42c1009 tidying in conjuntion with the TISSEC paper; replaced (unit option)
paulson
parents: 5653
diff changeset
    65
  "clientK X" == "sessionK(X, ClientRole)"
147db42c1009 tidying in conjuntion with the TISSEC paper; replaced (unit option)
paulson
parents: 5653
diff changeset
    66
  "serverK X" == "sessionK(X, ServerRole)"
3677
f2569416d18b Now with the sessionK constant and new events ClientAccepts and ServerAccepts
paulson
parents: 3676
diff changeset
    67
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
    68
axioms
3745
4c5d3b1ddc75 Client, Server certificates now sent using the separate Certificate rule,
paulson
parents: 3729
diff changeset
    69
  (*the pseudo-random function is collision-free*)
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
    70
  inj_PRF:       "inj PRF"
3672
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
    71
3745
4c5d3b1ddc75 Client, Server certificates now sent using the separate Certificate rule,
paulson
parents: 3729
diff changeset
    72
  (*sessionK is collision-free; also, no clientK clashes with any serverK.*)
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
    73
  inj_sessionK:  "inj sessionK"	
3677
f2569416d18b Now with the sessionK constant and new events ClientAccepts and ServerAccepts
paulson
parents: 3676
diff changeset
    74
3745
4c5d3b1ddc75 Client, Server certificates now sent using the separate Certificate rule,
paulson
parents: 3729
diff changeset
    75
  (*sessionK makes symmetric keys*)
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
    76
  isSym_sessionK: "sessionK nonces \<in> symKeys"
3474
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
    77
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
    78
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
    79
consts    tls :: "event list set"
3474
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
    80
inductive tls
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
    81
  intros
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
    82
   Nil:  (*Initial trace is empty*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
    83
         "[] \<in> tls"
3474
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
    84
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
    85
   Fake: (*The spy, an active attacker, MAY say anything he CAN say.*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
    86
         "[| evsf \<in> tls;  X \<in> synth (analz (spies evsf)) |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
    87
          ==> Says Spy B X # evsf \<in> tls"
3480
d59bbf053258 More realistic model: the Spy can compute clientK and serverK
paulson
parents: 3474
diff changeset
    88
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
    89
   SpyKeys: (*The spy may apply PRF & sessionK to available nonces*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
    90
         "[| evsSK \<in> tls;
5359
bd539b72d484 Tidying
paulson
parents: 5074
diff changeset
    91
	     {Nonce NA, Nonce NB, Nonce M} <= analz (spies evsSK) |]
4421
88639289be39 Simplified SpyKeys and ClientKeyExch as suggested by James Margetson
paulson
parents: 4198
diff changeset
    92
          ==> Notes Spy {| Nonce (PRF(M,NA,NB)),
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
    93
			   Key (sessionK((NA,NB,M),role)) |} # evsSK \<in> tls"
3474
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
    94
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
    95
   ClientHello:
3672
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
    96
	 (*(7.4.1.2)
3729
6be7cf5086ab Renamed XA, XB to PA, PB and removed the certificate from Client Verify
paulson
parents: 3710
diff changeset
    97
	   PA represents CLIENT_VERSION, CIPHER_SUITES and COMPRESSION_METHODS.
3474
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
    98
	   It is uninterpreted but will be confirmed in the FINISHED messages.
3676
cbaec955056b Addition of SessionIDs to the Hello and Finished messages
paulson
parents: 3672
diff changeset
    99
	   NA is CLIENT RANDOM, while SID is SESSION_ID.
cbaec955056b Addition of SessionIDs to the Hello and Finished messages
paulson
parents: 3672
diff changeset
   100
           UNIX TIME is omitted because the protocol doesn't use it.
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   101
           May assume NA \<notin> range PRF because CLIENT RANDOM is 28 bytes
4198
c63639beeff1 Fixed spelling error
paulson
parents: 3759
diff changeset
   102
	   while MASTER SECRET is 48 bytes*)
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   103
         "[| evsCH \<in> tls;  Nonce NA \<notin> used evsCH;  NA \<notin> range PRF |]
3729
6be7cf5086ab Renamed XA, XB to PA, PB and removed the certificate from Client Verify
paulson
parents: 3710
diff changeset
   104
          ==> Says A B {|Agent A, Nonce NA, Number SID, Number PA|}
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   105
	        # evsCH  \<in>  tls"
3474
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
   106
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   107
   ServerHello:
3672
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
   108
         (*7.4.1.3 of the TLS Internet-Draft
3729
6be7cf5086ab Renamed XA, XB to PA, PB and removed the certificate from Client Verify
paulson
parents: 3710
diff changeset
   109
	   PB represents CLIENT_VERSION, CIPHER_SUITE and COMPRESSION_METHOD.
3672
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
   110
           SERVER CERTIFICATE (7.4.2) is always present.
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
   111
           CERTIFICATE_REQUEST (7.4.4) is implied.*)
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   112
         "[| evsSH \<in> tls;  Nonce NB \<notin> used evsSH;  NB \<notin> range PRF;
3729
6be7cf5086ab Renamed XA, XB to PA, PB and removed the certificate from Client Verify
paulson
parents: 3710
diff changeset
   113
             Says A' B {|Agent A, Nonce NA, Number SID, Number PA|}
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   114
	       \<in> set evsSH |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   115
          ==> Says B A {|Nonce NB, Number SID, Number PB|} # evsSH  \<in>  tls"
3474
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
   116
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   117
   Certificate:
3745
4c5d3b1ddc75 Client, Server certificates now sent using the separate Certificate rule,
paulson
parents: 3729
diff changeset
   118
         (*SERVER (7.4.2) or CLIENT (7.4.6) CERTIFICATE.*)
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   119
         "evsC \<in> tls ==> Says B A (certificate B (pubK B)) # evsC  \<in>  tls"
3745
4c5d3b1ddc75 Client, Server certificates now sent using the separate Certificate rule,
paulson
parents: 3729
diff changeset
   120
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   121
   ClientKeyExch:
3745
4c5d3b1ddc75 Client, Server certificates now sent using the separate Certificate rule,
paulson
parents: 3729
diff changeset
   122
         (*CLIENT KEY EXCHANGE (7.4.7).
3672
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
   123
           The client, A, chooses PMS, the PREMASTER SECRET.
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
   124
           She encrypts PMS using the supplied KB, which ought to be pubK B.
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   125
           We assume PMS \<notin> range PRF because a clash betweem the PMS
3672
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
   126
           and another MASTER SECRET is highly unlikely (even though
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
   127
	   both items have the same length, 48 bytes).
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
   128
           The Note event records in the trace that she knows PMS
3685
5b8c0c8f576e Full version of TLS including session resumption, but no Oops
paulson
parents: 3683
diff changeset
   129
               (see REMARK at top). *)
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   130
         "[| evsCX \<in> tls;  Nonce PMS \<notin> used evsCX;  PMS \<notin> range PRF;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   131
             Says B' A (certificate B KB) \<in> set evsCX |]
3745
4c5d3b1ddc75 Client, Server certificates now sent using the separate Certificate rule,
paulson
parents: 3729
diff changeset
   132
          ==> Says A B (Crypt KB (Nonce PMS))
3672
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
   133
	      # Notes A {|Agent B, Nonce PMS|}
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   134
	      # evsCX  \<in>  tls"
3474
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
   135
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   136
   CertVerify:
3685
5b8c0c8f576e Full version of TLS including session resumption, but no Oops
paulson
parents: 3683
diff changeset
   137
	(*The optional Certificate Verify (7.4.8) message contains the
3672
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
   138
          specific components listed in the security analysis, F.1.1.2.
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
   139
          It adds the pre-master-secret, which is also essential!
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
   140
          Checking the signature, which is the only use of A's certificate,
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
   141
          assures B of A's presence*)
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   142
         "[| evsCV \<in> tls;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   143
             Says B' A {|Nonce NB, Number SID, Number PB|} \<in> set evsCV;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   144
	     Notes A {|Agent B, Nonce PMS|} \<in> set evsCV |]
3729
6be7cf5086ab Renamed XA, XB to PA, PB and removed the certificate from Client Verify
paulson
parents: 3710
diff changeset
   145
          ==> Says A B (Crypt (priK A) (Hash{|Nonce NB, Agent B, Nonce PMS|}))
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   146
              # evsCV  \<in>  tls"
3474
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
   147
3729
6be7cf5086ab Renamed XA, XB to PA, PB and removed the certificate from Client Verify
paulson
parents: 3710
diff changeset
   148
	(*Finally come the FINISHED messages (7.4.8), confirming PA and PB
3672
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
   149
          among other things.  The master-secret is PRF(PMS,NA,NB).
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   150
          Either party may send its message first.*)
3474
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
   151
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   152
   ClientFinished:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   153
        (*The occurrence of Notes A {|Agent B, Nonce PMS|} stops the
3515
d8a71f6eaf40 Now uses the Notes constructor to distinguish the Client (who has chosen M)
paulson
parents: 3506
diff changeset
   154
          rule's applying when the Spy has satisfied the "Says A B" by
d8a71f6eaf40 Now uses the Notes constructor to distinguish the Client (who has chosen M)
paulson
parents: 3506
diff changeset
   155
          repaying messages sent by the true client; in that case, the
6284
147db42c1009 tidying in conjuntion with the TISSEC paper; replaced (unit option)
paulson
parents: 5653
diff changeset
   156
          Spy does not know PMS and could not send ClientFinished.  One
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   157
          could simply put A\<noteq>Spy into the rule, but one should not
3515
d8a71f6eaf40 Now uses the Notes constructor to distinguish the Client (who has chosen M)
paulson
parents: 3506
diff changeset
   158
          expect the spy to be well-behaved.*)
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   159
         "[| evsCF \<in> tls;
3729
6be7cf5086ab Renamed XA, XB to PA, PB and removed the certificate from Client Verify
paulson
parents: 3710
diff changeset
   160
	     Says A  B {|Agent A, Nonce NA, Number SID, Number PA|}
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   161
	       \<in> set evsCF;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   162
             Says B' A {|Nonce NB, Number SID, Number PB|} \<in> set evsCF;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   163
             Notes A {|Agent B, Nonce PMS|} \<in> set evsCF;
3672
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
   164
	     M = PRF(PMS,NA,NB) |]
3474
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
   165
          ==> Says A B (Crypt (clientK(NA,NB,M))
3757
7524781c5c83 Exchanged the M and SID fields of the FINISHED messages to simplify proofs
paulson
parents: 3745
diff changeset
   166
			(Hash{|Number SID, Nonce M,
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   167
			       Nonce NA, Number PA, Agent A,
3729
6be7cf5086ab Renamed XA, XB to PA, PB and removed the certificate from Client Verify
paulson
parents: 3710
diff changeset
   168
			       Nonce NB, Number PB, Agent B|}))
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   169
              # evsCF  \<in>  tls"
3474
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
   170
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   171
   ServerFinished:
3474
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
   172
	(*Keeping A' and A'' distinct means B cannot even check that the
3672
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
   173
          two messages originate from the same source. *)
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   174
         "[| evsSF \<in> tls;
3729
6be7cf5086ab Renamed XA, XB to PA, PB and removed the certificate from Client Verify
paulson
parents: 3710
diff changeset
   175
	     Says A' B  {|Agent A, Nonce NA, Number SID, Number PA|}
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   176
	       \<in> set evsSF;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   177
	     Says B  A  {|Nonce NB, Number SID, Number PB|} \<in> set evsSF;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   178
	     Says A'' B (Crypt (pubK B) (Nonce PMS)) \<in> set evsSF;
3672
56e4365a0c99 TLS now with a distinction between premaster secret and master secret
paulson
parents: 3519
diff changeset
   179
	     M = PRF(PMS,NA,NB) |]
3474
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
   180
          ==> Says B A (Crypt (serverK(NA,NB,M))
3757
7524781c5c83 Exchanged the M and SID fields of the FINISHED messages to simplify proofs
paulson
parents: 3745
diff changeset
   181
			(Hash{|Number SID, Nonce M,
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   182
			       Nonce NA, Number PA, Agent A,
3729
6be7cf5086ab Renamed XA, XB to PA, PB and removed the certificate from Client Verify
paulson
parents: 3710
diff changeset
   183
			       Nonce NB, Number PB, Agent B|}))
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   184
              # evsSF  \<in>  tls"
3474
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
   185
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   186
   ClientAccepts:
3685
5b8c0c8f576e Full version of TLS including session resumption, but no Oops
paulson
parents: 3683
diff changeset
   187
	(*Having transmitted ClientFinished and received an identical
3677
f2569416d18b Now with the sessionK constant and new events ClientAccepts and ServerAccepts
paulson
parents: 3676
diff changeset
   188
          message encrypted with serverK, the client stores the parameters
3687
fb7d096d7884 Simplified SpyKeys to use sessionK instead of clientK and serverK
paulson
parents: 3686
diff changeset
   189
          needed to resume this session.  The "Notes A ..." premise is
fb7d096d7884 Simplified SpyKeys to use sessionK instead of clientK and serverK
paulson
parents: 3686
diff changeset
   190
          used to prove Notes_master_imp_Crypt_PMS.*)
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   191
         "[| evsCA \<in> tls;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   192
	     Notes A {|Agent B, Nonce PMS|} \<in> set evsCA;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   193
	     M = PRF(PMS,NA,NB);
3757
7524781c5c83 Exchanged the M and SID fields of the FINISHED messages to simplify proofs
paulson
parents: 3745
diff changeset
   194
	     X = Hash{|Number SID, Nonce M,
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   195
	               Nonce NA, Number PA, Agent A,
3729
6be7cf5086ab Renamed XA, XB to PA, PB and removed the certificate from Client Verify
paulson
parents: 3710
diff changeset
   196
		       Nonce NB, Number PB, Agent B|};
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   197
             Says A  B (Crypt (clientK(NA,NB,M)) X) \<in> set evsCA;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   198
             Says B' A (Crypt (serverK(NA,NB,M)) X) \<in> set evsCA |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   199
          ==>
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   200
             Notes A {|Number SID, Agent A, Agent B, Nonce M|} # evsCA  \<in>  tls"
3677
f2569416d18b Now with the sessionK constant and new events ClientAccepts and ServerAccepts
paulson
parents: 3676
diff changeset
   201
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   202
   ServerAccepts:
3685
5b8c0c8f576e Full version of TLS including session resumption, but no Oops
paulson
parents: 3683
diff changeset
   203
	(*Having transmitted ServerFinished and received an identical
3677
f2569416d18b Now with the sessionK constant and new events ClientAccepts and ServerAccepts
paulson
parents: 3676
diff changeset
   204
          message encrypted with clientK, the server stores the parameters
3687
fb7d096d7884 Simplified SpyKeys to use sessionK instead of clientK and serverK
paulson
parents: 3686
diff changeset
   205
          needed to resume this session.  The "Says A'' B ..." premise is
fb7d096d7884 Simplified SpyKeys to use sessionK instead of clientK and serverK
paulson
parents: 3686
diff changeset
   206
          used to prove Notes_master_imp_Crypt_PMS.*)
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   207
         "[| evsSA \<in> tls;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   208
	     A \<noteq> B;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   209
             Says A'' B (Crypt (pubK B) (Nonce PMS)) \<in> set evsSA;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   210
	     M = PRF(PMS,NA,NB);
3757
7524781c5c83 Exchanged the M and SID fields of the FINISHED messages to simplify proofs
paulson
parents: 3745
diff changeset
   211
	     X = Hash{|Number SID, Nonce M,
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   212
	               Nonce NA, Number PA, Agent A,
3729
6be7cf5086ab Renamed XA, XB to PA, PB and removed the certificate from Client Verify
paulson
parents: 3710
diff changeset
   213
		       Nonce NB, Number PB, Agent B|};
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   214
             Says B  A (Crypt (serverK(NA,NB,M)) X) \<in> set evsSA;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   215
             Says A' B (Crypt (clientK(NA,NB,M)) X) \<in> set evsSA |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   216
          ==>
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   217
             Notes B {|Number SID, Agent A, Agent B, Nonce M|} # evsSA  \<in>  tls"
3677
f2569416d18b Now with the sessionK constant and new events ClientAccepts and ServerAccepts
paulson
parents: 3676
diff changeset
   218
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   219
   ClientResume:
3745
4c5d3b1ddc75 Client, Server certificates now sent using the separate Certificate rule,
paulson
parents: 3729
diff changeset
   220
         (*If A recalls the SESSION_ID, then she sends a FINISHED message
4c5d3b1ddc75 Client, Server certificates now sent using the separate Certificate rule,
paulson
parents: 3729
diff changeset
   221
           using the new nonces and stored MASTER SECRET.*)
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   222
         "[| evsCR \<in> tls;
3759
3d1ac6b82b28 Fixed ServerResume to check for ServerHello instead of making a new NB
paulson
parents: 3757
diff changeset
   223
	     Says A  B {|Agent A, Nonce NA, Number SID, Number PA|}: set evsCR;
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   224
             Says B' A {|Nonce NB, Number SID, Number PB|} \<in> set evsCR;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   225
             Notes A {|Number SID, Agent A, Agent B, Nonce M|} \<in> set evsCR |]
3685
5b8c0c8f576e Full version of TLS including session resumption, but no Oops
paulson
parents: 3683
diff changeset
   226
          ==> Says A B (Crypt (clientK(NA,NB,M))
3757
7524781c5c83 Exchanged the M and SID fields of the FINISHED messages to simplify proofs
paulson
parents: 3745
diff changeset
   227
			(Hash{|Number SID, Nonce M,
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   228
			       Nonce NA, Number PA, Agent A,
3729
6be7cf5086ab Renamed XA, XB to PA, PB and removed the certificate from Client Verify
paulson
parents: 3710
diff changeset
   229
			       Nonce NB, Number PB, Agent B|}))
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   230
              # evsCR  \<in>  tls"
3685
5b8c0c8f576e Full version of TLS including session resumption, but no Oops
paulson
parents: 3683
diff changeset
   231
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   232
   ServerResume:
3759
3d1ac6b82b28 Fixed ServerResume to check for ServerHello instead of making a new NB
paulson
parents: 3757
diff changeset
   233
         (*Resumption (7.3):  If B finds the SESSION_ID then he can send
3d1ac6b82b28 Fixed ServerResume to check for ServerHello instead of making a new NB
paulson
parents: 3757
diff changeset
   234
           a FINISHED message using the recovered MASTER SECRET*)
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   235
         "[| evsSR \<in> tls;
3759
3d1ac6b82b28 Fixed ServerResume to check for ServerHello instead of making a new NB
paulson
parents: 3757
diff changeset
   236
	     Says A' B {|Agent A, Nonce NA, Number SID, Number PA|}: set evsSR;
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   237
	     Says B  A {|Nonce NB, Number SID, Number PB|} \<in> set evsSR;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   238
             Notes B {|Number SID, Agent A, Agent B, Nonce M|} \<in> set evsSR |]
3759
3d1ac6b82b28 Fixed ServerResume to check for ServerHello instead of making a new NB
paulson
parents: 3757
diff changeset
   239
          ==> Says B A (Crypt (serverK(NA,NB,M))
3d1ac6b82b28 Fixed ServerResume to check for ServerHello instead of making a new NB
paulson
parents: 3757
diff changeset
   240
			(Hash{|Number SID, Nonce M,
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   241
			       Nonce NA, Number PA, Agent A,
3759
3d1ac6b82b28 Fixed ServerResume to check for ServerHello instead of making a new NB
paulson
parents: 3757
diff changeset
   242
			       Nonce NB, Number PB, Agent B|})) # evsSR
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   243
	        \<in>  tls"
3759
3d1ac6b82b28 Fixed ServerResume to check for ServerHello instead of making a new NB
paulson
parents: 3757
diff changeset
   244
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   245
   Oops:
3686
4b484805b4c4 First working version with Oops event for session keys
paulson
parents: 3685
diff changeset
   246
         (*The most plausible compromise is of an old session key.  Losing
4b484805b4c4 First working version with Oops event for session keys
paulson
parents: 3685
diff changeset
   247
           the MASTER SECRET or PREMASTER SECRET is more serious but
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   248
           rather unlikely.  The assumption A \<noteq> Spy is essential: otherwise
5434
9b4bed3f394c Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents: 5359
diff changeset
   249
           the Spy could learn session keys merely by replaying messages!*)
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   250
         "[| evso \<in> tls;  A \<noteq> Spy;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   251
	     Says A B (Crypt (sessionK((NA,NB,M),role)) X) \<in> set evso |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   252
          ==> Says A Spy (Key (sessionK((NA,NB,M),role))) # evso  \<in>  tls"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   253
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   254
(*
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   255
Protocol goals:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   256
* M, serverK(NA,NB,M) and clientK(NA,NB,M) will be known only to the two
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   257
     parties (though A is not necessarily authenticated).
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   258
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   259
* B upon receiving CertVerify knows that A is present (But this
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   260
    message is optional!)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   261
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   262
* A upon receiving ServerFinished knows that B is present
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   263
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   264
* Each party who has received a FINISHED message can trust that the other
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   265
  party agrees on all message components, including PA and PB (thus foiling
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   266
  rollback attacks).
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   267
*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   268
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   269
declare Says_imp_knows_Spy [THEN analz.Inj, dest]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   270
declare parts.Body  [dest]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   271
declare analz_into_parts [dest]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   272
declare Fake_parts_insert_in_Un  [dest]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   273
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   274
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   275
(*Automatically unfold the definition of "certificate"*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   276
declare certificate_def [simp]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   277
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   278
(*Injectiveness of key-generating functions*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   279
declare inj_PRF [THEN inj_eq, iff]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   280
declare inj_sessionK [THEN inj_eq, iff]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   281
declare isSym_sessionK [simp]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   282
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   283
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   284
(*** clientK and serverK make symmetric keys; no clashes with pubK or priK ***)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   285
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   286
lemma pubK_neq_sessionK [iff]: "pubK A \<noteq> sessionK arg"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   287
by (simp add: symKeys_neq_imp_neq)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   288
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   289
declare pubK_neq_sessionK [THEN not_sym, iff]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   290
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   291
lemma priK_neq_sessionK [iff]: "priK A \<noteq> sessionK arg"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   292
by (simp add: symKeys_neq_imp_neq)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   293
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   294
declare priK_neq_sessionK [THEN not_sym, iff]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   295
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   296
lemmas keys_distinct = pubK_neq_sessionK priK_neq_sessionK
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   297
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   298
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   299
(**** Protocol Proofs ****)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   300
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   301
(*Possibility properties state that some traces run the protocol to the end.
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   302
  Four paths and 12 rules are considered.*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   303
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   304
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   305
(** These proofs assume that the Nonce_supply nonces
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   306
	(which have the form  @ N. Nonce N \<notin> used evs)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   307
    lie outside the range of PRF.  It seems reasonable, but as it is needed
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   308
    only for the possibility theorems, it is not taken as an axiom.
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   309
**)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   310
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   311
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   312
(*Possibility property ending with ClientAccepts.*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   313
lemma "[| \<forall>evs. (@ N. Nonce N \<notin> used evs) \<notin> range PRF;  A \<noteq> B |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   314
      ==> \<exists>SID M. \<exists>evs \<in> tls.
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   315
            Notes A {|Number SID, Agent A, Agent B, Nonce M|} \<in> set evs"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   316
apply (intro exI bexI)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   317
apply (rule_tac [2] tls.Nil
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   318
                    [THEN tls.ClientHello, THEN tls.ServerHello,
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   319
                     THEN tls.Certificate, THEN tls.ClientKeyExch,
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   320
                     THEN tls.ClientFinished, THEN tls.ServerFinished,
13507
febb8e5d2a9d tidying of Isar scripts
paulson
parents: 11655
diff changeset
   321
                     THEN tls.ClientAccepts], possibility, blast+)
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   322
done
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   323
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   324
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   325
(*And one for ServerAccepts.  Either FINISHED message may come first.*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   326
lemma "[| \<forall>evs. (@ N. Nonce N \<notin> used evs) \<notin> range PRF; A \<noteq> B |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   327
      ==> \<exists>SID NA PA NB PB M. \<exists>evs \<in> tls.
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   328
           Notes B {|Number SID, Agent A, Agent B, Nonce M|} \<in> set evs"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   329
apply (intro exI bexI)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   330
apply (rule_tac [2] tls.Nil
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   331
                    [THEN tls.ClientHello, THEN tls.ServerHello,
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   332
                     THEN tls.Certificate, THEN tls.ClientKeyExch,
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   333
                     THEN tls.ServerFinished, THEN tls.ClientFinished, 
13507
febb8e5d2a9d tidying of Isar scripts
paulson
parents: 11655
diff changeset
   334
                     THEN tls.ServerAccepts], possibility, blast+)
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   335
done
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   336
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   337
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   338
(*Another one, for CertVerify (which is optional)*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   339
lemma "[| \<forall>evs. (@ N. Nonce N \<notin> used evs) \<notin> range PRF;  A \<noteq> B |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   340
       ==> \<exists>NB PMS. \<exists>evs \<in> tls.
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   341
              Says A B (Crypt (priK A) (Hash{|Nonce NB, Agent B, Nonce PMS|})) 
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   342
                \<in> set evs"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   343
apply (intro exI bexI)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   344
apply (rule_tac [2] tls.Nil
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   345
                    [THEN tls.ClientHello, THEN tls.ServerHello,
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   346
                     THEN tls.Certificate, THEN tls.ClientKeyExch,
13507
febb8e5d2a9d tidying of Isar scripts
paulson
parents: 11655
diff changeset
   347
                     THEN tls.CertVerify], possibility, blast+)
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   348
done
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   349
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   350
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   351
(*Another one, for session resumption (both ServerResume and ClientResume).
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   352
  NO tls.Nil here: we refer to a previous session, not the empty trace.*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   353
lemma "[| evs0 \<in> tls;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   354
          Notes A {|Number SID, Agent A, Agent B, Nonce M|} \<in> set evs0;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   355
          Notes B {|Number SID, Agent A, Agent B, Nonce M|} \<in> set evs0;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   356
          \<forall>evs. (@ N. Nonce N \<notin> used evs) \<notin> range PRF;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   357
          A \<noteq> B |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   358
      ==> \<exists>NA PA NB PB X. \<exists>evs \<in> tls.
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   359
		X = Hash{|Number SID, Nonce M,
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   360
			  Nonce NA, Number PA, Agent A,
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   361
			  Nonce NB, Number PB, Agent B|}  &
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   362
		Says A B (Crypt (clientK(NA,NB,M)) X) \<in> set evs  &
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   363
		Says B A (Crypt (serverK(NA,NB,M)) X) \<in> set evs"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   364
apply (intro exI bexI)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   365
apply (rule_tac [2] tls.ClientHello
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   366
                    [THEN tls.ServerHello,
13507
febb8e5d2a9d tidying of Isar scripts
paulson
parents: 11655
diff changeset
   367
                     THEN tls.ServerResume, THEN tls.ClientResume], possibility, blast+)
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   368
done
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   369
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   370
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   371
(**** Inductive proofs about tls ****)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   372
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   373
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   374
(*Induction for regularity theorems.  If induction formula has the form
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   375
   X \<notin> analz (spies evs) --> ... then it shortens the proof by discarding
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   376
   needless information about analz (insert X (spies evs))  
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   377
fun parts_induct_tac i =
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   378
    etac tls.induct i
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   379
    THEN REPEAT (FIRSTGOAL analz_mono_contra_tac)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   380
    THEN Force_tac i THEN
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   381
    ALLGOALS Asm_simp_tac
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   382
*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   383
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   384
(** Theorems of the form X \<notin> parts (spies evs) imply that NOBODY
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   385
    sends messages containing X! **)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   386
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   387
(*Spy never sees a good agent's private key!*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   388
lemma Spy_see_priK [simp]:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   389
     "evs \<in> tls ==> (Key (priK A) \<in> parts (spies evs)) = (A \<in> bad)"
13507
febb8e5d2a9d tidying of Isar scripts
paulson
parents: 11655
diff changeset
   390
apply (erule tls.induct, force, simp_all, blast)
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   391
done
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   392
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   393
lemma Spy_analz_priK [simp]:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   394
     "evs \<in> tls ==> (Key (priK A) \<in> analz (spies evs)) = (A \<in> bad)"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   395
by auto
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   396
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   397
lemma Spy_see_priK_D [dest!]:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   398
     "[|Key (priK A) \<in> parts (knows Spy evs);  evs \<in> tls|] ==> A \<in> bad"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   399
by (blast dest: Spy_see_priK)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   400
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   401
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   402
(*This lemma says that no false certificates exist.  One might extend the
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   403
  model to include bogus certificates for the agents, but there seems
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   404
  little point in doing so: the loss of their private keys is a worse
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   405
  breach of security.*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   406
lemma certificate_valid:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   407
    "[| certificate B KB \<in> parts (spies evs);  evs \<in> tls |] ==> KB = pubK B"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   408
apply (erule rev_mp)
13507
febb8e5d2a9d tidying of Isar scripts
paulson
parents: 11655
diff changeset
   409
apply (erule tls.induct, force, simp_all, blast) 
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   410
done
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   411
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   412
lemmas CX_KB_is_pubKB = Says_imp_spies [THEN parts.Inj, THEN certificate_valid]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   413
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   414
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   415
(*** Properties of items found in Notes ***)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   416
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   417
lemma Notes_Crypt_parts_spies:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   418
     "[| Notes A {|Agent B, X|} \<in> set evs;  evs \<in> tls |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   419
      ==> Crypt (pubK B) X \<in> parts (spies evs)"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   420
apply (erule rev_mp)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   421
apply (erule tls.induct, 
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   422
       frule_tac [7] CX_KB_is_pubKB, force, simp_all)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   423
apply (blast intro: parts_insertI)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   424
done
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   425
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   426
(*C may be either A or B*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   427
lemma Notes_master_imp_Crypt_PMS:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   428
     "[| Notes C {|s, Agent A, Agent B, Nonce(PRF(PMS,NA,NB))|} \<in> set evs;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   429
         evs \<in> tls |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   430
      ==> Crypt (pubK B) (Nonce PMS) \<in> parts (spies evs)"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   431
apply (erule rev_mp)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   432
apply (erule tls.induct, force, simp_all)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   433
(*Fake*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   434
apply (blast intro: parts_insertI)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   435
(*Client, Server Accept*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   436
apply (blast dest!: Notes_Crypt_parts_spies)+
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   437
done
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   438
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   439
(*Compared with the theorem above, both premise and conclusion are stronger*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   440
lemma Notes_master_imp_Notes_PMS:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   441
     "[| Notes A {|s, Agent A, Agent B, Nonce(PRF(PMS,NA,NB))|} \<in> set evs;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   442
         evs \<in> tls |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   443
      ==> Notes A {|Agent B, Nonce PMS|} \<in> set evs"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   444
apply (erule rev_mp)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   445
apply (erule tls.induct, force, simp_all)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   446
(*ServerAccepts*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   447
apply blast
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   448
done
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   449
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   450
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   451
(*** Protocol goal: if B receives CertVerify, then A sent it ***)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   452
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   453
(*B can check A's signature if he has received A's certificate.*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   454
lemma TrustCertVerify_lemma:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   455
     "[| X \<in> parts (spies evs);
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   456
         X = Crypt (priK A) (Hash{|nb, Agent B, pms|});
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   457
         evs \<in> tls;  A \<notin> bad |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   458
      ==> Says A B X \<in> set evs"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   459
apply (erule rev_mp, erule ssubst)
13507
febb8e5d2a9d tidying of Isar scripts
paulson
parents: 11655
diff changeset
   460
apply (erule tls.induct, force, simp_all, blast)
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   461
done
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   462
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   463
(*Final version: B checks X using the distributed KA instead of priK A*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   464
lemma TrustCertVerify:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   465
     "[| X \<in> parts (spies evs);
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   466
         X = Crypt (invKey KA) (Hash{|nb, Agent B, pms|});
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   467
         certificate A KA \<in> parts (spies evs);
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   468
         evs \<in> tls;  A \<notin> bad |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   469
      ==> Says A B X \<in> set evs"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   470
by (blast dest!: certificate_valid intro!: TrustCertVerify_lemma)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   471
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   472
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   473
(*If CertVerify is present then A has chosen PMS.*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   474
lemma UseCertVerify_lemma:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   475
     "[| Crypt (priK A) (Hash{|nb, Agent B, Nonce PMS|}) \<in> parts (spies evs);
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   476
         evs \<in> tls;  A \<notin> bad |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   477
      ==> Notes A {|Agent B, Nonce PMS|} \<in> set evs"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   478
apply (erule rev_mp)
13507
febb8e5d2a9d tidying of Isar scripts
paulson
parents: 11655
diff changeset
   479
apply (erule tls.induct, force, simp_all, blast)
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   480
done
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   481
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   482
(*Final version using the distributed KA instead of priK A*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   483
lemma UseCertVerify:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   484
     "[| Crypt (invKey KA) (Hash{|nb, Agent B, Nonce PMS|})
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   485
           \<in> parts (spies evs);
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   486
         certificate A KA \<in> parts (spies evs);
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   487
         evs \<in> tls;  A \<notin> bad |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   488
      ==> Notes A {|Agent B, Nonce PMS|} \<in> set evs"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   489
by (blast dest!: certificate_valid intro!: UseCertVerify_lemma)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   490
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   491
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   492
lemma no_Notes_A_PRF [simp]:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   493
     "evs \<in> tls ==> Notes A {|Agent B, Nonce (PRF x)|} \<notin> set evs"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   494
apply (erule tls.induct, force, simp_all)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   495
(*ClientKeyExch: PMS is assumed to differ from any PRF.*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   496
apply blast
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   497
done
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   498
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   499
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   500
lemma MS_imp_PMS [dest!]:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   501
     "[| Nonce (PRF (PMS,NA,NB)) \<in> parts (spies evs);  evs \<in> tls |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   502
      ==> Nonce PMS \<in> parts (spies evs)"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   503
apply (erule rev_mp)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   504
apply (erule tls.induct, force, simp_all)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   505
(*Fake*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   506
apply (blast intro: parts_insertI)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   507
(*Easy, e.g. by freshness*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   508
apply (blast dest: Notes_Crypt_parts_spies)+
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   509
done
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   510
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   511
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   512
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   513
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   514
(*** Unicity results for PMS, the pre-master-secret ***)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   515
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   516
(*PMS determines B.*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   517
lemma Crypt_unique_PMS:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   518
     "[| Crypt(pubK B)  (Nonce PMS) \<in> parts (spies evs);
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   519
         Crypt(pubK B') (Nonce PMS) \<in> parts (spies evs);
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   520
         Nonce PMS \<notin> analz (spies evs);
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   521
         evs \<in> tls |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   522
      ==> B=B'"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   523
apply (erule rev_mp, erule rev_mp, erule rev_mp)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   524
apply (erule tls.induct, analz_mono_contra, force, simp_all (no_asm_simp))
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   525
(*Fake, ClientKeyExch*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   526
apply blast+
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   527
done
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   528
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   529
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   530
(** It is frustrating that we need two versions of the unicity results.
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   531
    But Notes A {|Agent B, Nonce PMS|} determines both A and B.  Sometimes
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   532
    we have only the weaker assertion Crypt(pubK B) (Nonce PMS), which
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   533
    determines B alone, and only if PMS is secret.
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   534
**)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   535
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   536
(*In A's internal Note, PMS determines A and B.*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   537
lemma Notes_unique_PMS:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   538
     "[| Notes A  {|Agent B,  Nonce PMS|} \<in> set evs;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   539
         Notes A' {|Agent B', Nonce PMS|} \<in> set evs;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   540
         evs \<in> tls |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   541
      ==> A=A' & B=B'"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   542
apply (erule rev_mp, erule rev_mp)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   543
apply (erule tls.induct, force, simp_all)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   544
(*ClientKeyExch*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   545
apply (blast dest!: Notes_Crypt_parts_spies)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   546
done
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   547
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   548
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   549
(**** Secrecy Theorems ****)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   550
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   551
(*Key compromise lemma needed to prove analz_image_keys.
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   552
  No collection of keys can help the spy get new private keys.*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   553
lemma analz_image_priK [rule_format]:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   554
     "evs \<in> tls
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   555
      ==> \<forall>KK. (Key(priK B) \<in> analz (Key`KK Un (spies evs))) =
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   556
          (priK B \<in> KK | B \<in> bad)"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   557
apply (erule tls.induct)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   558
apply (simp_all (no_asm_simp)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   559
		del: image_insert
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   560
                add: image_Un [THEN sym]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   561
                     insert_Key_image Un_assoc [THEN sym])
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   562
(*Fake*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   563
apply spy_analz
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   564
done
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   565
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   566
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   567
(*slightly speeds up the big simplification below*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   568
lemma range_sessionkeys_not_priK:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   569
     "KK <= range sessionK ==> priK B \<notin> KK"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   570
by blast
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   571
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   572
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   573
(*Lemma for the trivial direction of the if-and-only-if*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   574
lemma analz_image_keys_lemma:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   575
     "(X \<in> analz (G Un H)) --> (X \<in> analz H)  ==>
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   576
      (X \<in> analz (G Un H))  =  (X \<in> analz H)"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   577
by (blast intro: analz_mono [THEN subsetD])
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   578
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   579
(** Strangely, the following version doesn't work:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   580
\<forall>Z. (Nonce N \<in> analz (Key`(sessionK`Z) Un (spies evs))) =
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   581
    (Nonce N \<in> analz (spies evs))"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   582
**)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   583
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   584
lemma analz_image_keys [rule_format]:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   585
     "evs \<in> tls ==>
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   586
      \<forall>KK. KK <= range sessionK -->
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   587
	      (Nonce N \<in> analz (Key`KK Un (spies evs))) =
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   588
	      (Nonce N \<in> analz (spies evs))"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   589
apply (erule tls.induct, frule_tac [7] CX_KB_is_pubKB)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   590
apply (safe del: iffI)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   591
apply (safe del: impI iffI intro!: analz_image_keys_lemma)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   592
apply (simp_all (no_asm_simp)               (*faster*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   593
                del: image_insert imp_disjL (*reduces blow-up*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   594
		add: image_Un [THEN sym]  Un_assoc [THEN sym]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   595
		     insert_Key_singleton
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   596
		     range_sessionkeys_not_priK analz_image_priK)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   597
apply (simp_all add: insert_absorb)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   598
(*Fake*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   599
apply spy_analz
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   600
done
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   601
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   602
(*Knowing some session keys is no help in getting new nonces*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   603
lemma analz_insert_key [simp]:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   604
     "evs \<in> tls ==>
11655
923e4d0d36d5 tuned parentheses in relational expressions;
wenzelm
parents: 11287
diff changeset
   605
      (Nonce N \<in> analz (insert (Key (sessionK z)) (spies evs))) =
11287
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   606
      (Nonce N \<in> analz (spies evs))"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   607
by (simp del: image_insert
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   608
         add: insert_Key_singleton analz_image_keys)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   609
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   610
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   611
(*** Protocol goal: serverK(Na,Nb,M) and clientK(Na,Nb,M) remain secure ***)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   612
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   613
(** Some lemmas about session keys, comprising clientK and serverK **)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   614
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   615
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   616
(*Lemma: session keys are never used if PMS is fresh.
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   617
  Nonces don't have to agree, allowing session resumption.
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   618
  Converse doesn't hold; revealing PMS doesn't force the keys to be sent.
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   619
  THEY ARE NOT SUITABLE AS SAFE ELIM RULES.*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   620
lemma PMS_lemma:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   621
     "[| Nonce PMS \<notin> parts (spies evs);
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   622
         K = sessionK((Na, Nb, PRF(PMS,NA,NB)), role);
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   623
         evs \<in> tls |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   624
   ==> Key K \<notin> parts (spies evs) & (\<forall>Y. Crypt K Y \<notin> parts (spies evs))"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   625
apply (erule rev_mp, erule ssubst)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   626
apply (erule tls.induct, frule_tac [7] CX_KB_is_pubKB)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   627
apply (force, simp_all (no_asm_simp))
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   628
(*Fake*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   629
apply (blast intro: parts_insertI)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   630
(*SpyKeys*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   631
apply blast
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   632
(*Many others*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   633
apply (force dest!: Notes_Crypt_parts_spies Notes_master_imp_Crypt_PMS)+
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   634
done
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   635
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   636
lemma PMS_sessionK_not_spied:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   637
     "[| Key (sessionK((Na, Nb, PRF(PMS,NA,NB)), role)) \<in> parts (spies evs);
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   638
         evs \<in> tls |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   639
      ==> Nonce PMS \<in> parts (spies evs)"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   640
by (blast dest: PMS_lemma)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   641
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   642
lemma PMS_Crypt_sessionK_not_spied:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   643
     "[| Crypt (sessionK((Na, Nb, PRF(PMS,NA,NB)), role)) Y
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   644
           \<in> parts (spies evs);  evs \<in> tls |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   645
      ==> Nonce PMS \<in> parts (spies evs)"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   646
by (blast dest: PMS_lemma)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   647
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   648
(*Write keys are never sent if M (MASTER SECRET) is secure.
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   649
  Converse fails; betraying M doesn't force the keys to be sent!
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   650
  The strong Oops condition can be weakened later by unicity reasoning,
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   651
  with some effort.
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   652
  NO LONGER USED: see clientK_not_spied and serverK_not_spied*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   653
lemma sessionK_not_spied:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   654
     "[| \<forall>A. Says A Spy (Key (sessionK((NA,NB,M),role))) \<notin> set evs;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   655
         Nonce M \<notin> analz (spies evs);  evs \<in> tls |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   656
      ==> Key (sessionK((NA,NB,M),role)) \<notin> parts (spies evs)"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   657
apply (erule rev_mp, erule rev_mp)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   658
apply (erule tls.induct, analz_mono_contra)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   659
apply (force, simp_all (no_asm_simp))
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   660
(*Fake, SpyKeys*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   661
apply blast+
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   662
done
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   663
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   664
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   665
(*If A sends ClientKeyExch to an honest B, then the PMS will stay secret.*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   666
lemma Spy_not_see_PMS:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   667
     "[| Notes A {|Agent B, Nonce PMS|} \<in> set evs;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   668
         evs \<in> tls;  A \<notin> bad;  B \<notin> bad |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   669
      ==> Nonce PMS \<notin> analz (spies evs)"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   670
apply (erule rev_mp, erule tls.induct, frule_tac [7] CX_KB_is_pubKB)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   671
apply (force, simp_all (no_asm_simp))
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   672
(*Fake*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   673
apply spy_analz
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   674
(*SpyKeys*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   675
apply force
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   676
apply (simp_all add: insert_absorb) 
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   677
(*ClientHello, ServerHello, ClientKeyExch: mostly freshness reasoning*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   678
apply (blast dest: Notes_Crypt_parts_spies)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   679
apply (blast dest: Notes_Crypt_parts_spies)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   680
apply (blast dest: Notes_Crypt_parts_spies)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   681
(*ClientAccepts and ServerAccepts: because PMS \<notin> range PRF*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   682
apply force+
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   683
done
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   684
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   685
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   686
(*If A sends ClientKeyExch to an honest B, then the MASTER SECRET
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   687
  will stay secret.*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   688
lemma Spy_not_see_MS:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   689
     "[| Notes A {|Agent B, Nonce PMS|} \<in> set evs;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   690
         evs \<in> tls;  A \<notin> bad;  B \<notin> bad |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   691
      ==> Nonce (PRF(PMS,NA,NB)) \<notin> analz (spies evs)"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   692
apply (erule rev_mp, erule tls.induct, frule_tac [7] CX_KB_is_pubKB)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   693
apply (force, simp_all (no_asm_simp))
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   694
(*Fake*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   695
apply spy_analz
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   696
(*SpyKeys: by secrecy of the PMS, Spy cannot make the MS*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   697
apply (blast dest!: Spy_not_see_PMS)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   698
apply (simp_all add: insert_absorb)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   699
(*ClientAccepts and ServerAccepts: because PMS was already visible;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   700
  others, freshness etc.*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   701
apply (blast dest: Notes_Crypt_parts_spies Spy_not_see_PMS 
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   702
                   Notes_imp_knows_Spy [THEN analz.Inj])+
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   703
done
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   704
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   705
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   706
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   707
(*** Weakening the Oops conditions for leakage of clientK ***)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   708
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   709
(*If A created PMS then nobody else (except the Spy in replays)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   710
  would send a message using a clientK generated from that PMS.*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   711
lemma Says_clientK_unique:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   712
     "[| Says A' B' (Crypt (clientK(Na,Nb,PRF(PMS,NA,NB))) Y) \<in> set evs;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   713
         Notes A {|Agent B, Nonce PMS|} \<in> set evs;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   714
         evs \<in> tls;  A' \<noteq> Spy |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   715
      ==> A = A'"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   716
apply (erule rev_mp, erule rev_mp)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   717
apply (erule tls.induct, frule_tac [7] CX_KB_is_pubKB)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   718
apply (force, simp_all)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   719
(*ClientKeyExch*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   720
apply (blast dest!: PMS_Crypt_sessionK_not_spied)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   721
(*ClientFinished, ClientResume: by unicity of PMS*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   722
apply (blast dest!: Notes_master_imp_Notes_PMS 
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   723
             intro: Notes_unique_PMS [THEN conjunct1])+
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   724
done
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   725
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   726
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   727
(*If A created PMS and has not leaked her clientK to the Spy,
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   728
  then it is completely secure: not even in parts!*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   729
lemma clientK_not_spied:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   730
     "[| Notes A {|Agent B, Nonce PMS|} \<in> set evs;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   731
         Says A Spy (Key (clientK(Na,Nb,PRF(PMS,NA,NB)))) \<notin> set evs;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   732
         A \<notin> bad;  B \<notin> bad;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   733
         evs \<in> tls |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   734
      ==> Key (clientK(Na,Nb,PRF(PMS,NA,NB))) \<notin> parts (spies evs)"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   735
apply (erule rev_mp, erule rev_mp)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   736
apply (erule tls.induct, frule_tac [7] CX_KB_is_pubKB)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   737
apply (force, simp_all (no_asm_simp))
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   738
(*ClientKeyExch*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   739
apply blast 
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   740
(*SpyKeys*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   741
apply (blast dest!: Spy_not_see_MS)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   742
(*ClientKeyExch*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   743
apply (blast dest!: PMS_sessionK_not_spied)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   744
(*Oops*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   745
apply (blast intro: Says_clientK_unique)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   746
done
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   747
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   748
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   749
(*** Weakening the Oops conditions for leakage of serverK ***)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   750
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   751
(*If A created PMS for B, then nobody other than B or the Spy would
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   752
  send a message using a serverK generated from that PMS.*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   753
lemma Says_serverK_unique:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   754
     "[| Says B' A' (Crypt (serverK(Na,Nb,PRF(PMS,NA,NB))) Y) \<in> set evs;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   755
         Notes A {|Agent B, Nonce PMS|} \<in> set evs;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   756
         evs \<in> tls;  A \<notin> bad;  B \<notin> bad;  B' \<noteq> Spy |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   757
      ==> B = B'"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   758
apply (erule rev_mp, erule rev_mp)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   759
apply (erule tls.induct, frule_tac [7] CX_KB_is_pubKB)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   760
apply (force, simp_all)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   761
(*ClientKeyExch*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   762
apply (blast dest!: PMS_Crypt_sessionK_not_spied)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   763
(*ServerResume, ServerFinished: by unicity of PMS*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   764
apply (blast dest!: Notes_master_imp_Crypt_PMS 
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   765
             dest: Spy_not_see_PMS Notes_Crypt_parts_spies Crypt_unique_PMS)+
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   766
done
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   767
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   768
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   769
(*If A created PMS for B, and B has not leaked his serverK to the Spy,
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   770
  then it is completely secure: not even in parts!*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   771
lemma serverK_not_spied:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   772
     "[| Notes A {|Agent B, Nonce PMS|} \<in> set evs;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   773
         Says B Spy (Key(serverK(Na,Nb,PRF(PMS,NA,NB)))) \<notin> set evs;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   774
         A \<notin> bad;  B \<notin> bad;  evs \<in> tls |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   775
      ==> Key (serverK(Na,Nb,PRF(PMS,NA,NB))) \<notin> parts (spies evs)"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   776
apply (erule rev_mp, erule rev_mp)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   777
apply (erule tls.induct, frule_tac [7] CX_KB_is_pubKB)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   778
apply (force, simp_all (no_asm_simp))
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   779
(*Fake*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   780
apply blast 
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   781
(*SpyKeys*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   782
apply (blast dest!: Spy_not_see_MS)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   783
(*ClientKeyExch*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   784
apply (blast dest!: PMS_sessionK_not_spied)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   785
(*Oops*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   786
apply (blast intro: Says_serverK_unique)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   787
done
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   788
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   789
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   790
(*** Protocol goals: if A receives ServerFinished, then B is present
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   791
     and has used the quoted values PA, PB, etc.  Note that it is up to A
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   792
     to compare PA with what she originally sent.
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   793
***)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   794
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   795
(*The mention of her name (A) in X assures A that B knows who she is.*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   796
lemma TrustServerFinished [rule_format]:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   797
     "[| X = Crypt (serverK(Na,Nb,M))
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   798
               (Hash{|Number SID, Nonce M,
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   799
                      Nonce Na, Number PA, Agent A,
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   800
                      Nonce Nb, Number PB, Agent B|});
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   801
         M = PRF(PMS,NA,NB);
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   802
         evs \<in> tls;  A \<notin> bad;  B \<notin> bad |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   803
      ==> Says B Spy (Key(serverK(Na,Nb,M))) \<notin> set evs -->
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   804
          Notes A {|Agent B, Nonce PMS|} \<in> set evs -->
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   805
          X \<in> parts (spies evs) --> Says B A X \<in> set evs"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   806
apply (erule ssubst)+
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   807
apply (erule tls.induct, frule_tac [7] CX_KB_is_pubKB)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   808
apply (force, simp_all (no_asm_simp))
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   809
(*Fake: the Spy doesn't have the critical session key!*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   810
apply (blast dest: serverK_not_spied)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   811
(*ClientKeyExch*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   812
apply (blast dest!: PMS_Crypt_sessionK_not_spied)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   813
done
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   814
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   815
(*This version refers not to ServerFinished but to any message from B.
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   816
  We don't assume B has received CertVerify, and an intruder could
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   817
  have changed A's identity in all other messages, so we can't be sure
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   818
  that B sends his message to A.  If CLIENT KEY EXCHANGE were augmented
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   819
  to bind A's identity with PMS, then we could replace A' by A below.*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   820
lemma TrustServerMsg [rule_format]:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   821
     "[| M = PRF(PMS,NA,NB);  evs \<in> tls;  A \<notin> bad;  B \<notin> bad |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   822
      ==> Says B Spy (Key(serverK(Na,Nb,M))) \<notin> set evs -->
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   823
          Notes A {|Agent B, Nonce PMS|} \<in> set evs -->
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   824
          Crypt (serverK(Na,Nb,M)) Y \<in> parts (spies evs)  -->
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   825
          (\<exists>A'. Says B A' (Crypt (serverK(Na,Nb,M)) Y) \<in> set evs)"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   826
apply (erule ssubst)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   827
apply (erule tls.induct, frule_tac [7] CX_KB_is_pubKB)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   828
apply (force, simp_all (no_asm_simp) add: ex_disj_distrib)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   829
(*Fake: the Spy doesn't have the critical session key!*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   830
apply (blast dest: serverK_not_spied)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   831
(*ClientKeyExch*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   832
apply (clarify, blast dest!: PMS_Crypt_sessionK_not_spied)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   833
(*ServerResume, ServerFinished: by unicity of PMS*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   834
apply (blast dest!: Notes_master_imp_Crypt_PMS 
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   835
             dest: Spy_not_see_PMS Notes_Crypt_parts_spies Crypt_unique_PMS)+
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   836
done
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   837
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   838
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   839
(*** Protocol goal: if B receives any message encrypted with clientK
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   840
     then A has sent it, ASSUMING that A chose PMS.  Authentication is
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   841
     assumed here; B cannot verify it.  But if the message is
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   842
     ClientFinished, then B can then check the quoted values PA, PB, etc.
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   843
***)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   844
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   845
lemma TrustClientMsg [rule_format]:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   846
     "[| M = PRF(PMS,NA,NB);  evs \<in> tls;  A \<notin> bad;  B \<notin> bad |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   847
      ==> Says A Spy (Key(clientK(Na,Nb,M))) \<notin> set evs -->
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   848
          Notes A {|Agent B, Nonce PMS|} \<in> set evs -->
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   849
          Crypt (clientK(Na,Nb,M)) Y \<in> parts (spies evs) -->
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   850
          Says A B (Crypt (clientK(Na,Nb,M)) Y) \<in> set evs"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   851
apply (erule ssubst)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   852
apply (erule tls.induct, frule_tac [7] CX_KB_is_pubKB)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   853
apply (force, simp_all (no_asm_simp))
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   854
(*Fake: the Spy doesn't have the critical session key!*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   855
apply (blast dest: clientK_not_spied)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   856
(*ClientKeyExch*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   857
apply (blast dest!: PMS_Crypt_sessionK_not_spied)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   858
(*ClientFinished, ClientResume: by unicity of PMS*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   859
apply (blast dest!: Notes_master_imp_Notes_PMS dest: Notes_unique_PMS)+
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   860
done
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   861
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   862
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   863
(*** Protocol goal: if B receives ClientFinished, and if B is able to
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   864
     check a CertVerify from A, then A has used the quoted
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   865
     values PA, PB, etc.  Even this one requires A to be uncompromised.
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   866
 ***)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   867
lemma AuthClientFinished:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   868
     "[| M = PRF(PMS,NA,NB);
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   869
         Says A Spy (Key(clientK(Na,Nb,M))) \<notin> set evs;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   870
         Says A' B (Crypt (clientK(Na,Nb,M)) Y) \<in> set evs;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   871
         certificate A KA \<in> parts (spies evs);
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   872
         Says A'' B (Crypt (invKey KA) (Hash{|nb, Agent B, Nonce PMS|}))
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   873
           \<in> set evs;
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   874
         evs \<in> tls;  A \<notin> bad;  B \<notin> bad |]
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   875
      ==> Says A B (Crypt (clientK(Na,Nb,M)) Y) \<in> set evs"
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   876
by (blast intro!: TrustClientMsg UseCertVerify)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   877
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   878
(*22/9/97: loads in 622s, which is 10 minutes 22 seconds*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   879
(*24/9/97: loads in 672s, which is 11 minutes 12 seconds [stronger theorems]*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   880
(*29/9/97: loads in 481s, after removing Certificate from ClientKeyExch*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   881
(*30/9/97: loads in 476s, after removing unused theorems*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   882
(*30/9/97: loads in 448s, after fixing ServerResume*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   883
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   884
(*08/9/97: loads in 189s (pike), after much reorganization,
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   885
           back to 621s on albatross?*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   886
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   887
(*10/2/99: loads in 139s (pike)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   888
           down to 433s on albatross*)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   889
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   890
(*5/5/01: conversion to Isar script
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   891
	  loads in 137s (perch)
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   892
          the last ML version loaded in 122s on perch, a 600MHz machine:
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   893
		twice as fast as pike.  No idea why it's so much slower!
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   894
	  The Isar script is slower still, perhaps because simp_all simplifies
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   895
	  the assumptions be default.
0103ee3082bf conversion of Auth/TLS to Isar script
paulson
parents: 11230
diff changeset
   896
*)
3474
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
   897
44249bba00ec Baby TLS. Proofs work, but model seems unrealistic
paulson
parents:
diff changeset
   898
end