summaryrefslogtreecommitdiff
path: root/man/2/keyring-0intro
blob: 5e28b068ea0224991f07d3bfec7aafcd23e9b6c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
.TH KEYRING-INTRO 2
.SH NAME
Keyring intro \- introduction to the
.B Keyring
module
.SH SYNOPSIS
.EX
include "keyring.m";
keyring := load Keyring Keyring->PATH;

SigAlg: adt
{
    name:   string;
};

PK: adt
{
    sa:     ref SigAlg;
    owner:  string;
};

SK: adt
{
    sa:     ref SigAlg;
    owner:  string;
};

Certificate: adt
{
    sa:     ref SigAlg;
    ha:     string;
    signer: string;
    exp:    int;
};

DigestState: adt
{
    # hidden state
    copy:   fn(d: self ref DigestState): ref DigestState;
};

Authinfo: adt
{
    mysk:   ref SK;
    mypk:   ref PK;
    cert:   ref Certificate;
    spk:    ref PK;
    alpha:  ref IPint;
    p:      ref IPint;
};
.EE
.SH DESCRIPTION
This module contains a mixed set of functions that variously:
.IP \(bu
perform infinite precision modular arithmetic; see
.IR keyring-ipint (2)
.IP \(bu
form cryptographically secure digests; see
.IR keyring-sha1 (2)
.IP \(bu
generate public/private key pairs and transform them
to and from textual form; see
.IR keyring-gensk (2)
and
.IR keyring-certtostr (2)
.IP \(bu
encrypt data, using AES, DES, or IDEA; see
.IR keyring-crypt (2)
.IP \(bu
create and verify cryptographic signatures using the
public keys; see
.IR keyring-auth (2)
.IP \(bu
authenticate the parties on a connection; see
.IR keyring-auth (2)
.IP \(bu
read and write files containing the information
needed to authenticate the parties on a connection; see
.IR keyring-auth (2)
.IP \(bu
send Limbo byte arrays and strings across a connection; see
.IR keyring-getstring (2)
.PP
Each collection is discussed in turn.
.SS "Large Precision Arithmetic"
The
.B IPint
adt
is provided to allow some cryptographic functions to
be implemented in Limbo.
.B IPint
stands for infinite precision integer, though, for
space considerations, our
implementation limits the maximum integer to
2\u\s-2\&8192\s0\d-1.
.PP
An
.B IPint
can be converted into two external formats.
The first is
an array of bytes in which the first byte is the highest order
byte of the integer.  This format is useful when
communicating with the
.IR ssl (3)
device.
The second is a MIME base 64 format, that
allows
.BR IPint s
to be stored in files or transmitted across
networks in a human readable form.
.SS "Public Key Cryptography"
Public key cryptography has many uses.
Inferno relies on it only for digital signatures.
Each Inferno user may generate a
pair of matched keys, one public and
one private.
The private key may be used to digitally
sign data, the public one to verify the signature.
Public key algorithms have been chosen to
make it difficult to spoof a signature or guess
the private key.
.PP
For public keys algorithms to work, there must be a way to
distribute the public keys:
in order to verify that
.B X
signed something, we must know
.BR X 's
public key.
To simplify the problem, we have instituted a
trust hierarchy that requires people to
know only the public keys of certifying authorities (CAs).
After generating a public key, one can have the
concatenation of one's name, expiration date, and key
signed by a CA.
The information together with the name of the CA
and the signature is called a
.IR certificate .
.PP
At the beginning of a conversation, the parties
exchange certificates.
They then use the CA's public key to verify each
other's public keys.
The CA's public key, a system wide Diffie-Hellman
base and modulus, one's private key, one's
public key and certificate are kept in
a Limbo adt called
.BR Keyring->Authinfo .
An
.B Authinfo
adt can be read from from a file using
.B readauthinfo
or written to a file
using
.BR writeauthinfo ,
both from
.IR keyring-auth (2).
.PP
.B Authinfo
adts are normally created during the login and
registration procedures described below.
.SS "Authentication"
Two parties conversing on a network connection can
authenticate each other's identity using the functions in
.IR keyring-auth (2).
They use the
.B Keyring->Authinfo
information to run the Station to Station (STS)
authentication protocol.
STS not only authenticates each party's identity to the other but also
establishes a random bit string known
only to the two parties.
This bit string can be used
as a key to encrypt or authenticate subsequent messages
sent between the two parties.
.SS "Secure Communications"
After exchanging secrets, communicating
parties may encode the conversation to
guarantee varying levels of security:
.IP •
none
.IP •
messages cannot be forged
.IP •
messages cannot be intercepted
.LP
Encoding uses the line formats
provided by the Secure Sockets Layer.
See
.IR security-intro (2)
for more detail.
.SS "Login and registration"
The Inferno authentication procedure
requires that both parties possess an
.B Authinfo
adt containing
a locally generated public/private key pair,
the public key of a commonly trusted CA,
and a signed certificate from the CA that links
the party's identity and public key.
This
.B Authinfo
adt is normally kept in a file.
At some point, however, it must be created, and later
conveyed securely between the user's machine
and the CA.
There are two ways to do this, the login procedure
and the registration procedure.
Both require an out of band channel between the
CA and the user.
.PP
The login procedures are used by typed
commands and by programs using Tk.
The login procedure relies on the CA and
the user having established a common secret
or password.
This is done securely off line, perhaps by mail or telephone.
This secret is then used to provide a secure
path between CA and user machine to transfer
the certificate and CA public key.
See
.IR security-intro (2)
for more detail.
.PP
The registration procedure is built into the
.IR mux (1)
interface and is intended for the set top box
environment.
When the set top box is first turned on, it
creates a public/private key pair and
dials the service provider's CA to get a key
signed.
The CA returns its public key and a signed
certificate, blinded by a random bit string
known only to the CA.
A hash of the information is then displayed on the
user screen.
The user must then telephone the CA and compare this
hashed foot print with the one at the CA.
If they match and the user proves that he is
a customer, the CA makes the blinding string
publicly known.
.SS Data Types
.TP
.B SigAlg
The
.B SigAlg
adt contains a single string that specifies the algorithm used for digital signatures.
The allowable values are
.BR md5 ,
.BR md4
and
.BR sha1
that specify which one-way hash function is used to produce a digital signature
or message digest.
.TP
.BR PK " and " SK
The
.B PK
adt contains the data necessary to construct a public key;
the
.B SK
adt contains the data necessary to construct a secret key.
Both keys are built from the combination of a specified signature algorithm
and a string representing the name of the owner of the key.
.TP
.B Certificate
The
.B Certificate
adt contains a digital signature with the certification of the trusted authority (CA).
.TP
.B DigestState
The
.B DigestState
adt contains the hidden state of partially completed hash functions during processing.
Its
.B copy
operation returns a reference to a copy of a given state.
.TP
.B Authinfo
The
.B Authinfo
adt contains an individual user's private and public key, the signer's certificate
and the signer's public key, and the Diffie-Hellman parameters.
.SH SOURCE
.B /libcrypt/*.c
.br
.B /libinterp/keyring.c
.br
.B /libkeyring/*.c
.SH SEE ALSO
.IR security-intro (2)
.br
B. Schneier,
.IR "Applied Cryptography" ,
1996, J. Wiley & Sons, Inc.