author | nipkow |
Tue, 09 Jan 2001 15:29:17 +0100 | |
changeset 10833 | c0844a30ea4e |
parent 9686 | 87b460d72e80 |
child 11189 | 1ea763a5d186 |
permissions | -rw-r--r-- |
1839 | 1 |
(* Title: HOL/Auth/Message |
2 |
ID: $Id$ |
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
|
4 |
Copyright 1996 University of Cambridge |
|
5 |
||
6 |
Datatypes of agents and messages; |
|
1913 | 7 |
Inductive relations "parts", "analz" and "synth" |
1839 | 8 |
*) |
9 |
||
5652 | 10 |
Message = Main + |
1839 | 11 |
|
12 |
types |
|
13 |
key = nat |
|
14 |
||
15 |
consts |
|
16 |
invKey :: key=>key |
|
17 |
||
18 |
rules |
|
19 |
invKey "invKey (invKey K) = K" |
|
20 |
||
21 |
(*The inverse of a symmetric key is itself; |
|
22 |
that of a public key is the private key and vice versa*) |
|
23 |
||
24 |
constdefs |
|
25 |
isSymKey :: key=>bool |
|
26 |
"isSymKey K == (invKey K = K)" |
|
27 |
||
28 |
datatype (*We allow any number of friendly agents*) |
|
2032 | 29 |
agent = Server | Friend nat | Spy |
1839 | 30 |
|
3668 | 31 |
datatype |
7057
b9ddbb925939
tweaked proofs to handle new freeness reasoning for data c onstructors
paulson
parents:
6807
diff
changeset
|
32 |
msg = Agent agent (*Agent names*) |
b9ddbb925939
tweaked proofs to handle new freeness reasoning for data c onstructors
paulson
parents:
6807
diff
changeset
|
33 |
| Number nat (*Ordinary integers, timestamps, ...*) |
b9ddbb925939
tweaked proofs to handle new freeness reasoning for data c onstructors
paulson
parents:
6807
diff
changeset
|
34 |
| Nonce nat (*Unguessable nonces*) |
b9ddbb925939
tweaked proofs to handle new freeness reasoning for data c onstructors
paulson
parents:
6807
diff
changeset
|
35 |
| Key key (*Crypto keys*) |
5234 | 36 |
| Hash msg (*Hashing*) |
37 |
| MPair msg msg (*Compound messages*) |
|
38 |
| Crypt key msg (*Encryption, public- or shared-key*) |
|
1839 | 39 |
|
5234 | 40 |
|
41 |
(*Concrete syntax: messages appear as {|A,B,NA|}, etc...*) |
|
42 |
syntax |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
43 |
"@MTuple" :: "['a, args] => 'a * 'b" ("(2{|_,/ _|})") |
1839 | 44 |
|
9686 | 45 |
syntax (xsymbols) |
46 |
"@MTuple" :: "['a, args] => 'a * 'b" ("(2\\<lbrace>_,/ _\\<rbrace>)") |
|
47 |
||
1839 | 48 |
translations |
49 |
"{|x, y, z|}" == "{|x, {|y, z|}|}" |
|
50 |
"{|x, y|}" == "MPair x y" |
|
51 |
||
52 |
||
2484 | 53 |
constdefs |
54 |
(*Message Y, paired with a MAC computed with the help of X*) |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
55 |
HPair :: "[msg,msg]=>msg" ("(4Hash[_] /_)" [0, 1000]) |
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
56 |
"Hash[X] Y == {| Hash{|X,Y|}, Y|}" |
2484 | 57 |
|
58 |
(*Keys useful to decrypt elements of a message set*) |
|
1839 | 59 |
keysFor :: msg set => key set |
10833 | 60 |
"keysFor H == invKey ` {K. EX X. Crypt K X : H}" |
1839 | 61 |
|
62 |
(** Inductive definition of all "parts" of a message. **) |
|
63 |
||
64 |
consts parts :: msg set => msg set |
|
65 |
inductive "parts H" |
|
66 |
intrs |
|
2373 | 67 |
Inj "X: H ==> X: parts H" |
68 |
Fst "{|X,Y|} : parts H ==> X : parts H" |
|
69 |
Snd "{|X,Y|} : parts H ==> Y : parts H" |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2121
diff
changeset
|
70 |
Body "Crypt K X : parts H ==> X : parts H" |
1839 | 71 |
|
72 |
||
1913 | 73 |
(** Inductive definition of "analz" -- what can be broken down from a set of |
1839 | 74 |
messages, including keys. A form of downward closure. Pairs can |
75 |
be taken apart; messages decrypted with known keys. **) |
|
76 |
||
1913 | 77 |
consts analz :: msg set => msg set |
78 |
inductive "analz H" |
|
1839 | 79 |
intrs |
1913 | 80 |
Inj "X: H ==> X: analz H" |
81 |
Fst "{|X,Y|} : analz H ==> X : analz H" |
|
82 |
Snd "{|X,Y|} : analz H ==> Y : analz H" |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2121
diff
changeset
|
83 |
Decrypt "[| Crypt K X : analz H; Key(invKey K): analz H |] ==> X : analz H" |
1839 | 84 |
|
85 |
||
1913 | 86 |
(** Inductive definition of "synth" -- what can be built up from a set of |
1839 | 87 |
messages. A form of upward closure. Pairs can be built, messages |
3668 | 88 |
encrypted with known keys. Agent names are public domain. |
89 |
Numbers can be guessed, but Nonces cannot be. **) |
|
1839 | 90 |
|
1913 | 91 |
consts synth :: msg set => msg set |
92 |
inductive "synth H" |
|
1839 | 93 |
intrs |
1913 | 94 |
Inj "X: H ==> X: synth H" |
95 |
Agent "Agent agt : synth H" |
|
3668 | 96 |
Number "Number n : synth H" |
2373 | 97 |
Hash "X: synth H ==> Hash X : synth H" |
1913 | 98 |
MPair "[| X: synth H; Y: synth H |] ==> {|X,Y|} : synth H" |
2373 | 99 |
Crypt "[| X: synth H; Key(K) : H |] ==> Crypt K X : synth H" |
1839 | 100 |
|
101 |
end |