src/HOL/SET-Protocol/Purchase.thy
author nipkow
Tue, 04 Sep 2007 15:30:31 +0200
changeset 24526 7fa202789bf6
parent 24123 a0fc58900606
child 30549 d2d7874648bd
permissions -rw-r--r--
tuned lemma; replaced !! by arbitrary
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
     1
(*  Title:      HOL/Auth/SET/Purchase
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
     2
    ID:         $Id$
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
     3
    Authors:    Giampaolo Bella, Fabio Massacci, Lawrence C Paulson
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
     4
*)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
     5
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
     6
header{*Purchase Phase of SET*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
     7
16417
9bc16273c2d4 migrated theory headers to new format
haftmann
parents: 15481
diff changeset
     8
theory Purchase imports PublicSET begin
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
     9
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    10
text{*
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    11
Note: nonces seem to consist of 20 bytes.  That includes both freshness
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    12
challenges (Chall-EE, etc.) and important secrets (CardSecret, PANsecret)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    13
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    14
This version omits @{text LID_C} but retains @{text LID_M}. At first glance
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    15
(Programmer's Guide page 267) it seems that both numbers are just introduced
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    16
for the respective convenience of the Cardholder's and Merchant's
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    17
system. However, omitting both of them would create a problem of
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    18
identification: how can the Merchant's system know what transaction is it
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    19
supposed to process?
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    20
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    21
Further reading (Programmer's guide page 309) suggest that there is an outside
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    22
bootstrapping message (SET initiation message) which is used by the Merchant
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    23
and the Cardholder to agree on the actual transaction. This bootstrapping
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    24
message is described in the SET External Interface Guide and ought to generate
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    25
@{text LID_M}. According SET Extern Interface Guide, this number might be a
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    26
cookie, an invoice number etc. The Programmer's Guide on page 310, states that
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    27
in absence of @{text LID_M} the protocol must somehow ("outside SET") identify
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    28
the transaction from OrderDesc, which is assumed to be a searchable text only
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    29
field. Thus, it is assumed that the Merchant or the Cardholder somehow agreed
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    30
out-of-bad on the value of @{text LID_M} (for instance a cookie in a web
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    31
transaction etc.). This out-of-band agreement is expressed with a preliminary
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    32
start action in which the merchant and the Cardholder agree on the appropriate
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    33
values. Agreed values are stored with a suitable notes action.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    34
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    35
"XID is a transaction ID that is usually generated by the Merchant system,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    36
unless there is no PInitRes, in which case it is generated by the Cardholder
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    37
system. It is a randomly generated 20 byte variable that is globally unique
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    38
(statistically). Merchant and Cardholder systems shall use appropriate random
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    39
number generators to ensure the global uniqueness of XID."
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    40
--Programmer's Guide, page 267.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    41
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    42
PI (Payment Instruction) is the most central and sensitive data structure in
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    43
SET. It is used to pass the data required to authorize a payment card payment
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    44
from the Cardholder to the Payment Gateway, which will use the data to
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    45
initiate a payment card transaction through the traditional payment card
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    46
financial network. The data is encrypted by the Cardholder and sent via the
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    47
Merchant, such that the data is hidden from the Merchant unless the Acquirer
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    48
passes the data back to the Merchant.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    49
--Programmer's Guide, page 271.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    50
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    51
consts
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    52
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    53
    CardSecret :: "nat => nat"
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15214
diff changeset
    54
     --{*Maps Cardholders to CardSecrets.
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15214
diff changeset
    55
         A CardSecret of 0 means no cerificate, must use unsigned format.*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    56
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    57
    PANSecret :: "nat => nat"
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15214
diff changeset
    58
     --{*Maps Cardholders to PANSecrets.*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    59
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16474
diff changeset
    60
inductive_set
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16474
diff changeset
    61
  set_pur :: "event list set"
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16474
diff changeset
    62
where
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    63
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    64
  Nil:   --{*Initial trace is empty*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    65
	 "[] \<in> set_pur"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    66
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16474
diff changeset
    67
| Fake:  --{*The spy MAY say anything he CAN say.*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    68
	 "[| evsf \<in> set_pur;  X \<in> synth(analz(knows Spy evsf)) |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    69
	  ==> Says Spy B X  # evsf \<in> set_pur"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    70
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    71
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16474
diff changeset
    72
| Reception: --{*If A sends a message X to B, then B might receive it*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    73
	     "[| evsr \<in> set_pur;  Says A B X \<in> set evsr |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    74
	      ==> Gets B X  # evsr \<in> set_pur"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    75
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16474
diff changeset
    76
| Start: 
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    77
      --{*Added start event which is out-of-band for SET: the Cardholder and
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    78
	  the merchant agree on the amounts and uses @{text LID_M} as an
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    79
          identifier.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    80
	  This is suggested by the External Interface Guide. The Programmer's
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    81
	  Guide, in absence of @{text LID_M}, states that the merchant uniquely
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    82
	  identifies the order out of some data contained in OrderDesc.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    83
   "[|evsStart \<in> set_pur;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    84
      Number LID_M \<notin> used evsStart;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    85
      C = Cardholder k; M = Merchant i; P = PG j;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    86
      Transaction = {|Agent M, Agent C, Number OrderDesc, Number PurchAmt|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    87
      LID_M \<notin> range CardSecret;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    88
      LID_M \<notin> range PANSecret |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    89
     ==> Notes C {|Number LID_M, Transaction|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    90
       # Notes M {|Number LID_M, Agent P, Transaction|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    91
       # evsStart \<in> set_pur"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    92
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16474
diff changeset
    93
| PInitReq:
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    94
     --{*Purchase initialization, page 72 of Formal Protocol Desc.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    95
   "[|evsPIReq \<in> set_pur;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    96
      Transaction = {|Agent M, Agent C, Number OrderDesc, Number PurchAmt|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    97
      Nonce Chall_C \<notin> used evsPIReq;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    98
      Chall_C \<notin> range CardSecret; Chall_C \<notin> range PANSecret;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    99
      Notes C {|Number LID_M, Transaction |} \<in> set evsPIReq |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   100
    ==> Says C M {|Number LID_M, Nonce Chall_C|} # evsPIReq \<in> set_pur"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   101
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16474
diff changeset
   102
| PInitRes:
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   103
     --{*Merchant replies with his own label XID and the encryption
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   104
	 key certificate of his chosen Payment Gateway. Page 74 of Formal
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   105
         Protocol Desc. We use @{text LID_M} to identify Cardholder*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   106
   "[|evsPIRes \<in> set_pur;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   107
      Gets M {|Number LID_M, Nonce Chall_C|} \<in> set evsPIRes;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   108
      Transaction = {|Agent M, Agent C, Number OrderDesc, Number PurchAmt|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   109
      Notes M {|Number LID_M, Agent P, Transaction|} \<in> set evsPIRes;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   110
      Nonce Chall_M \<notin> used evsPIRes;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   111
      Chall_M \<notin> range CardSecret; Chall_M \<notin> range PANSecret;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   112
      Number XID \<notin> used evsPIRes;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   113
      XID \<notin> range CardSecret; XID \<notin> range PANSecret|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   114
    ==> Says M C (sign (priSK M)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   115
		       {|Number LID_M, Number XID,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   116
			 Nonce Chall_C, Nonce Chall_M,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   117
			 cert P (pubEK P) onlyEnc (priSK RCA)|})
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   118
          # evsPIRes \<in> set_pur"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   119
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16474
diff changeset
   120
| PReqUns:
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   121
      --{*UNSIGNED Purchase request (CardSecret = 0).
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   122
	Page 79 of Formal Protocol Desc.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   123
	Merchant never sees the amount in clear. This holds of the real
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   124
	protocol, where XID identifies the transaction. We omit
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   125
	Hash{|Number XID, Nonce (CardSecret k)|} from PIHead because
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   126
	the CardSecret is 0 and because AuthReq treated the unsigned case
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   127
	very differently from the signed one anyway.*}
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16474
diff changeset
   128
   "!!Chall_C Chall_M OrderDesc P PurchAmt XID evsPReqU.
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16474
diff changeset
   129
    [|evsPReqU \<in> set_pur;
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   130
      C = Cardholder k; CardSecret k = 0;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   131
      Key KC1 \<notin> used evsPReqU;  KC1 \<in> symKeys;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   132
      Transaction = {|Agent M, Agent C, Number OrderDesc, Number PurchAmt|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   133
      HOD = Hash{|Number OrderDesc, Number PurchAmt|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   134
      OIData = {|Number LID_M, Number XID, Nonce Chall_C, HOD,Nonce Chall_M|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   135
      PIHead = {|Number LID_M, Number XID, HOD, Number PurchAmt, Agent M|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   136
      Gets C (sign (priSK M)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   137
		   {|Number LID_M, Number XID,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   138
		     Nonce Chall_C, Nonce Chall_M,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   139
		     cert P EKj onlyEnc (priSK RCA)|})
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   140
	\<in> set evsPReqU;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   141
      Says C M {|Number LID_M, Nonce Chall_C|} \<in> set evsPReqU;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   142
      Notes C {|Number LID_M, Transaction|} \<in> set evsPReqU |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   143
    ==> Says C M
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   144
	     {|EXHcrypt KC1 EKj {|PIHead, Hash OIData|} (Pan (pan C)),
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   145
	       OIData, Hash{|PIHead, Pan (pan C)|} |}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   146
	  # Notes C {|Key KC1, Agent M|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   147
	  # evsPReqU \<in> set_pur"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   148
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16474
diff changeset
   149
| PReqS:
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   150
      --{*SIGNED Purchase request.  Page 77 of Formal Protocol Desc.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   151
          We could specify the equation
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   152
	  @{term "PIReqSigned = {| PIDualSigned, OIDualSigned |}"}, since the
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   153
	  Formal Desc. gives PIHead the same format in the unsigned case.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   154
	  However, there's little point, as P treats the signed and 
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   155
          unsigned cases differently.*}
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16474
diff changeset
   156
   "!!C Chall_C Chall_M EKj HOD KC2 LID_M M OIData
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16474
diff changeset
   157
      OIDualSigned OrderDesc P PANData PIData PIDualSigned
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16474
diff changeset
   158
      PIHead PurchAmt Transaction XID evsPReqS k.
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16474
diff changeset
   159
    [|evsPReqS \<in> set_pur;
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   160
      C = Cardholder k;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   161
      CardSecret k \<noteq> 0;  Key KC2 \<notin> used evsPReqS;  KC2 \<in> symKeys;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   162
      Transaction = {|Agent M, Agent C, Number OrderDesc, Number PurchAmt|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   163
      HOD = Hash{|Number OrderDesc, Number PurchAmt|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   164
      OIData = {|Number LID_M, Number XID, Nonce Chall_C, HOD, Nonce Chall_M|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   165
      PIHead = {|Number LID_M, Number XID, HOD, Number PurchAmt, Agent M,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   166
		  Hash{|Number XID, Nonce (CardSecret k)|}|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   167
      PANData = {|Pan (pan C), Nonce (PANSecret k)|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   168
      PIData = {|PIHead, PANData|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   169
      PIDualSigned = {|sign (priSK C) {|Hash PIData, Hash OIData|},
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   170
		       EXcrypt KC2 EKj {|PIHead, Hash OIData|} PANData|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   171
      OIDualSigned = {|OIData, Hash PIData|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   172
      Gets C (sign (priSK M)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   173
		   {|Number LID_M, Number XID,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   174
		     Nonce Chall_C, Nonce Chall_M,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   175
		     cert P EKj onlyEnc (priSK RCA)|})
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   176
	\<in> set evsPReqS;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   177
      Says C M {|Number LID_M, Nonce Chall_C|} \<in> set evsPReqS;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   178
      Notes C {|Number LID_M, Transaction|} \<in> set evsPReqS |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   179
    ==> Says C M {|PIDualSigned, OIDualSigned|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   180
	  # Notes C {|Key KC2, Agent M|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   181
	  # evsPReqS \<in> set_pur"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   182
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   183
  --{*Authorization Request.  Page 92 of Formal Protocol Desc.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   184
    Sent in response to Purchase Request.*}
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16474
diff changeset
   185
| AuthReq:
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   186
   "[| evsAReq \<in> set_pur;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   187
       Key KM \<notin> used evsAReq;  KM \<in> symKeys;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   188
       Transaction = {|Agent M, Agent C, Number OrderDesc, Number PurchAmt|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   189
       HOD = Hash{|Number OrderDesc, Number PurchAmt|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   190
       OIData = {|Number LID_M, Number XID, Nonce Chall_C, HOD,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   191
		  Nonce Chall_M|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   192
       CardSecret k \<noteq> 0 -->
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   193
	 P_I = {|sign (priSK C) {|HPIData, Hash OIData|}, encPANData|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   194
       Gets M {|P_I, OIData, HPIData|} \<in> set evsAReq;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   195
       Says M C (sign (priSK M) {|Number LID_M, Number XID,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   196
				  Nonce Chall_C, Nonce Chall_M,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   197
				  cert P EKj onlyEnc (priSK RCA)|})
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   198
	 \<in> set evsAReq;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   199
	Notes M {|Number LID_M, Agent P, Transaction|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   200
	   \<in> set evsAReq |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   201
    ==> Says M P
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   202
	     (EncB (priSK M) KM (pubEK P)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   203
	       {|Number LID_M, Number XID, Hash OIData, HOD|}	P_I)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   204
	  # evsAReq \<in> set_pur"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   205
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   206
  --{*Authorization Response has two forms: for UNSIGNED and SIGNED PIs.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   207
    Page 99 of Formal Protocol Desc.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   208
    PI is a keyword (product!), so we call it @{text P_I}. The hashes HOD and
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   209
    HOIData occur independently in @{text P_I} and in M's message.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   210
    The authCode in AuthRes represents the baggage of EncB, which in the
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   211
    full protocol is [CapToken], [AcqCardMsg], [AuthToken]:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   212
    optional items for split shipments, recurring payments, etc.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   213
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16474
diff changeset
   214
| AuthResUns:
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   215
    --{*Authorization Response, UNSIGNED*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   216
   "[| evsAResU \<in> set_pur;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   217
       C = Cardholder k; M = Merchant i;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   218
       Key KP \<notin> used evsAResU;  KP \<in> symKeys;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   219
       CardSecret k = 0;  KC1 \<in> symKeys;  KM \<in> symKeys;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   220
       PIHead = {|Number LID_M, Number XID, HOD, Number PurchAmt, Agent M|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   221
       P_I = EXHcrypt KC1 EKj {|PIHead, HOIData|} (Pan (pan C));
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   222
       Gets P (EncB (priSK M) KM (pubEK P)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   223
	       {|Number LID_M, Number XID, HOIData, HOD|} P_I)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   224
	   \<in> set evsAResU |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   225
   ==> Says P M
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   226
	    (EncB (priSK P) KP (pubEK M)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   227
	      {|Number LID_M, Number XID, Number PurchAmt|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   228
	      authCode)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   229
       # evsAResU \<in> set_pur"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   230
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16474
diff changeset
   231
| AuthResS:
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   232
    --{*Authorization Response, SIGNED*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   233
   "[| evsAResS \<in> set_pur;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   234
       C = Cardholder k;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   235
       Key KP \<notin> used evsAResS;  KP \<in> symKeys;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   236
       CardSecret k \<noteq> 0;  KC2 \<in> symKeys;  KM \<in> symKeys;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   237
       P_I = {|sign (priSK C) {|Hash PIData, HOIData|},
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   238
	       EXcrypt KC2 (pubEK P) {|PIHead, HOIData|} PANData|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   239
       PANData = {|Pan (pan C), Nonce (PANSecret k)|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   240
       PIData = {|PIHead, PANData|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   241
       PIHead = {|Number LID_M, Number XID, HOD, Number PurchAmt, Agent M,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   242
		  Hash{|Number XID, Nonce (CardSecret k)|}|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   243
       Gets P (EncB (priSK M) KM (pubEK P)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   244
		{|Number LID_M, Number XID, HOIData, HOD|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   245
	       P_I)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   246
	   \<in> set evsAResS |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   247
   ==> Says P M
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   248
	    (EncB (priSK P) KP (pubEK M)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   249
	      {|Number LID_M, Number XID, Number PurchAmt|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   250
	      authCode)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   251
       # evsAResS \<in> set_pur"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   252
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16474
diff changeset
   253
| PRes:
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   254
    --{*Purchase response.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   255
   "[| evsPRes \<in> set_pur;  KP \<in> symKeys;  M = Merchant i;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   256
       Transaction = {|Agent M, Agent C, Number OrderDesc, Number PurchAmt|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   257
       Gets M (EncB (priSK P) KP (pubEK M)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   258
	      {|Number LID_M, Number XID, Number PurchAmt|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   259
	      authCode)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   260
	  \<in> set evsPRes;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   261
       Gets M {|Number LID_M, Nonce Chall_C|} \<in> set evsPRes;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   262
       Says M P
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   263
	    (EncB (priSK M) KM (pubEK P)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   264
	      {|Number LID_M, Number XID, Hash OIData, HOD|} P_I)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   265
	 \<in> set evsPRes;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   266
       Notes M {|Number LID_M, Agent P, Transaction|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   267
	  \<in> set evsPRes
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   268
      |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   269
   ==> Says M C
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   270
	 (sign (priSK M) {|Number LID_M, Number XID, Nonce Chall_C,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   271
			   Hash (Number PurchAmt)|})
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   272
	 # evsPRes \<in> set_pur"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   273
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   274
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   275
specification (CardSecret PANSecret)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   276
  inj_CardSecret:  "inj CardSecret"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   277
  inj_PANSecret:   "inj PANSecret"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   278
  CardSecret_neq_PANSecret: "CardSecret k \<noteq> PANSecret k'"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   279
    --{*No CardSecret equals any PANSecret*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   280
  apply (rule_tac x="curry nat2_to_nat 0" in exI)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   281
  apply (rule_tac x="curry nat2_to_nat 1" in exI)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   282
  apply (simp add: nat2_to_nat_inj [THEN inj_eq] inj_on_def)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   283
  done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   284
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   285
declare Says_imp_knows_Spy [THEN parts.Inj, dest]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   286
declare parts.Body [dest]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   287
declare analz_into_parts [dest]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   288
declare Fake_parts_insert_in_Un [dest]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   289
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   290
declare CardSecret_neq_PANSecret [iff] 
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   291
        CardSecret_neq_PANSecret [THEN not_sym, iff]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   292
declare inj_CardSecret [THEN inj_eq, iff] 
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   293
        inj_PANSecret [THEN inj_eq, iff]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   294
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   295
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   296
subsection{*Possibility Properties*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   297
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   298
lemma Says_to_Gets:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   299
     "Says A B X # evs \<in> set_pur ==> Gets B X # Says A B X # evs \<in> set_pur"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   300
by (rule set_pur.Reception, auto)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   301
14206
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   302
text{*Possibility for UNSIGNED purchases. Note that we need to ensure
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   303
that XID differs from OrderDesc and PurchAmt, since it is supposed to be
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   304
a unique number!*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   305
lemma possibility_Uns:
14206
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   306
    "[| CardSecret k = 0;
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   307
        C = Cardholder k;  M = Merchant i;
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   308
	Key KC \<notin> used []; Key KM \<notin> used []; Key KP \<notin> used []; 
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   309
	KC \<in> symKeys; KM \<in> symKeys; KP \<in> symKeys; 
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   310
	KC < KM; KM < KP;
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   311
	Nonce Chall_C \<notin> used []; Chall_C \<notin> range CardSecret \<union> range PANSecret;
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   312
        Nonce Chall_M \<notin> used []; Chall_M \<notin> range CardSecret \<union> range PANSecret;
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   313
	Chall_C < Chall_M; 
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   314
        Number LID_M \<notin> used []; LID_M \<notin> range CardSecret \<union> range PANSecret;
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   315
        Number XID \<notin> used []; XID \<notin> range CardSecret \<union> range PANSecret;
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   316
        LID_M < XID; XID < OrderDesc; OrderDesc < PurchAmt |] 
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   317
   ==> \<exists>evs \<in> set_pur.
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   318
          Says M C
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   319
               (sign (priSK M)
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   320
                    {|Number LID_M, Number XID, Nonce Chall_C, 
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   321
                      Hash (Number PurchAmt)|})
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   322
                  \<in> set evs" 
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   323
apply (intro exI bexI)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   324
apply (rule_tac [2]
14206
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   325
	set_pur.Nil
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   326
         [THEN set_pur.Start [of _ LID_M C k M i _ _ _ OrderDesc PurchAmt], 
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   327
	  THEN set_pur.PInitReq [of concl: C M LID_M Chall_C],
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   328
          THEN Says_to_Gets, 
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   329
	  THEN set_pur.PInitRes [of concl: M C LID_M XID Chall_C Chall_M], 
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   330
          THEN Says_to_Gets,
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   331
	  THEN set_pur.PReqUns [of concl: C M KC],
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   332
          THEN Says_to_Gets, 
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   333
	  THEN set_pur.AuthReq [of concl: M "PG j" KM LID_M XID], 
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   334
          THEN Says_to_Gets, 
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   335
	  THEN set_pur.AuthResUns [of concl: "PG j" M KP LID_M XID],
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   336
          THEN Says_to_Gets, 
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   337
	  THEN set_pur.PRes]) 
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   338
apply (tactic "PublicSET.basic_possibility_tac")
14206
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   339
apply (simp_all add: used_Cons symKeys_neq_imp_neq) 
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   340
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   341
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   342
lemma possibility_S:
14206
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   343
    "[| CardSecret k \<noteq> 0;
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   344
        C = Cardholder k;  M = Merchant i;
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   345
	Key KC \<notin> used []; Key KM \<notin> used []; Key KP \<notin> used []; 
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   346
	KC \<in> symKeys; KM \<in> symKeys; KP \<in> symKeys; 
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   347
	KC < KM; KM < KP;
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   348
	Nonce Chall_C \<notin> used []; Chall_C \<notin> range CardSecret \<union> range PANSecret;
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   349
        Nonce Chall_M \<notin> used []; Chall_M \<notin> range CardSecret \<union> range PANSecret;
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   350
	Chall_C < Chall_M; 
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   351
        Number LID_M \<notin> used []; LID_M \<notin> range CardSecret \<union> range PANSecret;
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   352
        Number XID \<notin> used []; XID \<notin> range CardSecret \<union> range PANSecret;
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   353
        LID_M < XID; XID < OrderDesc; OrderDesc < PurchAmt |] 
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   354
   ==>  \<exists>evs \<in> set_pur.
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   355
            Says M C
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   356
                 (sign (priSK M) {|Number LID_M, Number XID, Nonce Chall_C, 
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   357
                                   Hash (Number PurchAmt)|})
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   358
               \<in> set evs"
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   359
apply (intro exI bexI)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   360
apply (rule_tac [2]
14206
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   361
	set_pur.Nil
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   362
         [THEN set_pur.Start [of _ LID_M C k M i _ _ _ OrderDesc PurchAmt], 
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   363
	  THEN set_pur.PInitReq [of concl: C M LID_M Chall_C],
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   364
          THEN Says_to_Gets, 
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   365
	  THEN set_pur.PInitRes [of concl: M C LID_M XID Chall_C Chall_M], 
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   366
          THEN Says_to_Gets,
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   367
	  THEN set_pur.PReqS [of concl: C M _ _ KC],
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   368
          THEN Says_to_Gets, 
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   369
	  THEN set_pur.AuthReq [of concl: M "PG j" KM LID_M XID], 
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   370
          THEN Says_to_Gets, 
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   371
	  THEN set_pur.AuthResS [of concl: "PG j" M KP LID_M XID],
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   372
          THEN Says_to_Gets, 
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   373
	  THEN set_pur.PRes]) 
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   374
apply (tactic "PublicSET.basic_possibility_tac")
14206
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   375
apply (auto simp add: used_Cons symKeys_neq_imp_neq) 
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   376
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   377
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15214
diff changeset
   378
text{*General facts about message reception*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   379
lemma Gets_imp_Says:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   380
     "[| Gets B X \<in> set evs; evs \<in> set_pur |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   381
   ==> \<exists>A. Says A B X \<in> set evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   382
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   383
apply (erule set_pur.induct, auto)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   384
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   385
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   386
lemma Gets_imp_knows_Spy:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   387
     "[| Gets B X \<in> set evs; evs \<in> set_pur |]  ==> X \<in> knows Spy evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   388
by (blast dest!: Gets_imp_Says Says_imp_knows_Spy)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   389
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   390
declare Gets_imp_knows_Spy [THEN parts.Inj, dest]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   391
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   392
text{*Forwarding lemmas, to aid simplification*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   393
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   394
lemma AuthReq_msg_in_parts_spies:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   395
     "[|Gets M {|P_I, OIData, HPIData|} \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   396
        evs \<in> set_pur|] ==> P_I \<in> parts (knows Spy evs)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   397
by auto
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   398
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   399
lemma AuthReq_msg_in_analz_spies:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   400
     "[|Gets M {|P_I, OIData, HPIData|} \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   401
        evs \<in> set_pur|] ==> P_I \<in> analz (knows Spy evs)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   402
by (blast dest: Gets_imp_knows_Spy [THEN analz.Inj])
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   403
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   404
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   405
subsection{*Proofs on Asymmetric Keys*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   406
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   407
text{*Private Keys are Secret*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   408
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   409
text{*Spy never sees an agent's private keys! (unless it's bad at start)*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   410
lemma Spy_see_private_Key [simp]:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   411
     "evs \<in> set_pur
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   412
      ==> (Key(invKey (publicKey b A)) \<in> parts(knows Spy evs)) = (A \<in> bad)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   413
apply (erule set_pur.induct)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   414
apply (frule_tac [9] AuthReq_msg_in_parts_spies) --{*AuthReq*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   415
apply auto
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   416
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   417
declare Spy_see_private_Key [THEN [2] rev_iffD1, dest!]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   418
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   419
lemma Spy_analz_private_Key [simp]:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   420
     "evs \<in> set_pur ==>
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   421
     (Key(invKey (publicKey b A)) \<in> analz(knows Spy evs)) = (A \<in> bad)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   422
by auto
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   423
declare Spy_analz_private_Key [THEN [2] rev_iffD1, dest!]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   424
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   425
text{*rewriting rule for priEK's*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   426
lemma parts_image_priEK:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   427
     "[|Key (priEK C) \<in> parts (Key`KK Un (knows Spy evs));
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   428
        evs \<in> set_pur|] ==> priEK C \<in> KK | C \<in> bad"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   429
by auto
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   430
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15214
diff changeset
   431
text{*trivial proof because @{term"priEK C"} never appears even in
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15214
diff changeset
   432
  @{term "parts evs"}. *}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   433
lemma analz_image_priEK:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   434
     "evs \<in> set_pur ==>
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   435
          (Key (priEK C) \<in> analz (Key`KK Un (knows Spy evs))) =
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   436
          (priEK C \<in> KK | C \<in> bad)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   437
by (blast dest!: parts_image_priEK intro: analz_mono [THEN [2] rev_subsetD])
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   438
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15214
diff changeset
   439
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   440
subsection{*Public Keys in Certificates are Correct*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   441
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   442
lemma Crypt_valid_pubEK [dest!]:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   443
     "[| Crypt (priSK RCA) {|Agent C, Key EKi, onlyEnc|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   444
           \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   445
         evs \<in> set_pur |] ==> EKi = pubEK C"
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15214
diff changeset
   446
by (erule rev_mp, erule set_pur.induct, auto)
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   447
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   448
lemma Crypt_valid_pubSK [dest!]:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   449
     "[| Crypt (priSK RCA) {|Agent C, Key SKi, onlySig|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   450
           \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   451
         evs \<in> set_pur |] ==> SKi = pubSK C"
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15214
diff changeset
   452
by (erule rev_mp, erule set_pur.induct, auto)
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   453
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   454
lemma certificate_valid_pubEK:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   455
    "[| cert C EKi onlyEnc (priSK RCA) \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   456
        evs \<in> set_pur |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   457
     ==> EKi = pubEK C"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   458
by (unfold cert_def signCert_def, auto)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   459
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   460
lemma certificate_valid_pubSK:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   461
    "[| cert C SKi onlySig (priSK RCA) \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   462
        evs \<in> set_pur |] ==> SKi = pubSK C"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   463
by (unfold cert_def signCert_def, auto)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   464
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   465
lemma Says_certificate_valid [simp]:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   466
     "[| Says A B (sign SK {|lid, xid, cc, cm,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   467
                           cert C EK onlyEnc (priSK RCA)|}) \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   468
         evs \<in> set_pur |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   469
      ==> EK = pubEK C"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   470
by (unfold sign_def, auto)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   471
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   472
lemma Gets_certificate_valid [simp]:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   473
     "[| Gets A (sign SK {|lid, xid, cc, cm,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   474
                           cert C EK onlyEnc (priSK RCA)|}) \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   475
         evs \<in> set_pur |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   476
      ==> EK = pubEK C"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   477
by (frule Gets_imp_Says, auto)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   478
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   479
method_setup valid_certificate_tac = {*
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   480
  Method.goal_args (Scan.succeed ()) (fn () => fn i =>
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   481
    EVERY [ftac @{thm Gets_certificate_valid} i,
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   482
           assume_tac i, REPEAT (hyp_subst_tac i)])
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   483
*} ""
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   484
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   485
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   486
subsection{*Proofs on Symmetric Keys*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   487
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   488
text{*Nobody can have used non-existent keys!*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   489
lemma new_keys_not_used [rule_format,simp]:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   490
     "evs \<in> set_pur
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   491
      ==> Key K \<notin> used evs --> K \<in> symKeys -->
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   492
          K \<notin> keysFor (parts (knows Spy evs))"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   493
apply (erule set_pur.induct)
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   494
apply (valid_certificate_tac [8]) --{*PReqS*}
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   495
apply (valid_certificate_tac [7]) --{*PReqUns*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   496
apply auto
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   497
apply (force dest!: usedI keysFor_parts_insert) --{*Fake*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   498
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   499
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   500
lemma new_keys_not_analzd:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   501
     "[|Key K \<notin> used evs; K \<in> symKeys; evs \<in> set_pur |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   502
      ==> K \<notin> keysFor (analz (knows Spy evs))"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   503
by (blast intro: keysFor_mono [THEN [2] rev_subsetD] dest: new_keys_not_used)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   504
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   505
lemma Crypt_parts_imp_used:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   506
     "[|Crypt K X \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   507
        K \<in> symKeys; evs \<in> set_pur |] ==> Key K \<in> used evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   508
apply (rule ccontr)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   509
apply (force dest: new_keys_not_used Crypt_imp_invKey_keysFor)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   510
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   511
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   512
lemma Crypt_analz_imp_used:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   513
     "[|Crypt K X \<in> analz (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   514
        K \<in> symKeys; evs \<in> set_pur |] ==> Key K \<in> used evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   515
by (blast intro: Crypt_parts_imp_used)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   516
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   517
text{*New versions: as above, but generalized to have the KK argument*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   518
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   519
lemma gen_new_keys_not_used:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   520
     "[|Key K \<notin> used evs; K \<in> symKeys; evs \<in> set_pur |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   521
      ==> Key K \<notin> used evs --> K \<in> symKeys -->
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   522
          K \<notin> keysFor (parts (Key`KK Un knows Spy evs))"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   523
by auto
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   524
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   525
lemma gen_new_keys_not_analzd:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   526
     "[|Key K \<notin> used evs; K \<in> symKeys; evs \<in> set_pur |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   527
      ==> K \<notin> keysFor (analz (Key`KK Un knows Spy evs))"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   528
by (blast intro: keysFor_mono [THEN subsetD] dest: gen_new_keys_not_used)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   529
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   530
lemma analz_Key_image_insert_eq:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   531
     "[|Key K \<notin> used evs; K \<in> symKeys; evs \<in> set_pur |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   532
      ==> analz (Key ` (insert K KK) \<union> knows Spy evs) =
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   533
          insert (Key K) (analz (Key ` KK \<union> knows Spy evs))"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   534
by (simp add: gen_new_keys_not_analzd)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   535
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   536
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   537
subsection{*Secrecy of Symmetric Keys*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   538
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   539
lemma Key_analz_image_Key_lemma:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   540
     "P --> (Key K \<in> analz (Key`KK Un H)) --> (K\<in>KK | Key K \<in> analz H)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   541
      ==>
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   542
      P --> (Key K \<in> analz (Key`KK Un H)) = (K\<in>KK | Key K \<in> analz H)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   543
by (blast intro: analz_mono [THEN [2] rev_subsetD])
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   544
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   545
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   546
lemma symKey_compromise:
15205
ecf9a884970d some x-symbols
paulson
parents: 14256
diff changeset
   547
     "evs \<in> set_pur \<Longrightarrow>
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   548
      (\<forall>SK KK. SK \<in> symKeys \<longrightarrow>
15205
ecf9a884970d some x-symbols
paulson
parents: 14256
diff changeset
   549
        (\<forall>K \<in> KK. K \<notin> range(\<lambda>C. priEK C)) \<longrightarrow>
ecf9a884970d some x-symbols
paulson
parents: 14256
diff changeset
   550
               (Key SK \<in> analz (Key`KK \<union> (knows Spy evs))) =
ecf9a884970d some x-symbols
paulson
parents: 14256
diff changeset
   551
               (SK \<in> KK \<or> Key SK \<in> analz (knows Spy evs)))"
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   552
apply (erule set_pur.induct)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   553
apply (rule_tac [!] allI)+
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   554
apply (rule_tac [!] impI [THEN Key_analz_image_Key_lemma, THEN impI])+
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   555
apply (frule_tac [9] AuthReq_msg_in_analz_spies) --{*AReq*}
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   556
apply (valid_certificate_tac [8]) --{*PReqS*}
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   557
apply (valid_certificate_tac [7]) --{*PReqUns*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   558
apply (simp_all
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   559
         del: image_insert image_Un imp_disjL
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   560
         add: analz_image_keys_simps disj_simps
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   561
              analz_Key_image_insert_eq notin_image_iff
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   562
              analz_insert_simps analz_image_priEK)
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   563
  --{*8 seconds on a 1.6GHz machine*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   564
apply spy_analz --{*Fake*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   565
apply (blast elim!: ballE)+ --{*PReq: unsigned and signed*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   566
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   567
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   568
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   569
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   570
subsection{*Secrecy of Nonces*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   571
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   572
text{*As usual: we express the property as a logical equivalence*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   573
lemma Nonce_analz_image_Key_lemma:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   574
     "P --> (Nonce N \<in> analz (Key`KK Un H)) --> (Nonce N \<in> analz H)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   575
      ==> P --> (Nonce N \<in> analz (Key`KK Un H)) = (Nonce N \<in> analz H)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   576
by (blast intro: analz_mono [THEN [2] rev_subsetD])
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   577
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   578
text{*The @{text "(no_asm)"} attribute is essential, since it retains
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   579
  the quantifier and allows the simprule's condition to itself be simplified.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   580
lemma Nonce_compromise [rule_format (no_asm)]:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   581
     "evs \<in> set_pur ==>
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   582
      (\<forall>N KK. (\<forall>K \<in> KK. K \<notin> range(\<lambda>C. priEK C))   -->
14256
paulson
parents: 14206
diff changeset
   583
              (Nonce N \<in> analz (Key`KK \<union> (knows Spy evs))) =
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   584
              (Nonce N \<in> analz (knows Spy evs)))"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   585
apply (erule set_pur.induct)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   586
apply (rule_tac [!] allI)+
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   587
apply (rule_tac [!] impI [THEN Nonce_analz_image_Key_lemma])+
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   588
apply (frule_tac [9] AuthReq_msg_in_analz_spies) --{*AReq*}
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   589
apply (valid_certificate_tac [8]) --{*PReqS*}
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   590
apply (valid_certificate_tac [7]) --{*PReqUns*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   591
apply (simp_all
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   592
         del: image_insert image_Un imp_disjL
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   593
         add: analz_image_keys_simps disj_simps symKey_compromise
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   594
              analz_Key_image_insert_eq notin_image_iff
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   595
              analz_insert_simps analz_image_priEK)
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   596
  --{*8 seconds on a 1.6GHz machine*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   597
apply spy_analz --{*Fake*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   598
apply (blast elim!: ballE) --{*PReqS*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   599
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   600
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   601
lemma PANSecret_notin_spies:
14256
paulson
parents: 14206
diff changeset
   602
     "[|Nonce (PANSecret k) \<in> analz (knows Spy evs);  evs \<in> set_pur|]
paulson
parents: 14206
diff changeset
   603
      ==> 
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   604
       (\<exists>V W X Y KC2 M. \<exists>P \<in> bad.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   605
          Says (Cardholder k) M
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   606
               {|{|W, EXcrypt KC2 (pubEK P) X {|Y, Nonce (PANSecret k)|}|},
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   607
                 V|}  \<in>  set evs)"
14256
paulson
parents: 14206
diff changeset
   608
apply (erule rev_mp)
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   609
apply (erule set_pur.induct)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   610
apply (frule_tac [9] AuthReq_msg_in_analz_spies)
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   611
apply (valid_certificate_tac [8]) --{*PReqS*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   612
apply (simp_all
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   613
         del: image_insert image_Un imp_disjL
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   614
         add: analz_image_keys_simps disj_simps
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   615
              symKey_compromise pushes sign_def Nonce_compromise
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   616
              analz_Key_image_insert_eq notin_image_iff
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   617
              analz_insert_simps analz_image_priEK)
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   618
  --{*2.5 seconds on a 1.6GHz machine*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   619
apply spy_analz
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   620
apply (blast dest!: Gets_imp_knows_Spy [THEN analz.Inj])
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   621
apply (blast dest: Says_imp_knows_Spy [THEN analz.Inj] 
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   622
                   Gets_imp_knows_Spy [THEN analz.Inj])
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   623
apply (blast dest: Gets_imp_knows_Spy [THEN analz.Inj]) --{*PReqS*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   624
apply (blast dest: Says_imp_knows_Spy [THEN analz.Inj] 
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   625
                   Gets_imp_knows_Spy [THEN analz.Inj]) --{*PRes*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   626
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   627
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   628
text{*This theorem is a bit silly, in that many CardSecrets are 0!
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   629
  But then we don't care.  NOT USED*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   630
lemma CardSecret_notin_spies:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   631
     "evs \<in> set_pur ==> Nonce (CardSecret i) \<notin> parts (knows Spy evs)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   632
by (erule set_pur.induct, auto)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   633
15214
d3ab9b76ccb7 tidying up; identifying the main theorems
paulson
parents: 15205
diff changeset
   634
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   635
subsection{*Confidentiality of PAN*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   636
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   637
lemma analz_image_pan_lemma:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   638
     "(Pan P \<in> analz (Key`nE Un H)) --> (Pan P \<in> analz H)  ==>
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   639
      (Pan P \<in> analz (Key`nE Un H)) =   (Pan P \<in> analz H)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   640
by (blast intro: analz_mono [THEN [2] rev_subsetD])
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   641
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   642
text{*The @{text "(no_asm)"} attribute is essential, since it retains
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   643
  the quantifier and allows the simprule's condition to itself be simplified.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   644
lemma analz_image_pan [rule_format (no_asm)]:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   645
     "evs \<in> set_pur ==>
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   646
       \<forall>KK. (\<forall>K \<in> KK. K \<notin> range(\<lambda>C. priEK C)) -->
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   647
            (Pan P \<in> analz (Key`KK Un (knows Spy evs))) =
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   648
            (Pan P \<in> analz (knows Spy evs))"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   649
apply (erule set_pur.induct)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   650
apply (rule_tac [!] allI impI)+
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   651
apply (rule_tac [!] analz_image_pan_lemma)+
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   652
apply (frule_tac [9] AuthReq_msg_in_analz_spies) --{*AReq*}
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   653
apply (valid_certificate_tac [8]) --{*PReqS*}
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   654
apply (valid_certificate_tac [7]) --{*PReqUns*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   655
apply (simp_all
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   656
         del: image_insert image_Un imp_disjL
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   657
         add: analz_image_keys_simps
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   658
              symKey_compromise pushes sign_def
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   659
              analz_Key_image_insert_eq notin_image_iff
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   660
              analz_insert_simps analz_image_priEK)
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   661
  --{*7 seconds on a 1.6GHz machine*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   662
apply spy_analz --{*Fake*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   663
apply auto
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   664
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   665
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   666
lemma analz_insert_pan:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   667
     "[| evs \<in> set_pur;  K \<notin> range(\<lambda>C. priEK C) |] ==>
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   668
          (Pan P \<in> analz (insert (Key K) (knows Spy evs))) =
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   669
          (Pan P \<in> analz (knows Spy evs))"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   670
by (simp del: image_insert image_Un
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   671
         add: analz_image_keys_simps analz_image_pan)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   672
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   673
text{*Confidentiality of the PAN, unsigned case.*}
15214
d3ab9b76ccb7 tidying up; identifying the main theorems
paulson
parents: 15205
diff changeset
   674
theorem pan_confidentiality_unsigned:
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   675
     "[| Pan (pan C) \<in> analz(knows Spy evs);  C = Cardholder k;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   676
         CardSecret k = 0;  evs \<in> set_pur|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   677
    ==> \<exists>P M KC1 K X Y.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   678
     Says C M {|EXHcrypt KC1 (pubEK P) X (Pan (pan C)), Y|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   679
          \<in> set evs  &
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   680
     P \<in> bad"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   681
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   682
apply (erule set_pur.induct)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   683
apply (frule_tac [9] AuthReq_msg_in_analz_spies) --{*AReq*}
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   684
apply (valid_certificate_tac [8]) --{*PReqS*}
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   685
apply (valid_certificate_tac [7]) --{*PReqUns*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   686
apply (simp_all
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   687
         del: image_insert image_Un imp_disjL
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   688
         add: analz_image_keys_simps analz_insert_pan analz_image_pan
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   689
              notin_image_iff
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   690
              analz_insert_simps analz_image_priEK)
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   691
  --{*3 seconds on a 1.6GHz machine*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   692
apply spy_analz --{*Fake*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   693
apply blast --{*PReqUns: unsigned*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   694
apply force --{*PReqS: signed*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   695
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   696
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   697
text{*Confidentiality of the PAN, signed case.*}
15214
d3ab9b76ccb7 tidying up; identifying the main theorems
paulson
parents: 15205
diff changeset
   698
theorem pan_confidentiality_signed:
d3ab9b76ccb7 tidying up; identifying the main theorems
paulson
parents: 15205
diff changeset
   699
 "[|Pan (pan C) \<in> analz(knows Spy evs);  C = Cardholder k;
d3ab9b76ccb7 tidying up; identifying the main theorems
paulson
parents: 15205
diff changeset
   700
    CardSecret k \<noteq> 0;  evs \<in> set_pur|]
d3ab9b76ccb7 tidying up; identifying the main theorems
paulson
parents: 15205
diff changeset
   701
  ==> \<exists>P M KC2 PIDualSign_1 PIDualSign_2 other OIDualSign.
d3ab9b76ccb7 tidying up; identifying the main theorems
paulson
parents: 15205
diff changeset
   702
      Says C M {|{|PIDualSign_1, 
d3ab9b76ccb7 tidying up; identifying the main theorems
paulson
parents: 15205
diff changeset
   703
                   EXcrypt KC2 (pubEK P) PIDualSign_2 {|Pan (pan C), other|}|}, 
d3ab9b76ccb7 tidying up; identifying the main theorems
paulson
parents: 15205
diff changeset
   704
       OIDualSign|} \<in> set evs  &  P \<in> bad"
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   705
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   706
apply (erule set_pur.induct)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   707
apply (frule_tac [9] AuthReq_msg_in_analz_spies) --{*AReq*}
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   708
apply (valid_certificate_tac [8]) --{*PReqS*}
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   709
apply (valid_certificate_tac [7]) --{*PReqUns*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   710
apply (simp_all
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   711
         del: image_insert image_Un imp_disjL
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   712
         add: analz_image_keys_simps analz_insert_pan analz_image_pan
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   713
              notin_image_iff
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   714
              analz_insert_simps analz_image_priEK)
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   715
  --{*3 seconds on a 1.6GHz machine*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   716
apply spy_analz --{*Fake*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   717
apply force --{*PReqUns: unsigned*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   718
apply blast --{*PReqS: signed*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   719
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   720
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   721
text{*General goal: that C, M and PG agree on those details of the transaction
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   722
     that they are allowed to know about.  PG knows about price and account
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   723
     details.  M knows about the order description and price.  C knows both.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   724
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   725
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   726
subsection{*Proofs Common to Signed and Unsigned Versions*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   727
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   728
lemma M_Notes_PG:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   729
     "[|Notes M {|Number LID_M, Agent P, Agent M, Agent C, etc|} \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   730
        evs \<in> set_pur|] ==> \<exists>j. P = PG j"
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15214
diff changeset
   731
by (erule rev_mp, erule set_pur.induct, simp_all)
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   732
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   733
text{*If we trust M, then @{term LID_M} determines his choice of P
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   734
      (Payment Gateway)*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   735
lemma goodM_gives_correct_PG:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   736
     "[| MsgPInitRes = 
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   737
            {|Number LID_M, xid, cc, cm, cert P EKj onlyEnc (priSK RCA)|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   738
         Crypt (priSK M) (Hash MsgPInitRes) \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   739
         evs \<in> set_pur; M \<notin> bad |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   740
      ==> \<exists>j trans.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   741
            P = PG j &
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   742
            Notes M {|Number LID_M, Agent P, trans|} \<in> set evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   743
apply clarify
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   744
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   745
apply (erule set_pur.induct)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   746
apply (frule_tac [9] AuthReq_msg_in_parts_spies) --{*AuthReq*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   747
apply simp_all
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   748
apply (blast intro: M_Notes_PG)+
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   749
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   750
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   751
lemma C_gets_correct_PG:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   752
     "[| Gets A (sign (priSK M) {|Number LID_M, xid, cc, cm,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   753
                              cert P EKj onlyEnc (priSK RCA)|}) \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   754
         evs \<in> set_pur;  M \<notin> bad|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   755
      ==> \<exists>j trans.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   756
            P = PG j &
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   757
            Notes M {|Number LID_M, Agent P, trans|} \<in> set evs &
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   758
            EKj = pubEK P"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   759
by (rule refl [THEN goodM_gives_correct_PG, THEN exE], auto)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   760
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   761
text{*When C receives PInitRes, he learns M's choice of P*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   762
lemma C_verifies_PInitRes:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   763
 "[| MsgPInitRes = {|Number LID_M, Number XID, Nonce Chall_C, Nonce Chall_M,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   764
	   cert P EKj onlyEnc (priSK RCA)|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   765
     Crypt (priSK M) (Hash MsgPInitRes) \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   766
     evs \<in> set_pur;  M \<notin> bad|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   767
  ==> \<exists>j trans.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   768
         Notes M {|Number LID_M, Agent P, trans|} \<in> set evs &
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   769
         P = PG j &
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   770
         EKj = pubEK P"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   771
apply clarify
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   772
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   773
apply (erule set_pur.induct)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   774
apply (frule_tac [9] AuthReq_msg_in_parts_spies) --{*AuthReq*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   775
apply simp_all
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   776
apply (blast intro: M_Notes_PG)+
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   777
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   778
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   779
text{*Corollary of previous one*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   780
lemma Says_C_PInitRes:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   781
     "[|Says A C (sign (priSK M)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   782
                      {|Number LID_M, Number XID,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   783
                        Nonce Chall_C, Nonce Chall_M,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   784
                        cert P EKj onlyEnc (priSK RCA)|})
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   785
           \<in> set evs;  M \<notin> bad;  evs \<in> set_pur|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   786
      ==> \<exists>j trans.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   787
           Notes M {|Number LID_M, Agent P, trans|} \<in> set evs &
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   788
           P = PG j &
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   789
           EKj = pubEK (PG j)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   790
apply (frule Says_certificate_valid)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   791
apply (auto simp add: sign_def)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   792
apply (blast dest: refl [THEN goodM_gives_correct_PG])
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   793
apply (blast dest: refl [THEN C_verifies_PInitRes])
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   794
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   795
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   796
text{*When P receives an AuthReq, he knows that the signed part originated 
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   797
      with M. PIRes also has a signed message from M....*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   798
lemma P_verifies_AuthReq:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   799
     "[| AuthReqData = {|Number LID_M, Number XID, HOIData, HOD|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   800
         Crypt (priSK M) (Hash {|AuthReqData, Hash P_I|})
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   801
           \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   802
         evs \<in> set_pur;  M \<notin> bad|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   803
      ==> \<exists>j trans KM OIData HPIData.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   804
            Notes M {|Number LID_M, Agent (PG j), trans|} \<in> set evs &
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   805
            Gets M {|P_I, OIData, HPIData|} \<in> set evs &
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   806
            Says M (PG j) (EncB (priSK M) KM (pubEK (PG j)) AuthReqData P_I)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   807
              \<in> set evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   808
apply clarify
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   809
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   810
apply (erule set_pur.induct, simp_all)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   811
apply (frule_tac [4] M_Notes_PG, auto)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   812
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   813
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   814
text{*When M receives AuthRes, he knows that P signed it, including
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15214
diff changeset
   815
  the identifying tags and the purchase amount, which he can verify.
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   816
  (Although the spec has SIGNED and UNSIGNED forms of AuthRes, they
16474
c3c0208988c0 fixed a faulty proof
paulson
parents: 16417
diff changeset
   817
   send the same message to M.)  The conclusion is weak: M is existentially
c3c0208988c0 fixed a faulty proof
paulson
parents: 16417
diff changeset
   818
  quantified! That is because Authorization Response does not refer to M, while
c3c0208988c0 fixed a faulty proof
paulson
parents: 16417
diff changeset
   819
  the digital envelope weakens the link between @{term MsgAuthRes} and
c3c0208988c0 fixed a faulty proof
paulson
parents: 16417
diff changeset
   820
  @{term"priSK M"}.  Changing the precondition to refer to 
c3c0208988c0 fixed a faulty proof
paulson
parents: 16417
diff changeset
   821
  @{term "Crypt K (sign SK M)"} requires assuming @{term K} to be secure, since
c3c0208988c0 fixed a faulty proof
paulson
parents: 16417
diff changeset
   822
  otherwise the Spy could create that message.*}
15214
d3ab9b76ccb7 tidying up; identifying the main theorems
paulson
parents: 15205
diff changeset
   823
theorem M_verifies_AuthRes:
16474
c3c0208988c0 fixed a faulty proof
paulson
parents: 16417
diff changeset
   824
  "[| MsgAuthRes = {|{|Number LID_M, Number XID, Number PurchAmt|}, 
c3c0208988c0 fixed a faulty proof
paulson
parents: 16417
diff changeset
   825
                     Hash authCode|};
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   826
      Crypt (priSK (PG j)) (Hash MsgAuthRes) \<in> parts (knows Spy evs);
16474
c3c0208988c0 fixed a faulty proof
paulson
parents: 16417
diff changeset
   827
      PG j \<notin> bad;  evs \<in> set_pur|]
c3c0208988c0 fixed a faulty proof
paulson
parents: 16417
diff changeset
   828
   ==> \<exists>M KM KP HOIData HOD P_I.
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   829
	Gets (PG j)
16474
c3c0208988c0 fixed a faulty proof
paulson
parents: 16417
diff changeset
   830
	   (EncB (priSK M) KM (pubEK (PG j))
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   831
		    {|Number LID_M, Number XID, HOIData, HOD|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   832
		    P_I) \<in> set evs &
16474
c3c0208988c0 fixed a faulty proof
paulson
parents: 16417
diff changeset
   833
	Says (PG j) M
c3c0208988c0 fixed a faulty proof
paulson
parents: 16417
diff changeset
   834
	     (EncB (priSK (PG j)) KP (pubEK M)
c3c0208988c0 fixed a faulty proof
paulson
parents: 16417
diff changeset
   835
	      {|Number LID_M, Number XID, Number PurchAmt|}
c3c0208988c0 fixed a faulty proof
paulson
parents: 16417
diff changeset
   836
	      authCode) \<in> set evs"
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   837
apply clarify
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   838
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   839
apply (erule set_pur.induct)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   840
apply (frule_tac [9] AuthReq_msg_in_parts_spies) --{*AuthReq*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   841
apply simp_all
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   842
apply blast+
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   843
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   844
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   845
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   846
subsection{*Proofs for Unsigned Purchases*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   847
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   848
text{*What we can derive from the ASSUMPTION that C issued a purchase request.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   849
   In the unsigned case, we must trust "C": there's no authentication.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   850
lemma C_determines_EKj:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   851
     "[| Says C M {|EXHcrypt KC1 EKj {|PIHead, Hash OIData|} (Pan (pan C)),
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   852
                    OIData, Hash{|PIHead, Pan (pan C)|} |} \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   853
         PIHead = {|Number LID_M, Trans_details|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   854
         evs \<in> set_pur;  C = Cardholder k;  M \<notin> bad|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   855
  ==> \<exists>trans j.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   856
               Notes M {|Number LID_M, Agent (PG j), trans |} \<in> set evs &
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   857
               EKj = pubEK (PG j)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   858
apply clarify
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   859
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   860
apply (erule set_pur.induct, simp_all)
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   861
apply (valid_certificate_tac [2]) --{*PReqUns*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   862
apply auto
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   863
apply (blast dest: Gets_imp_Says Says_C_PInitRes)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   864
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   865
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   866
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   867
text{*Unicity of @{term LID_M} between Merchant and Cardholder notes*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   868
lemma unique_LID_M:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   869
     "[|Notes (Merchant i) {|Number LID_M, Agent P, Trans|} \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   870
        Notes C {|Number LID_M, Agent M, Agent C, Number OD,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   871
             Number PA|} \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   872
        evs \<in> set_pur|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   873
      ==> M = Merchant i & Trans = {|Agent M, Agent C, Number OD, Number PA|}"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   874
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   875
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   876
apply (erule set_pur.induct, simp_all)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   877
apply (force dest!: Notes_imp_parts_subset_used)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   878
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   879
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   880
text{*Unicity of @{term LID_M}, for two Merchant Notes events*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   881
lemma unique_LID_M2:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   882
     "[|Notes M {|Number LID_M, Trans|} \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   883
        Notes M {|Number LID_M, Trans'|} \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   884
        evs \<in> set_pur|] ==> Trans' = Trans"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   885
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   886
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   887
apply (erule set_pur.induct, simp_all)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   888
apply (force dest!: Notes_imp_parts_subset_used)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   889
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   890
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   891
text{*Lemma needed below: for the case that
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   892
  if PRes is present, then @{term LID_M} has been used.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   893
lemma signed_imp_used:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   894
     "[| Crypt (priSK M) (Hash X) \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   895
         M \<notin> bad;  evs \<in> set_pur|] ==> parts {X} \<subseteq> used evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   896
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   897
apply (erule set_pur.induct)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   898
apply (frule_tac [9] AuthReq_msg_in_parts_spies) --{*AuthReq*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   899
apply simp_all
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   900
apply safe
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   901
apply blast+
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   902
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   903
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   904
text{*Similar, with nested Hash*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   905
lemma signed_Hash_imp_used:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   906
     "[| Crypt (priSK C) (Hash {|H, Hash X|}) \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   907
         C \<notin> bad;  evs \<in> set_pur|] ==> parts {X} \<subseteq> used evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   908
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   909
apply (erule set_pur.induct)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   910
apply (frule_tac [9] AuthReq_msg_in_parts_spies) --{*AuthReq*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   911
apply simp_all
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   912
apply safe
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   913
apply blast+
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   914
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   915
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   916
text{*Lemma needed below: for the case that
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   917
  if PRes is present, then @{text LID_M} has been used.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   918
lemma PRes_imp_LID_used:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   919
     "[| Crypt (priSK M) (Hash {|N, X|}) \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   920
         M \<notin> bad;  evs \<in> set_pur|] ==> N \<in> used evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   921
by (drule signed_imp_used, auto)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   922
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   923
text{*When C receives PRes, he knows that M and P agreed to the purchase details.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   924
  He also knows that P is the same PG as before*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   925
lemma C_verifies_PRes_lemma:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   926
     "[| Crypt (priSK M) (Hash MsgPRes) \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   927
         Notes C {|Number LID_M, Trans |} \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   928
         Trans = {| Agent M, Agent C, Number OrderDesc, Number PurchAmt |};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   929
         MsgPRes = {|Number LID_M, Number XID, Nonce Chall_C,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   930
                Hash (Number PurchAmt)|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   931
         evs \<in> set_pur;  M \<notin> bad|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   932
  ==> \<exists>j KP.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   933
        Notes M {|Number LID_M, Agent (PG j), Trans |}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   934
          \<in> set evs &
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   935
        Gets M (EncB (priSK (PG j)) KP (pubEK M)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   936
                {|Number LID_M, Number XID, Number PurchAmt|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   937
                authCode)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   938
          \<in> set evs &
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   939
        Says M C (sign (priSK M) MsgPRes) \<in> set evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   940
apply clarify
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   941
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   942
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   943
apply (erule set_pur.induct)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   944
apply (frule_tac [9] AuthReq_msg_in_parts_spies) --{*AuthReq*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   945
apply simp_all
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   946
apply blast
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   947
apply blast
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   948
apply (blast dest: PRes_imp_LID_used)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   949
apply (frule M_Notes_PG, auto)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   950
apply (blast dest: unique_LID_M)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   951
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   952
15214
d3ab9b76ccb7 tidying up; identifying the main theorems
paulson
parents: 15205
diff changeset
   953
text{*When the Cardholder receives Purchase Response from an uncompromised
d3ab9b76ccb7 tidying up; identifying the main theorems
paulson
parents: 15205
diff changeset
   954
Merchant, he knows that M sent it. He also knows that M received a message signed
d3ab9b76ccb7 tidying up; identifying the main theorems
paulson
parents: 15205
diff changeset
   955
by a Payment Gateway chosen by M to authorize the purchase.*}
d3ab9b76ccb7 tidying up; identifying the main theorems
paulson
parents: 15205
diff changeset
   956
theorem C_verifies_PRes:
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   957
     "[| MsgPRes = {|Number LID_M, Number XID, Nonce Chall_C,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   958
                     Hash (Number PurchAmt)|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   959
         Gets C (sign (priSK M) MsgPRes) \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   960
         Notes C {|Number LID_M, Agent M, Agent C, Number OrderDesc,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   961
                   Number PurchAmt|} \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   962
         evs \<in> set_pur;  M \<notin> bad|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   963
  ==> \<exists>P KP trans.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   964
        Notes M {|Number LID_M,Agent P, trans|} \<in> set evs &
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   965
        Gets M (EncB (priSK P) KP (pubEK M)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   966
                {|Number LID_M, Number XID, Number PurchAmt|}
15214
d3ab9b76ccb7 tidying up; identifying the main theorems
paulson
parents: 15205
diff changeset
   967
                authCode)  \<in>  set evs &
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   968
        Says M C (sign (priSK M) MsgPRes) \<in> set evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   969
apply (rule C_verifies_PRes_lemma [THEN exE])
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   970
apply (auto simp add: sign_def)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   971
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   972
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   973
subsection{*Proofs for Signed Purchases*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   974
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   975
text{*Some Useful Lemmas: the cardholder knows what he is doing*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   976
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   977
lemma Crypt_imp_Says_Cardholder:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   978
     "[| Crypt K {|{|{|Number LID_M, others|}, Hash OIData|}, Hash PANData|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   979
           \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   980
         PANData = {|Pan (pan (Cardholder k)), Nonce (PANSecret k)|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   981
         Key K \<notin> analz (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   982
         evs \<in> set_pur|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   983
  ==> \<exists>M shash EK HPIData.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   984
       Says (Cardholder k) M {|{|shash,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   985
          Crypt K
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   986
            {|{|{|Number LID_M, others|}, Hash OIData|}, Hash PANData|},
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   987
           Crypt EK {|Key K, PANData|}|},
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   988
          OIData, HPIData|} \<in> set evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   989
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   990
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   991
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   992
apply (erule set_pur.induct, analz_mono_contra)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   993
apply (frule_tac [9] AuthReq_msg_in_parts_spies) --{*AuthReq*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   994
apply simp_all
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   995
apply auto
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   996
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   997
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   998
lemma Says_PReqS_imp_trans_details_C:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   999
     "[| MsgPReqS = {|{|shash,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1000
                 Crypt K
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1001
                  {|{|{|Number LID_M, PIrest|}, Hash OIData|}, hashpd|},
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1002
            cryptek|}, data|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1003
         Says (Cardholder k) M MsgPReqS \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1004
         evs \<in> set_pur |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1005
   ==> \<exists>trans.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1006
           Notes (Cardholder k) 
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1007
                 {|Number LID_M, Agent M, Agent (Cardholder k), trans|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1008
            \<in> set evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1009
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1010
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1011
apply (erule set_pur.induct)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1012
apply (simp_all (no_asm_simp))
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1013
apply auto
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1014
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1015
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1016
text{*Can't happen: only Merchants create this type of Note*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1017
lemma Notes_Cardholder_self_False:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1018
     "[|Notes (Cardholder k)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1019
          {|Number n, Agent P, Agent (Cardholder k), Agent C, etc|} \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1020
        evs \<in> set_pur|] ==> False"
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15214
diff changeset
  1021
by (erule rev_mp, erule set_pur.induct, auto)
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1022
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1023
text{*When M sees a dual signature, he knows that it originated with C.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1024
  Using XID he knows it was intended for him.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1025
  This guarantee isn't useful to P, who never gets OIData.*}
15214
d3ab9b76ccb7 tidying up; identifying the main theorems
paulson
parents: 15205
diff changeset
  1026
theorem M_verifies_Signed_PReq:
d3ab9b76ccb7 tidying up; identifying the main theorems
paulson
parents: 15205
diff changeset
  1027
 "[| MsgDualSign = {|HPIData, Hash OIData|};
d3ab9b76ccb7 tidying up; identifying the main theorems
paulson
parents: 15205
diff changeset
  1028
     OIData = {|Number LID_M, etc|};
d3ab9b76ccb7 tidying up; identifying the main theorems
paulson
parents: 15205
diff changeset
  1029
     Crypt (priSK C) (Hash MsgDualSign) \<in> parts (knows Spy evs);
d3ab9b76ccb7 tidying up; identifying the main theorems
paulson
parents: 15205
diff changeset
  1030
     Notes M {|Number LID_M, Agent P, extras|} \<in> set evs;
d3ab9b76ccb7 tidying up; identifying the main theorems
paulson
parents: 15205
diff changeset
  1031
     M = Merchant i;  C = Cardholder k;  C \<notin> bad;  evs \<in> set_pur|]
d3ab9b76ccb7 tidying up; identifying the main theorems
paulson
parents: 15205
diff changeset
  1032
  ==> \<exists>PIData PICrypt.
d3ab9b76ccb7 tidying up; identifying the main theorems
paulson
parents: 15205
diff changeset
  1033
	HPIData = Hash PIData &
d3ab9b76ccb7 tidying up; identifying the main theorems
paulson
parents: 15205
diff changeset
  1034
	Says C M {|{|sign (priSK C) MsgDualSign, PICrypt|}, OIData, Hash PIData|}
d3ab9b76ccb7 tidying up; identifying the main theorems
paulson
parents: 15205
diff changeset
  1035
	  \<in> set evs"
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1036
apply clarify
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1037
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1038
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1039
apply (erule set_pur.induct)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1040
apply (frule_tac [9] AuthReq_msg_in_parts_spies) --{*AuthReq*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1041
apply simp_all
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1042
apply blast
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1043
apply (force dest!: signed_Hash_imp_used)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1044
apply (clarify) --{*speeds next step*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1045
apply (blast dest: unique_LID_M)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1046
apply (blast dest!: Notes_Cardholder_self_False)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1047
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1048
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1049
text{*When P sees a dual signature, he knows that it originated with C.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1050
  and was intended for M. This guarantee isn't useful to M, who never gets
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1051
  PIData. I don't see how to link @{term "PG j"} and @{text LID_M} without
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1052
  assuming @{term "M \<notin> bad"}.*}
15214
d3ab9b76ccb7 tidying up; identifying the main theorems
paulson
parents: 15205
diff changeset
  1053
theorem P_verifies_Signed_PReq:
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1054
     "[| MsgDualSign = {|Hash PIData, HOIData|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1055
         PIData = {|PIHead, PANData|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1056
         PIHead = {|Number LID_M, Number XID, HOD, Number PurchAmt, Agent M,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1057
                    TransStain|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1058
         Crypt (priSK C) (Hash MsgDualSign) \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1059
         evs \<in> set_pur;  C \<notin> bad;  M \<notin> bad|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1060
    ==> \<exists>OIData OrderDesc K j trans.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1061
          HOD = Hash{|Number OrderDesc, Number PurchAmt|} &
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1062
          HOIData = Hash OIData &
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1063
          Notes M {|Number LID_M, Agent (PG j), trans|} \<in> set evs &
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1064
          Says C M {|{|sign (priSK C) MsgDualSign,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1065
                     EXcrypt K (pubEK (PG j))
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1066
                                {|PIHead, Hash OIData|} PANData|},
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1067
                     OIData, Hash PIData|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1068
            \<in> set evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1069
apply clarify
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1070
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1071
apply (erule set_pur.induct, simp_all)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1072
apply (auto dest!: C_gets_correct_PG)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1073
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1074
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1075
lemma C_determines_EKj_signed:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1076
     "[| Says C M {|{|sign (priSK C) text,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1077
                      EXcrypt K EKj {|PIHead, X|} Y|}, Z|} \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1078
         PIHead = {|Number LID_M, Number XID, W|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1079
         C = Cardholder k;  evs \<in> set_pur;  M \<notin> bad|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1080
  ==> \<exists> trans j.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1081
         Notes M {|Number LID_M, Agent (PG j), trans|} \<in> set evs &
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1082
         EKj = pubEK (PG j)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1083
apply clarify
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1084
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1085
apply (erule set_pur.induct, simp_all, auto)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1086
apply (blast dest: C_gets_correct_PG)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1087
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1088
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1089
lemma M_Says_AuthReq:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1090
     "[| AuthReqData = {|Number LID_M, Number XID, HOIData, HOD|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1091
         sign (priSK M) {|AuthReqData, Hash P_I|} \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1092
         evs \<in> set_pur;  M \<notin> bad|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1093
   ==> \<exists>j trans KM.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1094
           Notes M {|Number LID_M, Agent (PG j), trans |} \<in> set evs &
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1095
             Says M (PG j)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1096
               (EncB (priSK M) KM (pubEK (PG j)) AuthReqData P_I)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1097
              \<in> set evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1098
apply (rule refl [THEN P_verifies_AuthReq, THEN exE])
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1099
apply (auto simp add: sign_def)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1100
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1101
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1102
text{*A variant of @{text M_verifies_Signed_PReq} with explicit PI information.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1103
  Even here we cannot be certain about what C sent to M, since a bad
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1104
  PG could have replaced the two key fields.  (NOT USED)*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1105
lemma Signed_PReq_imp_Says_Cardholder:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1106
     "[| MsgDualSign = {|Hash PIData, Hash OIData|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1107
         OIData = {|Number LID_M, Number XID, Nonce Chall_C, HOD, etc|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1108
         PIHead = {|Number LID_M, Number XID, HOD, Number PurchAmt, Agent M,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1109
                    TransStain|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1110
         PIData = {|PIHead, PANData|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1111
         Crypt (priSK C) (Hash MsgDualSign) \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1112
         M = Merchant i;  C = Cardholder k;  C \<notin> bad;  evs \<in> set_pur|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1113
      ==> \<exists>KC EKj.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1114
            Says C M {|{|sign (priSK C) MsgDualSign,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1115
                       EXcrypt KC EKj {|PIHead, Hash OIData|} PANData|},
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1116
                       OIData, Hash PIData|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1117
              \<in> set evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1118
apply clarify
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1119
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1120
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1121
apply (erule set_pur.induct, simp_all, auto)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1122
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1123
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1124
text{*When P receives an AuthReq and a dual signature, he knows that C and M
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1125
  agree on the essential details.  PurchAmt however is never sent by M to
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1126
  P; instead C and M both send 
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1127
     @{term "HOD = Hash{|Number OrderDesc, Number PurchAmt|}"}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1128
  and P compares the two copies of HOD.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1129
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1130
  Agreement can't be proved for some things, including the symmetric keys
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1131
  used in the digital envelopes.  On the other hand, M knows the true identity
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1132
  of PG (namely j'), and sends AReq there; he can't, however, check that
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1133
  the EXcrypt involves the correct PG's key.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1134
*}
15214
d3ab9b76ccb7 tidying up; identifying the main theorems
paulson
parents: 15205
diff changeset
  1135
theorem P_sees_CM_agreement:
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1136
     "[| AuthReqData = {|Number LID_M, Number XID, HOIData, HOD|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1137
         KC \<in> symKeys;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1138
         Gets (PG j) (EncB (priSK M) KM (pubEK (PG j)) AuthReqData P_I)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1139
           \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1140
         C = Cardholder k;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1141
         PI_sign = sign (priSK C) {|Hash PIData, HOIData|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1142
         P_I = {|PI_sign,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1143
                 EXcrypt KC (pubEK (PG j)) {|PIHead, HOIData|} PANData|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1144
         PANData = {|Pan (pan C), Nonce (PANSecret k)|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1145
         PIData = {|PIHead, PANData|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1146
         PIHead = {|Number LID_M, Number XID, HOD, Number PurchAmt, Agent M,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1147
                    TransStain|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1148
         evs \<in> set_pur;  C \<notin> bad;  M \<notin> bad|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1149
  ==> \<exists>OIData OrderDesc KM' trans j' KC' KC'' P_I' P_I''.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1150
           HOD = Hash{|Number OrderDesc, Number PurchAmt|} &
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1151
           HOIData = Hash OIData &
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1152
           Notes M {|Number LID_M, Agent (PG j'), trans|} \<in> set evs &
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1153
           Says C M {|P_I', OIData, Hash PIData|} \<in> set evs &
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1154
           Says M (PG j') (EncB (priSK M) KM' (pubEK (PG j'))
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1155
                           AuthReqData P_I'')  \<in>  set evs &
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1156
           P_I' = {|PI_sign,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1157
             EXcrypt KC' (pubEK (PG j')) {|PIHead, Hash OIData|} PANData|} &
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1158
           P_I'' = {|PI_sign,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1159
             EXcrypt KC'' (pubEK (PG j)) {|PIHead, Hash OIData|} PANData|}"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1160
apply clarify
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1161
apply (rule exE)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1162
apply (rule P_verifies_Signed_PReq [OF refl refl refl])
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1163
apply (simp (no_asm_use) add: sign_def EncB_def, blast)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1164
apply (assumption+, clarify, simp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1165
apply (drule Gets_imp_knows_Spy [THEN parts.Inj], assumption)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1166
apply (blast elim: EncB_partsE dest: refl [THEN M_Says_AuthReq] unique_LID_M2)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1167
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1168
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1169
end