src/HOL/Auth/Yahalom2.thy
author paulson
Thu, 19 Dec 1996 11:58:39 +0100
changeset 2451 ce85a2aafc7a
parent 2378 fc103154ad8f
child 2516 4d68fbe6378b
permissions -rw-r--r--
Extensive tidying and simplification, largely stemming from changing newN and newK to take an integer argument
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
     1
(*  Title:      HOL/Auth/Yahalom
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
     2
    ID:         $Id$
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
     4
    Copyright   1996  University of Cambridge
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
     5
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
     6
Inductive relation "yahalom" for the Yahalom protocol, Variant 2.
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
     7
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
     8
This version trades encryption of NB for additional explicitness in YM3.
2155
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
     9
It also omits encryption in YM2.  The resulting protocol no longer guarantees
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
    10
that the other agent is present.
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    11
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    12
From page 259 of
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    13
  Burrows, Abadi and Needham.  A Logic of Authentication.
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    14
  Proc. Royal Soc. 426 (1989)
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    15
*)
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    16
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    17
Yahalom2 = Shared + 
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    18
2378
fc103154ad8f Removed needless quotation marks
paulson
parents: 2284
diff changeset
    19
consts  yahalom   :: agent set => event list set
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    20
inductive "yahalom lost"
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    21
  intrs 
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    22
         (*Initial trace is empty*)
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    23
    Nil  "[]: yahalom lost"
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    24
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    25
         (*The spy MAY say anything he CAN say.  We do not expect him to
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    26
           invent new nonces here, but he can also use NS1.  Common to
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    27
           all similar protocols.*)
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    28
    Fake "[| evs: yahalom lost;  B ~= Spy;  
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    29
             X: synth (analz (sees lost Spy evs)) |]
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    30
          ==> Says Spy B X  # evs : yahalom lost"
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    31
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    32
         (*Alice initiates a protocol run*)
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    33
    YM1  "[| evs: yahalom lost;  A ~= B |]
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2378
diff changeset
    34
          ==> Says A B {|Agent A, Nonce (newN(length evs))|} # evs : yahalom lost"
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    35
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    36
         (*Bob's response to Alice's message.  Bob doesn't know who 
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    37
	   the sender is, hence the A' in the sender field.*)
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    38
    YM2  "[| evs: yahalom lost;  B ~= Server;
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    39
             Says A' B {|Agent A, Nonce NA|} : set_of_list evs |]
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2378
diff changeset
    40
          ==> Says B Server {|Agent A, Agent B, Nonce NA, Nonce (newN(length evs))|}
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    41
                 # evs : yahalom lost"
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    42
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    43
         (*The Server receives Bob's message.  He responds by sending a
2155
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
    44
           new session key to Alice, with a packet for forwarding to Bob.
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
    45
           Fields are reversed in the 2nd packet to prevent attacks.*)
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
    46
    YM3  "[| evs: yahalom lost;  A ~= B;  A ~= Server;
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
    47
             Says B' Server {|Agent A, Agent B, Nonce NA, Nonce NB|}
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    48
               : set_of_list evs |]
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    49
          ==> Says Server A
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    50
               {|Nonce NB, 
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2378
diff changeset
    51
                 Crypt (shrK A) {|Agent B, Key (newK(length evs)), Nonce NA|},
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2378
diff changeset
    52
                 Crypt (shrK B) {|Nonce NB, Key (newK(length evs)), Agent A|}|}
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    53
                 # evs : yahalom lost"
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    54
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    55
         (*Alice receives the Server's (?) message, checks her Nonce, and
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    56
           uses the new session key to send Bob his Nonce.*)
2155
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
    57
    YM4  "[| evs: yahalom lost;  A ~= Server;  A ~= B;  
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2155
diff changeset
    58
             Says S A {|Nonce NB, Crypt (shrK A) {|Agent B, Key K, Nonce NA|},
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    59
                        X|}
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    60
               : set_of_list evs;
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    61
             Says A B {|Agent A, Nonce NA|} : set_of_list evs |]
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2155
diff changeset
    62
          ==> Says A B {|X, Crypt K (Nonce NB)|} # evs : yahalom lost"
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    63
2155
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
    64
         (*This message models possible leaks of session keys.  The nonces
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
    65
           identify the protocol run.  Quoting Server here ensures they are
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
    66
           correct. *)
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
    67
    Oops "[| evs: yahalom lost;  A ~= Spy;
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
    68
             Says Server A {|Nonce NB, 
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2155
diff changeset
    69
                             Crypt (shrK A) {|Agent B, Key K, Nonce NA|},
2155
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
    70
                             X|}  : set_of_list evs |]
dc85854810eb New version with simpler disambiguation in YM3,
paulson
parents: 2111
diff changeset
    71
          ==> Says A Spy {|Nonce NA, Nonce NB, Key K|} # evs : yahalom lost"
2111
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    72
81c8d46edfa3 New version of Yahalom, as recommended on p 259 of BAN paper
paulson
parents:
diff changeset
    73
end