src/HOL/SET_Protocol/Cardholder_Registration.thy
author wenzelm
Tue, 20 Oct 2009 20:03:23 +0200
changeset 33028 9aa8bfb1649d
parent 32960 src/HOL/SET-Protocol/Cardholder_Registration.thy@69916a850301
child 39758 b8a53e3a0ee2
permissions -rw-r--r--
modernized session SET_Protocol;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33028
9aa8bfb1649d modernized session SET_Protocol;
wenzelm
parents: 32960
diff changeset
     1
(*  Title:      HOL/SET_Protocol/Cardholder_Registration.thy
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
     2
    Author:     Giampaolo Bella
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
     3
    Author:     Fabio Massacci
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
     4
    Author:     Lawrence C Paulson
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
     5
    Author:     Piero Tramontano
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
     6
*)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
     7
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
     8
header{*The SET Cardholder Registration Protocol*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
     9
33028
9aa8bfb1649d modernized session SET_Protocol;
wenzelm
parents: 32960
diff changeset
    10
theory Cardholder_Registration
9aa8bfb1649d modernized session SET_Protocol;
wenzelm
parents: 32960
diff changeset
    11
imports Public_SET
9aa8bfb1649d modernized session SET_Protocol;
wenzelm
parents: 32960
diff changeset
    12
begin
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    13
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    14
text{*Note: nonces seem to consist of 20 bytes.  That includes both freshness
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    15
challenges (Chall-EE, etc.) and important secrets (CardSecret, PANsecret)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    16
*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    17
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    18
text{*Simplifications involving @{text analz_image_keys_simps} appear to
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    19
have become much slower. The cause is unclear. However, there is a big blow-up
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    20
and the rewriting is very sensitive to the set of rewrite rules given.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    21
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    22
subsection{*Predicate Formalizing the Encryption Association between Keys *}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    23
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    24
consts
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    25
  KeyCryptKey :: "[key, key, event list] => bool"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    26
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    27
primrec
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    28
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    29
KeyCryptKey_Nil:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    30
  "KeyCryptKey DK K [] = False"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    31
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    32
KeyCryptKey_Cons:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    33
      --{*Says is the only important case.
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
    34
        1st case: CR5, where KC3 encrypts KC2.
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
    35
        2nd case: any use of priEK C.
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
    36
        Revision 1.12 has a more complicated version with separate treatment of
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
    37
          the dependency of KC1, KC2 and KC3 on priEK (CA i.)  Not needed since
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
    38
          priEK C is never sent (and so can't be lost except at the start). *}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    39
  "KeyCryptKey DK K (ev # evs) =
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    40
   (KeyCryptKey DK K evs |
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    41
    (case ev of
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    42
      Says A B Z =>
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    43
       ((\<exists>N X Y. A \<noteq> Spy &
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
    44
                 DK \<in> symKeys &
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
    45
                 Z = {|Crypt DK {|Agent A, Nonce N, Key K, X|}, Y|}) |
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
    46
        (\<exists>C. DK = priEK C))
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    47
    | Gets A' X => False
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    48
    | Notes A' X => False))"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    49
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    50
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    51
subsection{*Predicate formalizing the association between keys and nonces *}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    52
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    53
consts
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    54
  KeyCryptNonce :: "[key, key, event list] => bool"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    55
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    56
primrec
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    57
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    58
KeyCryptNonce_Nil:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    59
  "KeyCryptNonce EK K [] = False"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    60
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    61
KeyCryptNonce_Cons:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    62
  --{*Says is the only important case.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    63
    1st case: CR3, where KC1 encrypts NC2 (distinct from CR5 due to EXH);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    64
    2nd case: CR5, where KC3 encrypts NC3;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    65
    3rd case: CR6, where KC2 encrypts NC3;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    66
    4th case: CR6, where KC2 encrypts NonceCCA;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    67
    5th case: any use of @{term "priEK C"} (including CardSecret).
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    68
    NB the only Nonces we need to keep secret are CardSecret and NonceCCA.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    69
    But we can't prove @{text Nonce_compromise} unless the relation covers ALL
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
    70
        nonces that the protocol keeps secret.
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    71
  *}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    72
  "KeyCryptNonce DK N (ev # evs) =
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    73
   (KeyCryptNonce DK N evs |
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    74
    (case ev of
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    75
      Says A B Z =>
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    76
       A \<noteq> Spy &
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    77
       ((\<exists>X Y. DK \<in> symKeys &
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
    78
               Z = (EXHcrypt DK X {|Agent A, Nonce N|} Y)) |
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
    79
        (\<exists>X Y. DK \<in> symKeys &
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
    80
               Z = {|Crypt DK {|Agent A, Nonce N, X|}, Y|}) |
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
    81
        (\<exists>K i X Y.
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
    82
          K \<in> symKeys &
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    83
          Z = Crypt K {|sign (priSK (CA i)) {|Agent B, Nonce N, X|}, Y|} &
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
    84
          (DK=K | KeyCryptKey DK K evs)) |
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
    85
        (\<exists>K C NC3 Y.
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
    86
          K \<in> symKeys &
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    87
          Z = Crypt K
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
    88
                {|sign (priSK C) {|Agent B, Nonce NC3, Agent C, Nonce N|},
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    89
                  Y|} &
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
    90
          (DK=K | KeyCryptKey DK K evs)) |
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
    91
        (\<exists>C. DK = priEK C))
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    92
    | Gets A' X => False
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    93
    | Notes A' X => False))"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    94
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    95
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    96
subsection{*Formal protocol definition *}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
    97
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
    98
inductive_set
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
    99
  set_cr :: "event list set"
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   100
where
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   101
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   102
  Nil:    --{*Initial trace is empty*}
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   103
          "[] \<in> set_cr"
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   104
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   105
| Fake:    --{*The spy MAY say anything he CAN say.*}
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   106
           "[| evsf \<in> set_cr; X \<in> synth (analz (knows Spy evsf)) |]
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   107
            ==> Says Spy B X  # evsf \<in> set_cr"
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   108
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   109
| Reception: --{*If A sends a message X to B, then B might receive it*}
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   110
             "[| evsr \<in> set_cr; Says A B X \<in> set evsr |]
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   111
              ==> Gets B X  # evsr \<in> set_cr"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   112
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   113
| SET_CR1: --{*CardCInitReq: C initiates a run, sending a nonce to CCA*}
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   114
             "[| evs1 \<in> set_cr;  C = Cardholder k;  Nonce NC1 \<notin> used evs1 |]
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   115
              ==> Says C (CA i) {|Agent C, Nonce NC1|} # evs1 \<in> set_cr"
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   116
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   117
| SET_CR2: --{*CardCInitRes: CA responds sending NC1 and its certificates*}
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   118
             "[| evs2 \<in> set_cr;
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   119
                 Gets (CA i) {|Agent C, Nonce NC1|} \<in> set evs2 |]
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   120
              ==> Says (CA i) C
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   121
                       {|sign (priSK (CA i)) {|Agent C, Nonce NC1|},
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   122
                         cert (CA i) (pubEK (CA i)) onlyEnc (priSK RCA),
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   123
                         cert (CA i) (pubSK (CA i)) onlySig (priSK RCA)|}
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   124
                    # evs2 \<in> set_cr"
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   125
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   126
| SET_CR3:
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   127
   --{*RegFormReq: C sends his PAN and a new nonce to CA.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   128
   C verifies that
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   129
    - nonce received is the same as that sent;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   130
    - certificates are signed by RCA;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   131
    - certificates are an encryption certificate (flag is onlyEnc) and a
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   132
      signature certificate (flag is onlySig);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   133
    - certificates pertain to the CA that C contacted (this is done by
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   134
      checking the signature).
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   135
   C generates a fresh symmetric key KC1.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   136
   The point of encrypting @{term "{|Agent C, Nonce NC2, Hash (Pan(pan C))|}"}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   137
   is not clear. *}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   138
"[| evs3 \<in> set_cr;  C = Cardholder k;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   139
    Nonce NC2 \<notin> used evs3;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   140
    Key KC1 \<notin> used evs3; KC1 \<in> symKeys;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   141
    Gets C {|sign (invKey SKi) {|Agent X, Nonce NC1|},
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   142
             cert (CA i) EKi onlyEnc (priSK RCA),
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   143
             cert (CA i) SKi onlySig (priSK RCA)|}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   144
       \<in> set evs3;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   145
    Says C (CA i) {|Agent C, Nonce NC1|} \<in> set evs3|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   146
 ==> Says C (CA i) (EXHcrypt KC1 EKi {|Agent C, Nonce NC2|} (Pan(pan C)))
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   147
       # Notes C {|Key KC1, Agent (CA i)|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   148
       # evs3 \<in> set_cr"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   149
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   150
| SET_CR4:
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   151
    --{*RegFormRes:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   152
    CA responds sending NC2 back with a new nonce NCA, after checking that
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   153
     - the digital envelope is correctly encrypted by @{term "pubEK (CA i)"}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   154
     - the entire message is encrypted with the same key found inside the
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   155
       envelope (here, KC1) *}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   156
"[| evs4 \<in> set_cr;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   157
    Nonce NCA \<notin> used evs4;  KC1 \<in> symKeys;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   158
    Gets (CA i) (EXHcrypt KC1 EKi {|Agent C, Nonce NC2|} (Pan(pan X)))
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   159
       \<in> set evs4 |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   160
  ==> Says (CA i) C
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   161
          {|sign (priSK (CA i)) {|Agent C, Nonce NC2, Nonce NCA|},
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   162
            cert (CA i) (pubEK (CA i)) onlyEnc (priSK RCA),
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   163
            cert (CA i) (pubSK (CA i)) onlySig (priSK RCA)|}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   164
       # evs4 \<in> set_cr"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   165
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   166
| SET_CR5:
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   167
   --{*CertReq: C sends his PAN, a new nonce, its proposed public signature key
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   168
       and its half of the secret value to CA.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   169
       We now assume that C has a fixed key pair, and he submits (pubSK C).
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   170
       The protocol does not require this key to be fresh.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   171
       The encryption below is actually EncX.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   172
"[| evs5 \<in> set_cr;  C = Cardholder k;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   173
    Nonce NC3 \<notin> used evs5;  Nonce CardSecret \<notin> used evs5; NC3\<noteq>CardSecret;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   174
    Key KC2 \<notin> used evs5; KC2 \<in> symKeys;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   175
    Key KC3 \<notin> used evs5; KC3 \<in> symKeys; KC2\<noteq>KC3;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   176
    Gets C {|sign (invKey SKi) {|Agent C, Nonce NC2, Nonce NCA|},
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   177
             cert (CA i) EKi onlyEnc (priSK RCA),
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   178
             cert (CA i) SKi onlySig (priSK RCA) |}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   179
        \<in> set evs5;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   180
    Says C (CA i) (EXHcrypt KC1 EKi {|Agent C, Nonce NC2|} (Pan(pan C)))
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   181
         \<in> set evs5 |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   182
==> Says C (CA i)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   183
         {|Crypt KC3
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   184
             {|Agent C, Nonce NC3, Key KC2, Key (pubSK C),
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   185
               Crypt (priSK C)
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   186
                 (Hash {|Agent C, Nonce NC3, Key KC2,
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   187
                         Key (pubSK C), Pan (pan C), Nonce CardSecret|})|},
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   188
           Crypt EKi {|Key KC3, Pan (pan C), Nonce CardSecret|} |}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   189
    # Notes C {|Key KC2, Agent (CA i)|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   190
    # Notes C {|Key KC3, Agent (CA i)|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   191
    # evs5 \<in> set_cr"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   192
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   193
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   194
  --{* CertRes: CA responds sending NC3 back with its half of the secret value,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   195
   its signature certificate and the new cardholder signature
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   196
   certificate.  CA checks to have never certified the key proposed by C.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   197
   NOTE: In Merchant Registration, the corresponding rule (4)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   198
   uses the "sign" primitive. The encryption below is actually @{term EncK}, 
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   199
   which is just @{term "Crypt K (sign SK X)"}.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   200
*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   201
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   202
| SET_CR6:
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   203
"[| evs6 \<in> set_cr;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   204
    Nonce NonceCCA \<notin> used evs6;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   205
    KC2 \<in> symKeys;  KC3 \<in> symKeys;  cardSK \<notin> symKeys;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   206
    Notes (CA i) (Key cardSK) \<notin> set evs6;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   207
    Gets (CA i)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   208
      {|Crypt KC3 {|Agent C, Nonce NC3, Key KC2, Key cardSK,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   209
                    Crypt (invKey cardSK)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   210
                      (Hash {|Agent C, Nonce NC3, Key KC2,
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   211
                              Key cardSK, Pan (pan C), Nonce CardSecret|})|},
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   212
        Crypt (pubEK (CA i)) {|Key KC3, Pan (pan C), Nonce CardSecret|} |}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   213
      \<in> set evs6 |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   214
==> Says (CA i) C
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   215
         (Crypt KC2
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   216
          {|sign (priSK (CA i))
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   217
                 {|Agent C, Nonce NC3, Agent(CA i), Nonce NonceCCA|},
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   218
            certC (pan C) cardSK (XOR(CardSecret,NonceCCA)) onlySig (priSK (CA i)),
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   219
            cert (CA i) (pubSK (CA i)) onlySig (priSK RCA)|})
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   220
      # Notes (CA i) (Key cardSK)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   221
      # evs6 \<in> set_cr"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   222
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   223
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   224
declare Says_imp_knows_Spy [THEN parts.Inj, dest]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   225
declare parts.Body [dest]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   226
declare analz_into_parts [dest]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   227
declare Fake_parts_insert_in_Un [dest]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   228
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   229
text{*A "possibility property": there are traces that reach the end.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   230
      An unconstrained proof with many subgoals.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   231
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   232
lemma Says_to_Gets:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   233
     "Says A B X # evs \<in> set_cr ==> Gets B X # Says A B X # evs \<in> set_cr"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   234
by (rule set_cr.Reception, auto)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   235
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   236
text{*The many nonces and keys generated, some simultaneously, force us to
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   237
  introduce them explicitly as shown below.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   238
lemma possibility_CR6:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   239
     "[|NC1 < (NC2::nat);  NC2 < NC3;  NC3 < NCA ;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   240
        NCA < NonceCCA;  NonceCCA < CardSecret;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   241
        KC1 < (KC2::key);  KC2 < KC3;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   242
        KC1 \<in> symKeys;  Key KC1 \<notin> used [];
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   243
        KC2 \<in> symKeys;  Key KC2 \<notin> used [];
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   244
        KC3 \<in> symKeys;  Key KC3 \<notin> used [];
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   245
        C = Cardholder k|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   246
   ==> \<exists>evs \<in> set_cr.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   247
       Says (CA i) C
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   248
            (Crypt KC2
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   249
             {|sign (priSK (CA i))
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   250
                    {|Agent C, Nonce NC3, Agent(CA i), Nonce NonceCCA|},
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   251
               certC (pan C) (pubSK (Cardholder k)) (XOR(CardSecret,NonceCCA))
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   252
                     onlySig (priSK (CA i)),
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   253
               cert (CA i) (pubSK (CA i)) onlySig (priSK RCA)|})
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   254
          \<in> set evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   255
apply (intro exI bexI)
14206
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   256
apply (rule_tac [2] 
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   257
       set_cr.Nil 
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   258
        [THEN set_cr.SET_CR1 [of concl: C i NC1], 
77bf175f5145 Tidying of SET's "possibility theorems" (removal of Key_supply_ax)
paulson
parents: 14199
diff changeset
   259
         THEN Says_to_Gets, 
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   260
         THEN set_cr.SET_CR2 [of concl: i C NC1], 
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   261
         THEN Says_to_Gets,  
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   262
         THEN set_cr.SET_CR3 [of concl: C i KC1 _ NC2], 
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   263
         THEN Says_to_Gets,  
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   264
         THEN set_cr.SET_CR4 [of concl: i C NC2 NCA], 
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   265
         THEN Says_to_Gets,  
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   266
         THEN set_cr.SET_CR5 [of concl: C i KC3 NC3 KC2 CardSecret],
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   267
         THEN Says_to_Gets,  
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32404
diff changeset
   268
         THEN set_cr.SET_CR6 [of concl: i C KC2]])
30607
c3d1590debd8 eliminated global SIMPSET, CLASET etc. -- refer to explicit context;
wenzelm
parents: 30549
diff changeset
   269
apply basic_possibility
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   270
apply (simp_all (no_asm_simp) add: symKeys_neq_imp_neq)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   271
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   272
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   273
text{*General facts about message reception*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   274
lemma Gets_imp_Says:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   275
     "[| Gets B X \<in> set evs; evs \<in> set_cr |] ==> \<exists>A. Says A B X \<in> set evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   276
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   277
apply (erule set_cr.induct, auto)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   278
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   279
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   280
lemma Gets_imp_knows_Spy:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   281
     "[| Gets B X \<in> set evs; evs \<in> set_cr |]  ==> X \<in> knows Spy evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   282
by (blast dest!: Gets_imp_Says Says_imp_knows_Spy)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   283
declare Gets_imp_knows_Spy [THEN parts.Inj, dest]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   284
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   285
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   286
subsection{*Proofs on keys *}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   287
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   288
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
   289
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   290
lemma Spy_see_private_Key [simp]:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   291
     "evs \<in> set_cr
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   292
      ==> (Key(invKey (publicKey b A)) \<in> parts(knows Spy evs)) = (A \<in> bad)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   293
by (erule set_cr.induct, auto)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   294
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   295
lemma Spy_analz_private_Key [simp]:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   296
     "evs \<in> set_cr ==>
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   297
     (Key(invKey (publicKey b A)) \<in> analz(knows Spy evs)) = (A \<in> bad)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   298
by auto
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   299
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   300
declare Spy_see_private_Key [THEN [2] rev_iffD1, dest!]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   301
declare Spy_analz_private_Key [THEN [2] rev_iffD1, dest!]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   302
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   303
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   304
subsection{*Begin Piero's Theorems on Certificates*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   305
text{*Trivial in the current model, where certificates by RCA are secure *}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   306
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   307
lemma Crypt_valid_pubEK:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   308
     "[| Crypt (priSK RCA) {|Agent C, Key EKi, onlyEnc|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   309
           \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   310
         evs \<in> set_cr |] ==> EKi = pubEK C"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   311
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   312
apply (erule set_cr.induct, auto)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   313
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   314
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   315
lemma certificate_valid_pubEK:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   316
    "[| cert C EKi onlyEnc (priSK RCA) \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   317
        evs \<in> set_cr |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   318
     ==> EKi = pubEK C"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   319
apply (unfold cert_def signCert_def)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   320
apply (blast dest!: Crypt_valid_pubEK)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   321
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   322
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   323
lemma Crypt_valid_pubSK:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   324
     "[| Crypt (priSK RCA) {|Agent C, Key SKi, onlySig|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   325
           \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   326
         evs \<in> set_cr |] ==> SKi = pubSK C"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   327
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   328
apply (erule set_cr.induct, auto)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   329
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   330
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   331
lemma certificate_valid_pubSK:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   332
    "[| cert C SKi onlySig (priSK RCA) \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   333
        evs \<in> set_cr |] ==> SKi = pubSK C"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   334
apply (unfold cert_def signCert_def)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   335
apply (blast dest!: Crypt_valid_pubSK)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   336
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   337
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   338
lemma Gets_certificate_valid:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   339
     "[| Gets A {| X, cert C EKi onlyEnc (priSK RCA),
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   340
                      cert C SKi onlySig (priSK RCA)|} \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   341
         evs \<in> set_cr |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   342
      ==> EKi = pubEK C & SKi = pubSK C"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   343
by (blast dest: certificate_valid_pubEK certificate_valid_pubSK)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   344
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   345
text{*Nobody can have used non-existent keys!*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   346
lemma new_keys_not_used:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   347
     "[|K \<in> symKeys; Key K \<notin> used evs; evs \<in> set_cr|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   348
      ==> K \<notin> keysFor (parts (knows Spy evs))"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   349
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   350
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   351
apply (erule set_cr.induct)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   352
apply (frule_tac [8] Gets_certificate_valid)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   353
apply (frule_tac [6] Gets_certificate_valid, simp_all)
14218
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   354
apply (force dest!: usedI keysFor_parts_insert) --{*Fake*}
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   355
apply (blast,auto)  --{*Others*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   356
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   357
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   358
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   359
subsection{*New versions: as above, but generalized to have the KK argument *}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   360
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   361
lemma gen_new_keys_not_used:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   362
     "[|Key K \<notin> used evs; K \<in> symKeys; evs \<in> set_cr |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   363
      ==> Key K \<notin> used evs --> K \<in> symKeys -->
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   364
          K \<notin> keysFor (parts (Key`KK Un knows Spy evs))"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   365
by (auto simp add: new_keys_not_used)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   366
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   367
lemma gen_new_keys_not_analzd:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   368
     "[|Key K \<notin> used evs; K \<in> symKeys; evs \<in> set_cr |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   369
      ==> K \<notin> keysFor (analz (Key`KK Un knows Spy evs))"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   370
by (blast intro: keysFor_mono [THEN [2] rev_subsetD]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   371
          dest: gen_new_keys_not_used)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   372
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   373
lemma analz_Key_image_insert_eq:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   374
     "[|K \<in> symKeys; Key K \<notin> used evs; evs \<in> set_cr |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   375
      ==> analz (Key ` (insert K KK) \<union> knows Spy evs) =
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   376
          insert (Key K) (analz (Key ` KK \<union> knows Spy evs))"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   377
by (simp add: gen_new_keys_not_analzd)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   378
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   379
lemma Crypt_parts_imp_used:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   380
     "[|Crypt K X \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   381
        K \<in> symKeys; evs \<in> set_cr |] ==> Key K \<in> used evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   382
apply (rule ccontr)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   383
apply (force dest: new_keys_not_used Crypt_imp_invKey_keysFor)
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 Crypt_analz_imp_used:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   387
     "[|Crypt K X \<in> analz (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   388
        K \<in> symKeys; evs \<in> set_cr |] ==> Key K \<in> used evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   389
by (blast intro: Crypt_parts_imp_used)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   390
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   391
14218
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   392
(*<*) 
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   393
subsection{*Messages signed by CA*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   394
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   395
text{*Message @{text SET_CR2}: C can check CA's signature if he has received
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   396
     CA's certificate.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   397
lemma CA_Says_2_lemma:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   398
     "[| Crypt (priSK (CA i)) (Hash{|Agent C, Nonce NC1|})
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   399
           \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   400
         evs \<in> set_cr; (CA i) \<notin> bad |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   401
     ==> \<exists>Y. Says (CA i) C {|sign (priSK (CA i)) {|Agent C, Nonce NC1|}, Y|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   402
                 \<in> set evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   403
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   404
apply (erule set_cr.induct, auto)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   405
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   406
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   407
text{*Ever used?*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   408
lemma CA_Says_2:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   409
     "[| Crypt (invKey SK) (Hash{|Agent C, Nonce NC1|})
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   410
           \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   411
         cert (CA i) SK onlySig (priSK RCA) \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   412
         evs \<in> set_cr; (CA i) \<notin> bad |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   413
      ==> \<exists>Y. Says (CA i) C {|sign (priSK (CA i)) {|Agent C, Nonce NC1|}, Y|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   414
                  \<in> set evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   415
by (blast dest!: certificate_valid_pubSK intro!: CA_Says_2_lemma)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   416
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   417
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   418
text{*Message @{text SET_CR4}: C can check CA's signature if he has received
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   419
      CA's certificate.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   420
lemma CA_Says_4_lemma:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   421
     "[| Crypt (priSK (CA i)) (Hash{|Agent C, Nonce NC2, Nonce NCA|})
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   422
           \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   423
         evs \<in> set_cr; (CA i) \<notin> bad |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   424
      ==> \<exists>Y. Says (CA i) C {|sign (priSK (CA i))
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   425
                     {|Agent C, Nonce NC2, Nonce NCA|}, Y|} \<in> set evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   426
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   427
apply (erule set_cr.induct, auto)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   428
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   429
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   430
text{*NEVER USED*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   431
lemma CA_Says_4:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   432
     "[| Crypt (invKey SK) (Hash{|Agent C, Nonce NC2, Nonce NCA|})
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   433
           \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   434
         cert (CA i) SK onlySig (priSK RCA) \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   435
         evs \<in> set_cr; (CA i) \<notin> bad |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   436
      ==> \<exists>Y. Says (CA i) C {|sign (priSK (CA i))
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   437
                   {|Agent C, Nonce NC2, Nonce NCA|}, Y|} \<in> set evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   438
by (blast dest!: certificate_valid_pubSK intro!: CA_Says_4_lemma)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   439
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   440
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   441
text{*Message @{text SET_CR6}: C can check CA's signature if he has
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   442
      received CA's certificate.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   443
lemma CA_Says_6_lemma:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   444
     "[| Crypt (priSK (CA i)) 
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   445
               (Hash{|Agent C, Nonce NC3, Agent (CA i), Nonce NonceCCA|})
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   446
           \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   447
         evs \<in> set_cr; (CA i) \<notin> bad |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   448
      ==> \<exists>Y K. Says (CA i) C (Crypt K {|sign (priSK (CA i))
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   449
      {|Agent C, Nonce NC3, Agent (CA i), Nonce NonceCCA|}, Y|}) \<in> set evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   450
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   451
apply (erule set_cr.induct, auto)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   452
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   453
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   454
text{*NEVER USED*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   455
lemma CA_Says_6:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   456
     "[| Crypt (invKey SK) (Hash{|Agent C, Nonce NC3, Agent (CA i), Nonce NonceCCA|})
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   457
           \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   458
         cert (CA i) SK onlySig (priSK RCA) \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   459
         evs \<in> set_cr; (CA i) \<notin> bad |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   460
      ==> \<exists>Y K. Says (CA i) C (Crypt K {|sign (priSK (CA i))
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   461
                    {|Agent C, Nonce NC3, Agent (CA i), Nonce NonceCCA|}, Y|}) \<in> set evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   462
by (blast dest!: certificate_valid_pubSK intro!: CA_Says_6_lemma)
14218
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   463
(*>*)
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   464
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   465
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   466
subsection{*Useful lemmas *}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   467
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   468
text{*Rewriting rule for private encryption keys.  Analogous rewriting rules
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   469
for other keys aren't needed.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   470
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   471
lemma parts_image_priEK:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   472
     "[|Key (priEK C) \<in> parts (Key`KK Un (knows Spy evs));
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   473
        evs \<in> set_cr|] ==> priEK C \<in> KK | C \<in> bad"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   474
by auto
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   475
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   476
text{*trivial proof because (priEK C) never appears even in (parts evs)*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   477
lemma analz_image_priEK:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   478
     "evs \<in> set_cr ==>
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   479
          (Key (priEK C) \<in> analz (Key`KK Un (knows Spy evs))) =
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   480
          (priEK C \<in> KK | C \<in> bad)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   481
by (blast dest!: parts_image_priEK intro: analz_mono [THEN [2] rev_subsetD])
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   482
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   483
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   484
subsection{*Secrecy of Session Keys *}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   485
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   486
subsubsection{*Lemmas about the predicate KeyCryptKey *}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   487
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   488
text{*A fresh DK cannot be associated with any other
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   489
  (with respect to a given trace). *}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   490
lemma DK_fresh_not_KeyCryptKey:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   491
     "[| Key DK \<notin> used evs; evs \<in> set_cr |] ==> ~ KeyCryptKey DK K evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   492
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   493
apply (erule set_cr.induct)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   494
apply (simp_all (no_asm_simp))
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   495
apply (blast dest: Crypt_analz_imp_used)+
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   496
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   497
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   498
text{*A fresh K cannot be associated with any other.  The assumption that
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   499
  DK isn't a private encryption key may be an artifact of the particular
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   500
  definition of KeyCryptKey.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   501
lemma K_fresh_not_KeyCryptKey:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   502
     "[|\<forall>C. DK \<noteq> priEK C; Key K \<notin> used evs|] ==> ~ KeyCryptKey DK K evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   503
apply (induct evs)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   504
apply (auto simp add: parts_insert2 split add: event.split)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   505
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   506
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   507
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   508
text{*This holds because if (priEK (CA i)) appears in any traffic then it must
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   509
  be known to the Spy, by @{term Spy_see_private_Key}*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   510
lemma cardSK_neq_priEK:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   511
     "[|Key cardSK \<notin> analz (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   512
        Key cardSK : parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   513
        evs \<in> set_cr|] ==> cardSK \<noteq> priEK C"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   514
by blast
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   515
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   516
lemma not_KeyCryptKey_cardSK [rule_format (no_asm)]:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   517
     "[|cardSK \<notin> symKeys;  \<forall>C. cardSK \<noteq> priEK C;  evs \<in> set_cr|] ==>
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   518
      Key cardSK \<notin> analz (knows Spy evs) --> ~ KeyCryptKey cardSK K evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   519
by (erule set_cr.induct, analz_mono_contra, auto)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   520
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   521
text{*Lemma for message 5: pubSK C is never used to encrypt Keys.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   522
lemma pubSK_not_KeyCryptKey [simp]: "~ KeyCryptKey (pubSK C) K evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   523
apply (induct_tac "evs")
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   524
apply (auto simp add: parts_insert2 split add: event.split)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   525
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   526
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   527
text{*Lemma for message 6: either cardSK is compromised (when we don't care)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   528
  or else cardSK hasn't been used to encrypt K.  Previously we treated
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   529
  message 5 in the same way, but the current model assumes that rule
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   530
  @{text SET_CR5} is executed only by honest agents.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   531
lemma msg6_KeyCryptKey_disj:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   532
     "[|Gets B {|Crypt KC3 {|Agent C, Nonce N, Key KC2, Key cardSK, X|}, Y|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   533
          \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   534
        cardSK \<notin> symKeys;  evs \<in> set_cr|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   535
      ==> Key cardSK \<in> analz (knows Spy evs) |
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   536
          (\<forall>K. ~ KeyCryptKey cardSK K evs)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   537
by (blast dest: not_KeyCryptKey_cardSK intro: cardSK_neq_priEK)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   538
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   539
text{*As usual: we express the property as a logical equivalence*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   540
lemma Key_analz_image_Key_lemma:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   541
     "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
   542
      ==>
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   543
      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
   544
by (blast intro: analz_mono [THEN [2] rev_subsetD])
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   545
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   546
method_setup valid_certificate_tac = {*
30549
d2d7874648bd simplified method setup;
wenzelm
parents: 24123
diff changeset
   547
  Args.goal_spec >> (fn quant => K (SIMPLE_METHOD'' quant
d2d7874648bd simplified method setup;
wenzelm
parents: 24123
diff changeset
   548
    (fn i =>
d2d7874648bd simplified method setup;
wenzelm
parents: 24123
diff changeset
   549
      EVERY [ftac @{thm Gets_certificate_valid} i,
d2d7874648bd simplified method setup;
wenzelm
parents: 24123
diff changeset
   550
             assume_tac i,
d2d7874648bd simplified method setup;
wenzelm
parents: 24123
diff changeset
   551
             etac conjE i, REPEAT (hyp_subst_tac i)])))
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   552
*} ""
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   553
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   554
text{*The @{text "(no_asm)"} attribute is essential, since it retains
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   555
  the quantifier and allows the simprule's condition to itself be simplified.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   556
lemma symKey_compromise [rule_format (no_asm)]:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   557
     "evs \<in> set_cr ==>
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   558
      (\<forall>SK KK. SK \<in> symKeys \<longrightarrow> (\<forall>K \<in> KK. ~ KeyCryptKey K SK evs)   -->
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   559
               (Key SK \<in> analz (Key`KK Un (knows Spy evs))) =
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   560
               (SK \<in> KK | Key SK \<in> analz (knows Spy evs)))"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   561
apply (erule set_cr.induct)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   562
apply (rule_tac [!] allI) +
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   563
apply (rule_tac [!] impI [THEN Key_analz_image_Key_lemma, THEN impI])+
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   564
apply (valid_certificate_tac [8]) --{*for message 5*}
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   565
apply (valid_certificate_tac [6]) --{*for message 5*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   566
apply (erule_tac [9] msg6_KeyCryptKey_disj [THEN disjE])
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   567
apply (simp_all
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   568
         del: image_insert image_Un imp_disjL
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   569
         add: analz_image_keys_simps analz_knows_absorb
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   570
              analz_Key_image_insert_eq notin_image_iff
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   571
              K_fresh_not_KeyCryptKey
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   572
              DK_fresh_not_KeyCryptKey ball_conj_distrib
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   573
              analz_image_priEK disj_simps)
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   574
  --{*9 seconds on a 1.6GHz machine*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   575
apply spy_analz
14218
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   576
apply blast  --{*3*}
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   577
apply blast  --{*5*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   578
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   579
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   580
text{*The remaining quantifiers seem to be essential.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   581
  NO NEED to assume the cardholder's OK: bad cardholders don't do anything
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   582
  wrong!!*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   583
lemma symKey_secrecy [rule_format]:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   584
     "[|CA i \<notin> bad;  K \<in> symKeys;  evs \<in> set_cr|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   585
      ==> \<forall>X c. Says (Cardholder c) (CA i) X \<in> set evs -->
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   586
                Key K \<in> parts{X} -->
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   587
                Cardholder c \<notin> bad -->
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   588
                Key K \<notin> analz (knows Spy evs)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   589
apply (erule set_cr.induct)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   590
apply (frule_tac [8] Gets_certificate_valid) --{*for message 5*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   591
apply (frule_tac [6] Gets_certificate_valid) --{*for message 3*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   592
apply (erule_tac [11] msg6_KeyCryptKey_disj [THEN disjE])
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   593
apply (simp_all del: image_insert image_Un imp_disjL
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   594
         add: symKey_compromise fresh_notin_analz_knows_Spy
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   595
              analz_image_keys_simps analz_knows_absorb
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   596
              analz_Key_image_insert_eq notin_image_iff
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   597
              K_fresh_not_KeyCryptKey
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   598
              DK_fresh_not_KeyCryptKey
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   599
              analz_image_priEK)
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   600
  --{*2.5 seconds on a 1.6GHz machine*}
14218
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   601
apply spy_analz  --{*Fake*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   602
apply (auto intro: analz_into_parts [THEN usedI] in_parts_Says_imp_used)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   603
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   604
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   605
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   606
subsection{*Primary Goals of Cardholder Registration *}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   607
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   608
text{*The cardholder's certificate really was created by the CA, provided the
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   609
    CA is uncompromised *}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   610
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   611
text{*Lemma concerning the actual signed message digest*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   612
lemma cert_valid_lemma:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   613
     "[|Crypt (priSK (CA i)) {|Hash {|Nonce N, Pan(pan C)|}, Key cardSK, N1|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   614
          \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   615
        CA i \<notin> bad; evs \<in> set_cr|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   616
  ==> \<exists>KC2 X Y. Says (CA i) C
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   617
                     (Crypt KC2 
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   618
                       {|X, certC (pan C) cardSK N onlySig (priSK (CA i)), Y|})
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   619
                  \<in> set evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   620
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   621
apply (erule set_cr.induct)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   622
apply (simp_all (no_asm_simp))
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   623
apply auto
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   624
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   625
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   626
text{*Pre-packaged version for cardholder.  We don't try to confirm the values
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   627
  of KC2, X and Y, since they are not important.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   628
lemma certificate_valid_cardSK:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   629
    "[|Gets C (Crypt KC2 {|X, certC (pan C) cardSK N onlySig (invKey SKi),
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   630
                              cert (CA i) SKi onlySig (priSK RCA)|}) \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   631
        CA i \<notin> bad; evs \<in> set_cr|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   632
  ==> \<exists>KC2 X Y. Says (CA i) C
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   633
                     (Crypt KC2 
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   634
                       {|X, certC (pan C) cardSK N onlySig (priSK (CA i)), Y|})
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   635
                   \<in> set evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   636
by (force dest!: Gets_imp_knows_Spy [THEN parts.Inj, THEN parts.Body]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   637
                    certificate_valid_pubSK cert_valid_lemma)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   638
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   639
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   640
lemma Hash_imp_parts [rule_format]:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   641
     "evs \<in> set_cr
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   642
      ==> Hash{|X, Nonce N|} \<in> parts (knows Spy evs) -->
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   643
          Nonce N \<in> parts (knows Spy evs)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   644
apply (erule set_cr.induct, force)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   645
apply (simp_all (no_asm_simp))
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   646
apply (blast intro: parts_mono [THEN [2] rev_subsetD])
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   647
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   648
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   649
lemma Hash_imp_parts2 [rule_format]:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   650
     "evs \<in> set_cr
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   651
      ==> Hash{|X, Nonce M, Y, Nonce N|} \<in> parts (knows Spy evs) -->
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   652
          Nonce M \<in> parts (knows Spy evs) & Nonce N \<in> parts (knows Spy evs)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   653
apply (erule set_cr.induct, force)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   654
apply (simp_all (no_asm_simp))
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   655
apply (blast intro: parts_mono [THEN [2] rev_subsetD])
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   656
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   657
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   658
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   659
subsection{*Secrecy of Nonces*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   660
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   661
subsubsection{*Lemmas about the predicate KeyCryptNonce *}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   662
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   663
text{*A fresh DK cannot be associated with any other
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   664
  (with respect to a given trace). *}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   665
lemma DK_fresh_not_KeyCryptNonce:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   666
     "[| DK \<in> symKeys; Key DK \<notin> used evs; evs \<in> set_cr |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   667
      ==> ~ KeyCryptNonce DK K evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   668
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   669
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   670
apply (erule set_cr.induct)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   671
apply (simp_all (no_asm_simp))
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   672
apply blast
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   673
apply blast
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   674
apply (auto simp add: DK_fresh_not_KeyCryptKey)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   675
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   676
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   677
text{*A fresh N cannot be associated with any other
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   678
      (with respect to a given trace). *}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   679
lemma N_fresh_not_KeyCryptNonce:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   680
     "\<forall>C. DK \<noteq> priEK C ==> Nonce N \<notin> used evs --> ~ KeyCryptNonce DK N evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   681
apply (induct_tac "evs")
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   682
apply (case_tac [2] "a")
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   683
apply (auto simp add: parts_insert2)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   684
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   685
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   686
lemma not_KeyCryptNonce_cardSK [rule_format (no_asm)]:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   687
     "[|cardSK \<notin> symKeys;  \<forall>C. cardSK \<noteq> priEK C;  evs \<in> set_cr|] ==>
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   688
      Key cardSK \<notin> analz (knows Spy evs) --> ~ KeyCryptNonce cardSK N evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   689
apply (erule set_cr.induct, analz_mono_contra, simp_all)
14218
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   690
apply (blast dest: not_KeyCryptKey_cardSK)  --{*6*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   691
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   692
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   693
subsubsection{*Lemmas for message 5 and 6:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   694
  either cardSK is compromised (when we don't care)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   695
  or else cardSK hasn't been used to encrypt K. *}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   696
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   697
text{*Lemma for message 5: pubSK C is never used to encrypt Nonces.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   698
lemma pubSK_not_KeyCryptNonce [simp]: "~ KeyCryptNonce (pubSK C) N evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   699
apply (induct_tac "evs")
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   700
apply (auto simp add: parts_insert2 split add: event.split)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   701
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   702
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   703
text{*Lemma for message 6: either cardSK is compromised (when we don't care)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   704
  or else cardSK hasn't been used to encrypt K.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   705
lemma msg6_KeyCryptNonce_disj:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   706
     "[|Gets B {|Crypt KC3 {|Agent C, Nonce N, Key KC2, Key cardSK, X|}, Y|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   707
          \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   708
        cardSK \<notin> symKeys;  evs \<in> set_cr|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   709
      ==> Key cardSK \<in> analz (knows Spy evs) |
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   710
          ((\<forall>K. ~ KeyCryptKey cardSK K evs) &
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   711
           (\<forall>N. ~ KeyCryptNonce cardSK N evs))"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   712
by (blast dest: not_KeyCryptKey_cardSK not_KeyCryptNonce_cardSK
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   713
          intro: cardSK_neq_priEK)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   714
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   715
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   716
text{*As usual: we express the property as a logical equivalence*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   717
lemma Nonce_analz_image_Key_lemma:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   718
     "P --> (Nonce N \<in> analz (Key`KK Un H)) --> (Nonce N \<in> analz H)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   719
      ==> P --> (Nonce N \<in> analz (Key`KK Un H)) = (Nonce N \<in> analz H)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   720
by (blast intro: analz_mono [THEN [2] rev_subsetD])
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   721
32404
da3ca3c6ec81 sledgehammer used to streamline protocol proofs
paulson
parents: 30607
diff changeset
   722
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   723
text{*The @{text "(no_asm)"} attribute is essential, since it retains
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   724
  the quantifier and allows the simprule's condition to itself be simplified.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   725
lemma Nonce_compromise [rule_format (no_asm)]:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   726
     "evs \<in> set_cr ==>
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   727
      (\<forall>N KK. (\<forall>K \<in> KK. ~ KeyCryptNonce K N evs)   -->
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   728
               (Nonce N \<in> analz (Key`KK Un (knows Spy evs))) =
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   729
               (Nonce N \<in> analz (knows Spy evs)))"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   730
apply (erule set_cr.induct)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   731
apply (rule_tac [!] allI)+
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   732
apply (rule_tac [!] impI [THEN Nonce_analz_image_Key_lemma])+
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   733
apply (frule_tac [8] Gets_certificate_valid) --{*for message 5*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   734
apply (frule_tac [6] Gets_certificate_valid) --{*for message 3*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   735
apply (frule_tac [11] msg6_KeyCryptNonce_disj)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   736
apply (erule_tac [13] disjE)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   737
apply (simp_all del: image_insert image_Un
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   738
         add: symKey_compromise
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   739
              analz_image_keys_simps analz_knows_absorb
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   740
              analz_Key_image_insert_eq notin_image_iff
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   741
              N_fresh_not_KeyCryptNonce
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   742
              DK_fresh_not_KeyCryptNonce K_fresh_not_KeyCryptKey
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   743
              ball_conj_distrib analz_image_priEK)
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   744
  --{*14 seconds on a 1.6GHz machine*}
14218
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   745
apply spy_analz  --{*Fake*}
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   746
apply blast  --{*3*}
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   747
apply blast  --{*5*}
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   748
txt{*Message 6*}
32404
da3ca3c6ec81 sledgehammer used to streamline protocol proofs
paulson
parents: 30607
diff changeset
   749
apply (metis symKey_compromise)
14218
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   750
  --{*cardSK compromised*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   751
txt{*Simplify again--necessary because the previous simplification introduces
32404
da3ca3c6ec81 sledgehammer used to streamline protocol proofs
paulson
parents: 30607
diff changeset
   752
  some logical connectives*} 
da3ca3c6ec81 sledgehammer used to streamline protocol proofs
paulson
parents: 30607
diff changeset
   753
apply (force simp del: image_insert image_Un imp_disjL
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   754
          simp add: analz_image_keys_simps symKey_compromise)
14218
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   755
done
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   756
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   757
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   758
subsection{*Secrecy of CardSecret: the Cardholder's secret*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   759
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   760
lemma NC2_not_CardSecret:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   761
     "[|Crypt EKj {|Key K, Pan p, Hash {|Agent D, Nonce N|}|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   762
          \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   763
        Key K \<notin> analz (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   764
        Nonce N \<notin> analz (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   765
       evs \<in> set_cr|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   766
      ==> Crypt EKi {|Key K', Pan p', Nonce N|} \<notin> parts (knows Spy evs)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   767
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   768
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   769
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   770
apply (erule set_cr.induct, analz_mono_contra, simp_all)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   771
apply (blast dest: Hash_imp_parts)+
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   772
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   773
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   774
lemma KC2_secure_lemma [rule_format]:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   775
     "[|U = Crypt KC3 {|Agent C, Nonce N, Key KC2, X|};
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   776
        U \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   777
        evs \<in> set_cr|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   778
  ==> Nonce N \<notin> analz (knows Spy evs) -->
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   779
      (\<exists>k i W. Says (Cardholder k) (CA i) {|U,W|} \<in> set evs & 
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   780
               Cardholder k \<notin> bad & CA i \<notin> bad)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   781
apply (erule_tac P = "U \<in> ?H" in rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   782
apply (erule set_cr.induct)
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   783
apply (valid_certificate_tac [8])  --{*for message 5*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   784
apply (simp_all del: image_insert image_Un imp_disjL
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   785
         add: analz_image_keys_simps analz_knows_absorb
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   786
              analz_knows_absorb2 notin_image_iff)
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   787
  --{*4 seconds on a 1.6GHz machine*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   788
apply (simp_all (no_asm_simp)) --{*leaves 4 subgoals*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   789
apply (blast intro!: analz_insertI)+
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   790
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   791
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   792
lemma KC2_secrecy:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   793
     "[|Gets B {|Crypt K {|Agent C, Nonce N, Key KC2, X|}, Y|} \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   794
        Nonce N \<notin> analz (knows Spy evs);  KC2 \<in> symKeys;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   795
        evs \<in> set_cr|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   796
       ==> Key KC2 \<notin> analz (knows Spy evs)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   797
by (force dest!: refl [THEN KC2_secure_lemma] symKey_secrecy)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   798
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   799
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   800
text{*Inductive version*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   801
lemma CardSecret_secrecy_lemma [rule_format]:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   802
     "[|CA i \<notin> bad;  evs \<in> set_cr|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   803
      ==> Key K \<notin> analz (knows Spy evs) -->
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   804
          Crypt (pubEK (CA i)) {|Key K, Pan p, Nonce CardSecret|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   805
             \<in> parts (knows Spy evs) -->
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   806
          Nonce CardSecret \<notin> analz (knows Spy evs)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   807
apply (erule set_cr.induct, analz_mono_contra)
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   808
apply (valid_certificate_tac [8]) --{*for message 5*}
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   809
apply (valid_certificate_tac [6]) --{*for message 5*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   810
apply (frule_tac [9] msg6_KeyCryptNonce_disj [THEN disjE])
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   811
apply (simp_all
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   812
         del: image_insert image_Un imp_disjL
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   813
         add: analz_image_keys_simps analz_knows_absorb
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   814
              analz_Key_image_insert_eq notin_image_iff
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   815
              EXHcrypt_def Crypt_notin_image_Key
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   816
              N_fresh_not_KeyCryptNonce DK_fresh_not_KeyCryptNonce
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   817
              ball_conj_distrib Nonce_compromise symKey_compromise
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   818
              analz_image_priEK)
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   819
  --{*2.5 seconds on a 1.6GHz machine*}
14218
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   820
apply spy_analz  --{*Fake*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   821
apply (simp_all (no_asm_simp))
14218
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   822
apply blast  --{*1*}
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   823
apply (blast dest!: Gets_imp_knows_Spy [THEN analz.Inj])  --{*2*}
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   824
apply blast  --{*3*}
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   825
apply (blast dest: NC2_not_CardSecret Gets_imp_knows_Spy [THEN analz.Inj] analz_symKeys_Decrypt)  --{*4*}
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   826
apply blast  --{*5*}
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   827
apply (blast dest: KC2_secrecy)+  --{*Message 6: two cases*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   828
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   829
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   830
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   831
text{*Packaged version for cardholder*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   832
lemma CardSecret_secrecy:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   833
     "[|Cardholder k \<notin> bad;  CA i \<notin> bad;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   834
        Says (Cardholder k) (CA i)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   835
           {|X, Crypt EKi {|Key KC3, Pan p, Nonce CardSecret|}|} \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   836
        Gets A {|Z, cert (CA i) EKi onlyEnc (priSK RCA),
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   837
                    cert (CA i) SKi onlySig (priSK RCA)|} \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   838
        KC3 \<in> symKeys;  evs \<in> set_cr|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   839
      ==> Nonce CardSecret \<notin> analz (knows Spy evs)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   840
apply (frule Gets_certificate_valid, assumption)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   841
apply (subgoal_tac "Key KC3 \<notin> analz (knows Spy evs) ")
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   842
apply (blast dest: CardSecret_secrecy_lemma)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   843
apply (rule symKey_secrecy)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   844
apply (auto simp add: parts_insert2)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   845
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   846
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   847
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   848
subsection{*Secrecy of NonceCCA [the CA's secret] *}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   849
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   850
lemma NC2_not_NonceCCA:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   851
     "[|Hash {|Agent C', Nonce N', Agent C, Nonce N|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   852
          \<in> parts (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   853
        Nonce N \<notin> analz (knows Spy evs);
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   854
       evs \<in> set_cr|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   855
      ==> Crypt KC1 {|{|Agent B, Nonce N|}, Hash p|} \<notin> parts (knows Spy evs)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   856
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   857
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   858
apply (erule set_cr.induct, analz_mono_contra, simp_all)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   859
apply (blast dest: Hash_imp_parts2)+
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   860
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   861
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   862
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   863
text{*Inductive version*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   864
lemma NonceCCA_secrecy_lemma [rule_format]:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   865
     "[|CA i \<notin> bad;  evs \<in> set_cr|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   866
      ==> Key K \<notin> analz (knows Spy evs) -->
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   867
          Crypt K
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   868
            {|sign (priSK (CA i))
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   869
                   {|Agent C, Nonce N, Agent(CA i), Nonce NonceCCA|},
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   870
              X, Y|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   871
             \<in> parts (knows Spy evs) -->
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   872
          Nonce NonceCCA \<notin> analz (knows Spy evs)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   873
apply (erule set_cr.induct, analz_mono_contra)
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   874
apply (valid_certificate_tac [8]) --{*for message 5*}
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   875
apply (valid_certificate_tac [6]) --{*for message 5*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   876
apply (frule_tac [9] msg6_KeyCryptNonce_disj [THEN disjE])
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   877
apply (simp_all
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   878
         del: image_insert image_Un imp_disjL
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   879
         add: analz_image_keys_simps analz_knows_absorb sign_def
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   880
              analz_Key_image_insert_eq notin_image_iff
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   881
              EXHcrypt_def Crypt_notin_image_Key
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   882
              N_fresh_not_KeyCryptNonce DK_fresh_not_KeyCryptNonce
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   883
              ball_conj_distrib Nonce_compromise symKey_compromise
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   884
              analz_image_priEK)
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   885
  --{*3 seconds on a 1.6GHz machine*}
14218
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   886
apply spy_analz  --{*Fake*}
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   887
apply blast  --{*1*}
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   888
apply (blast dest!: Gets_imp_knows_Spy [THEN analz.Inj])  --{*2*}
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   889
apply blast  --{*3*}
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   890
apply (blast dest: NC2_not_NonceCCA)  --{*4*}
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   891
apply blast  --{*5*}
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   892
apply (blast dest: KC2_secrecy)+  --{*Message 6: two cases*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   893
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   894
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   895
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   896
text{*Packaged version for cardholder*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   897
lemma NonceCCA_secrecy:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   898
     "[|Cardholder k \<notin> bad;  CA i \<notin> bad;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   899
        Gets (Cardholder k)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   900
           (Crypt KC2
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   901
            {|sign (priSK (CA i)) {|Agent C, Nonce N, Agent(CA i), Nonce NonceCCA|},
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   902
              X, Y|}) \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   903
        Says (Cardholder k) (CA i)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   904
           {|Crypt KC3 {|Agent C, Nonce NC3, Key KC2, X'|}, Y'|} \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   905
        Gets A {|Z, cert (CA i) EKi onlyEnc (priSK RCA),
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   906
                    cert (CA i) SKi onlySig (priSK RCA)|} \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   907
        KC2 \<in> symKeys;  evs \<in> set_cr|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   908
      ==> Nonce NonceCCA \<notin> analz (knows Spy evs)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   909
apply (frule Gets_certificate_valid, assumption)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   910
apply (subgoal_tac "Key KC2 \<notin> analz (knows Spy evs) ")
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   911
apply (blast dest: NonceCCA_secrecy_lemma)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   912
apply (rule symKey_secrecy)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   913
apply (auto simp add: parts_insert2)
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{*We don't bother to prove guarantees for the CA.  He doesn't care about
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   917
  the PANSecret: it isn't his credit card!*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   918
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   919
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   920
subsection{*Rewriting Rule for PANs*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   921
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   922
text{*Lemma for message 6: either cardSK isn't a CA's private encryption key,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   923
  or if it is then (because it appears in traffic) that CA is bad,
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   924
  and so the Spy knows that key already.  Either way, we can simplify
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   925
  the expression @{term "analz (insert (Key cardSK) X)"}.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   926
lemma msg6_cardSK_disj:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   927
     "[|Gets A {|Crypt K {|c, n, k', Key cardSK, X|}, Y|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   928
          \<in> set evs;  evs \<in> set_cr |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   929
      ==> cardSK \<notin> range(invKey o pubEK o CA) | Key cardSK \<in> knows Spy evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   930
by auto
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   931
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   932
lemma analz_image_pan_lemma:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   933
     "(Pan P \<in> analz (Key`nE Un H)) --> (Pan P \<in> analz H)  ==>
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   934
      (Pan P \<in> analz (Key`nE Un H)) =   (Pan P \<in> analz H)"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   935
by (blast intro: analz_mono [THEN [2] rev_subsetD])
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   936
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   937
lemma analz_image_pan [rule_format]:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   938
     "evs \<in> set_cr ==>
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   939
       \<forall>KK. KK <= - invKey ` pubEK ` range CA -->
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   940
            (Pan P \<in> analz (Key`KK Un (knows Spy evs))) =
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   941
            (Pan P \<in> analz (knows Spy evs))"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   942
apply (erule set_cr.induct)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   943
apply (rule_tac [!] allI impI)+
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   944
apply (rule_tac [!] analz_image_pan_lemma)
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   945
apply (valid_certificate_tac [8]) --{*for message 5*}
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   946
apply (valid_certificate_tac [6]) --{*for message 5*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   947
apply (erule_tac [9] msg6_cardSK_disj [THEN disjE])
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   948
apply (simp_all
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   949
         del: image_insert image_Un
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   950
         add: analz_image_keys_simps disjoint_image_iff
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   951
              notin_image_iff analz_image_priEK)
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   952
  --{*6 seconds on a 1.6GHz machine*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   953
apply spy_analz
14218
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   954
apply (simp add: insert_absorb)  --{*6*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   955
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   956
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   957
lemma analz_insert_pan:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   958
     "[| evs \<in> set_cr;  K \<notin> invKey ` pubEK ` range CA |] ==>
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   959
          (Pan P \<in> analz (insert (Key K) (knows Spy evs))) =
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   960
          (Pan P \<in> analz (knows Spy evs))"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   961
by (simp del: image_insert image_Un
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   962
         add: analz_image_keys_simps analz_image_pan)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   963
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   964
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   965
text{*Confidentiality of the PAN\@.  Maybe we could combine the statements of
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   966
  this theorem with @{term analz_image_pan}, requiring a single induction but
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   967
  a much more difficult proof.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   968
lemma pan_confidentiality:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   969
     "[| Pan (pan C) \<in> analz(knows Spy evs); C \<noteq>Spy; evs :set_cr|]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   970
    ==> \<exists>i X K HN.
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   971
        Says C (CA i) {|X, Crypt (pubEK (CA i)) {|Key K, Pan (pan C), HN|} |}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   972
           \<in> set evs
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   973
      & (CA i) \<in> bad"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   974
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   975
apply (erule set_cr.induct)
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   976
apply (valid_certificate_tac [8]) --{*for message 5*}
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   977
apply (valid_certificate_tac [6]) --{*for message 5*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   978
apply (erule_tac [9] msg6_cardSK_disj [THEN disjE])
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   979
apply (simp_all
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   980
         del: image_insert image_Un
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   981
         add: analz_image_keys_simps analz_insert_pan analz_image_pan
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   982
              notin_image_iff analz_image_priEK)
24123
a0fc58900606 tuned ML bindings (for multithreading);
wenzelm
parents: 23755
diff changeset
   983
  --{*3.5 seconds on a 1.6GHz machine*}
14218
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   984
apply spy_analz  --{*fake*}
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   985
apply blast  --{*3*}
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   986
apply blast  --{*5*}
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
   987
apply (simp (no_asm_simp) add: insert_absorb)  --{*6*}
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   988
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   989
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   990
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   991
subsection{*Unicity*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   992
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   993
lemma CR6_Says_imp_Notes:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   994
     "[|Says (CA i) C (Crypt KC2
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   995
          {|sign (priSK (CA i)) {|Agent C, Nonce NC3, Agent (CA i), Nonce Y|},
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   996
            certC (pan C) cardSK X onlySig (priSK (CA i)),
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   997
            cert (CA i) (pubSK (CA i)) onlySig (priSK RCA)|})  \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   998
        evs \<in> set_cr |]
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
   999
      ==> Notes (CA i) (Key cardSK) \<in> set evs"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1000
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1001
apply (erule set_cr.induct)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1002
apply (simp_all (no_asm_simp))
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1003
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1004
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1005
text{*Unicity of cardSK: it uniquely identifies the other components.  
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1006
      This holds because a CA accepts a cardSK at most once.*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1007
lemma cardholder_key_unicity:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1008
     "[|Says (CA i) C (Crypt KC2
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1009
          {|sign (priSK (CA i)) {|Agent C, Nonce NC3, Agent (CA i), Nonce Y|},
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1010
            certC (pan C) cardSK X onlySig (priSK (CA i)),
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1011
            cert (CA i) (pubSK (CA i)) onlySig (priSK RCA)|})
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1012
          \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1013
        Says (CA i) C' (Crypt KC2'
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1014
          {|sign (priSK (CA i)) {|Agent C', Nonce NC3', Agent (CA i), Nonce Y'|},
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1015
            certC (pan C') cardSK X' onlySig (priSK (CA i)),
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1016
            cert (CA i) (pubSK (CA i)) onlySig (priSK RCA)|})
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1017
          \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1018
        evs \<in> set_cr |] ==> C=C' & NC3=NC3' & X=X' & KC2=KC2' & Y=Y'"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1019
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1020
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1021
apply (erule set_cr.induct)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1022
apply (simp_all (no_asm_simp))
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1023
apply (blast dest!: CR6_Says_imp_Notes)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1024
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1025
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1026
14218
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
  1027
(*<*)
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1028
text{*UNUSED unicity result*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1029
lemma unique_KC1:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1030
     "[|Says C B {|Crypt KC1 X, Crypt EK {|Key KC1, Y|}|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1031
          \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1032
        Says C B' {|Crypt KC1 X', Crypt EK' {|Key KC1, Y'|}|}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1033
          \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1034
        C \<notin> bad;  evs \<in> set_cr|] ==> B'=B & Y'=Y"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1035
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1036
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1037
apply (erule set_cr.induct, auto)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1038
done
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1039
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1040
text{*UNUSED unicity result*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1041
lemma unique_KC2:
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1042
     "[|Says C B {|Crypt K {|Agent C, nn, Key KC2, X|}, Y|} \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1043
        Says C B' {|Crypt K' {|Agent C, nn', Key KC2, X'|}, Y'|} \<in> set evs;
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1044
        C \<notin> bad;  evs \<in> set_cr|] ==> B'=B & X'=X"
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1045
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1046
apply (erule rev_mp)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1047
apply (erule set_cr.induct, auto)
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1048
done
14218
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
  1049
(*>*)
db95d1c2f51b removal of junk and improvement of the document
paulson
parents: 14206
diff changeset
  1050
14199
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1051
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1052
text{*Cannot show cardSK to be secret because it isn't assumed to be fresh
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1053
  it could be a previously compromised cardSK [e.g. involving a bad CA]*}
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1054
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1055
d3b8d972a488 new session HOL-SET-Protocol
paulson
parents:
diff changeset
  1056
end