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