3 SSL 2.0 PROTOCOL SPECIFICATION
5 If you have questions about this protocol specification, please ask them in
6 Netscape's newsgroup for SSL developers, netscape.dev.ssl. More information
7 about the netscape.dev.ssl newsgroup may be found at this URL:
8 http://home.netscape.com/eng/ssl3/ssl-talk.html
9 ------------------------------------------------------------------------
11 THIS PROTOCOL SPECIFICATION WAS REVISED ON NOVEMBER 29TH, 1994:
13 * a fundamental correction to the client-certificate authentication
15 * the removal of the username/password messages,
16 * corrections in some of the cryptographic terminology,
17 * the addition of a MAC to the messages [see section 1.2],
18 * the allowance for different kinds of message digest algorithms.
20 THIS DOCUMENT WAS REVISED ON DECEMBER 22ND, 1994:
22 * The spec now defines the order the clear key data and secret key data
23 are combined to produce the master key.
24 * The spec now explicitly states the size of the MAC instead of making
25 the reader figure it out.
26 * The spec is more clear on the actual values used to produce the session
28 * The spec is more clear on how many bits of the session key are used
29 after they are produced from the hash function.
31 THIS DOCUMENT WAS REVISED ON JANUARY 17TH, 1995:
33 * Defined the category to be informational.
34 * Clarified ordering of data elements in various places.
35 * Defined DES-CBC cipher kind and key construction.
36 * Defined DES-EDE3-CBC cipher kind and key construction.
38 THIS DOCUMENT WAS REVISED ON JANUARY 24TH, 1995:
40 * Fixed bug in definition of CIPHER-CHOICE in CLIENT-MASTER-KEY message.
41 The previous spec erroneously indicated that the CIPHER-CHOICE was an
42 index into the servers CIPHER-SPECS-DATA array, when it was actually
43 supposed to be the CIPHER-KIND value chosen by the client.
44 * Clarified the values of the KEY-ARG-DATA.
46 THIS DOCUMENT WAS REVISED ON FEBRUARY 9TH, 1995:
48 The spec has been clarified to indicate the byte order of sequence
49 numbers when they are being applied to the MAC hash function.
50 * The spec now defines the acceptable length range of the CONNECTION-ID
51 parameter (sent by the server in the SERVER-HELLO message).
52 * Simplified the specification of the CIPHER-KIND data. The spec language
53 has been changed yet the format remains compatible with all existing
54 implementations. The CIPHER-KIND information is now a three byte value
55 which defines the type of cipher and the length of the key. The key
56 length is no longer separable from the CIPHER-KIND.
57 * Explained how the KEY-ARG-DATA is retained with the SESSION-ID when the
58 session-identifier cache is used.
60 ------------------------------------------------------------------------
62 Experimental Kipp E.B. Hickman
63 Request For Comments: XXXX Netscape Communications Corp.
64 Category: Informational Last Update: Feb. 9th, 1995
70 This is a DRAFT specification.
72 This RFC specifies a security protocol for the Internet community, and
73 requests discussion and suggestions for improvements. Distribution of
74 this memo is unlimited.
78 This document specifies the Secure Sockets Layer (SSL) protocol, a
79 security protocol that provides privacy over the Internet. The protocol
80 allows client/server applications to communicate in a way that cannot
81 be eavesdropped. Server's are always authenticated and clients are
82 optionally authenticated.
86 The SSL Protocol is designed to provide privacy between two
87 communicating applications (a client and a server). Second, the
88 protocol is designed to authenticate the server, and optionally the
89 client. SSL requires a reliable transport protocol (e.g. TCP) for data
90 transmission and reception.
92 The advantage of the SSL Protocol is that it is application protocol
93 independent. A "higher level" application protocol (e.g. HTTP, FTP,
94 TELNET, etc.) can layer on top of the SSL Protocol transparently. The
95 SSL Protocol can negotiate an encryption algorithm and session key as
96 well as authenticate a server before the application protocol transmits
97 or receives its first byte of data. All of the application protocol
98 data is transmitted encrypted, ensuring privacy.
100 The SSL protocol provides "channel security" which has three basic
103 * The channel is private. Encryption is used for all messages after
104 a simple handshake is used to define a secret key.
106 * The channel is authenticated. The server endpoint of the
107 conversation is always authenticated, while the client endpoint is
108 optionally authenticated.
110 * The channel is reliable. The message transport includes a message
111 integrity check (using a MAC).
113 1. SSL Record Protocol Specification
115 1.1 SSL Record Header Format
117 In SSL, all data sent is encapsulated in a record, an object which is
118 composed of a header and some non-zero amount of data. Each record
119 header contains a two or three byte length code. If the most
120 significant bit is set in the first byte of the record length code then
121 the record has no padding and the total header length will be 2 bytes,
122 otherwise the record has padding and the total header length will be 3
123 bytes. The record header is transmitted before the data portion of the
126 Note that in the long header case (3 bytes total), the second most
127 significant bit in the first byte has special meaning. When zero, the
128 record being sent is a data record. When one, the record being sent is
129 a security escape (there are currently no examples of security escapes;
130 this is reserved for future versions of the protocol). In either case,
131 the length code describes how much data is in the record.
133 The record length code does not include the number of bytes consumed by
134 the record header (2 or 3). For the 2 byte header, the record length is
135 computed by (using a "C"-like notation):
137 RECORD-LENGTH = ((byte[0] & 0x7f) << 8)) | byte[1];
139 Where byte[0] represents the first byte received and byte[1] the second
140 byte received. When the 3 byte header is used, the record length is
141 computed as follows (using a "C"-like notation):
143 RECORD-LENGTH = ((byte[0] & 0x3f) << 8)) | byte[1];
144 IS-ESCAPE = (byte[0] & 0x40) != 0;
147 The record header defines a value called PADDING. The PADDING value
148 specifies how many bytes of data were appended to the original record
149 by the sender. The padding data is used to make the record length be a
150 multiple of the block ciphers block size when a block cipher is used
153 The sender of a "padded" record appends the padding data to the end of
154 its normal data and then encrypts the total amount (which is now a
155 multiple of the block cipher's block size). The actual value of the
156 padding data is unimportant, but the encrypted form of it must be
157 transmitted for the receiver to properly decrypt the record. Once the
158 total amount being transmitted is known the header can be properly
159 constructed with the PADDING value set appropriately.
161 The receiver of a padded record decrypts the entire record data (sans
162 record length and the optional padding) to get the clear data, then
163 subtracts the PADDING value from the RECORD-LENGTH to determine the
164 final RECORD-LENGTH. The clear form of the padding data must be
167 1.2 SSL Record Data Format
169 The data portion of an SSL record is composed of three components
170 (transmitted and received in the order shown):
174 PADDING-DATA[PADDING]
176 ACTUAL-DATA is the actual data being transmitted (the message payload).
177 PADDING-DATA is the padding data sent when a block cipher is used and
178 padding is needed. Finally, MAC-DATA is the Message Authentication
181 When SSL records are sent in the clear, no cipher is used. Consequently
182 the amount of PADDING-DATA will be zero and the amount of MAC-DATA will
183 be zero. When encryption is in effect, the PADDING-DATA will be a
184 function of the cipher block size. The MAC-DATA is a function of the
185 CIPHER-CHOICE (more about that later).
187 The MAC-DATA is computed as follows:
189 MAC-DATA = HASH[ SECRET, ACTUAL-DATA, PADDING-DATA, SEQUENCE-NUMBER ]
191 Where the SECRET data is fed to the hash function first, followed by
192 the ACTUAL-DATA, which is followed by the PADDING-DATA which is finally
193 followed by the SEQUENCE-NUMBER. The SEQUENCE-NUMBER is a 32 bit value
194 which is presented to the hash function as four bytes, with the first
195 byte being the most significant byte of the sequence number, the second
196 byte being the next most significant byte of the sequence number, the
197 third byte being the third most significant byte, and the fourth byte
198 being the least significant byte (that is, in network byte order or
201 MAC-SIZE is a function of the digest algorithm being used. For MD2 and
202 MD5 the MAC-SIZE will be 16 bytes (128 bits).
204 The SECRET value is a function of which party is sending the message.
205 If the client is sending the message then the SECRET is the
206 CLIENT-WRITE-KEY (the server will use the SERVER-READ-KEY to verify the
207 MAC). If the client is receiving the message then the SECRET is the
208 CLIENT-READ-KEY (the server will use the SERVER-WRITE-KEY to generate
211 The SEQUENCE-NUMBER is a counter which is incremented by both the
212 sender and the receiver. For each transmission direction, a pair of
213 counters is kept (one by the sender, one by the receiver). Every time a
214 message is sent by a sender the counter is incremented. Sequence
215 numbers are 32 bit unsigned quantities and must wrap to zero after
216 incrementing past 0xFFFFFFFF.
218 The receiver of a message uses the expected value of the sequence
219 number as input into the MAC HASH function (the HASH function is chosen
220 from the CIPHER-CHOICE). The computed MAC-DATA must agree bit for bit
221 with the transmitted MAC-DATA. If the comparison is not identity then
222 the record is considered damaged, and it is to be treated as if an "I/O
223 Error" had occurred (i.e. an unrecoverable error is asserted and the
224 connection is closed).
226 A final consistency check is done when a block cipher is used and the
227 protocol is using encryption. The amount of data present in a record
228 (RECORD-LENGTH))must be a multiple of the cipher's block size. If the
229 received record is not a multiple of the cipher's block size then the
230 record is considered damaged, and it is to be treated as if an "I/O
231 Error" had occurred (i.e. an unrecoverable error is asserted and the
232 connection is closed).
234 The SSL Record Layer is used for all SSL communications, including
235 handshake messages, security escapes and application data transfers.
236 The SSL Record Layer is used by both the client and the server at all
239 For a two byte header, the maximum record length is 32767 bytes. For
240 the three byte header, the maximum record length is 16383 bytes. The
241 SSL Handshake Protocol messages are constrained to fit in a single SSL
242 Record Protocol record. Application protocol messages are allowed to
243 consume multiple SSL Record Protocol record's.
245 Before the first record is sent using SSL all sequence numbers are
246 initialized to zero. The transmit sequence number is incremented after
247 every message sent, starting with the CLIENT-HELLO and SERVER-HELLO
250 2. SSL Handshake Protocol Specification
252 2.1 SSL Handshake Protocol Flow
254 The SSL Handshake Protocol has two major phases. The first phase
255 is used to establish private communications. The second phase is
256 used for client authentication.
260 The first phase is the initial connection phase where both parties
261 communicate their "hello" messages. The client initiates the
262 conversation by sending the CLIENT-HELLO message. The server
263 receives the CLIENT-HELLO message and processes it responding with
264 the SERVER-HELLO message.
266 At this point both the client and server have enough information
267 to know whether or not a new master key is needed. When a new
268 master key is not needed, both the client and the server proceed
269 immediately to phase 2.
271 When a new master key is needed, the SERVER-HELLO message will
272 contain enough information for the client to generate it. This
273 includes the server's signed certificate (more about that later),
274 a list of bulk cipher specifications (see below), and a
275 connection-id (a connection-id is a randomly generated value
276 generated by the server that is used by the client and server
277 during a single connection). The client generates the master key
278 and responds with a CLIENT-MASTER-KEY message (or an ERROR message
279 if the server information indicates that the client and server
280 cannot agree on a bulk cipher).
282 It should be noted here that each SSL endpoint uses a pair of
283 ciphers per connection (for a total of four ciphers). At each
284 endpoint, one cipher is used for outgoing communications, and one
285 is used for incoming communications. When the client or server
286 generate a session key, they actually generate two keys, the
287 SERVER-READ-KEY (also known as the CLIENT-WRITE-KEY) and the
288 SERVER-WRITE-KEY (also known as the CLIENT-READ-KEY). The master
289 key is used by the client and server to generate the various
290 session keys (more about that later).
292 Finally, the server sends a SERVER-VERIFY message to the client
293 after the master key has been determined. This final step
294 authenticates the server, because only a server which has the
295 appropriate public key can know the master key.
299 The second phase is the authentication phase. The server has
300 already been authenticated by the client in the first phase, so
301 this phase is primarily used to authenticate the client. In a
302 typical scenario, the server will require something from the
303 client and send a request. The client will answer in the positive
304 if it has the needed information, or send an ERROR message if it
305 does not. This protocol specification does not define the
306 semantics of an ERROR response to a server request (e.g., an
307 implementation can ignore the error, close the connection, etc.
308 and still conform to this specification).
310 When a party is done authenticating the other party, it sends its
311 finished message. For the client, the CLIENT-FINISHED message
312 contains the encrypted form of the CONNECTION-ID for the server to
313 verify. If the verification fails, the server sends an ERROR
316 Once a party has sent its finished message it must continue to
317 listen to its peers messages until it too receives a finished
318 message. Once a party has both sent a finished message and
319 received its peers finished message, the SSL handshake protocol is
320 done. At this point the application protocol begins to operate
321 (Note: the application protocol continues to be layered on the SSL
324 2.2 Typical Protocol Message Flow
326 The following sequences define several typical protocol message
327 flows for the SSL Handshake Protocol. In these examples we have
328 two principals in the conversation: the client and the server. We
329 use a notation commonly found in the literature [10]. When
330 something is enclosed in curly braces "{something}key" then the
331 something has been encrypted using "key".
333 2.2.1 Assuming no session-identifier
335 client-hello C -> S: challenge, cipher_specs
336 server-hello S -> C: connection-id,server_certificate,cipher_specs
337 client-master-key C -> S: {master_key}server_public_key
338 client-finish C -> S: {connection-id}client_write_key
339 server-verify S -> C: {challenge}server_write_key
340 server-finish S -> C: {new_session_id}server_write_key
342 2.2.2 Assuming a session-identifier was found by both client &
345 client-hello C -> S: challenge, session_id, cipher_specs
346 server-hello S -> C: connection-id, session_id_hit
347 client-finish C -> S: {connection-id}client_write_key
348 server-verify S -> C: {challenge}server_write_key
349 server-finish S -> C: {session_id}server_write_key
351 2.2.3 Assuming a session-identifier was used and client
352 authentication is used
354 client-hello C -> S: challenge, session_id, cipher_specs
355 server-hello S -> C: connection-id, session_id_hit
356 client-finish C -> S: {connection-id}client_write_key
357 server-verify S -> C: {challenge}server_write_key
358 request-certificate S -> C: {auth_type,challenge'}server_write_key
359 client-certificate C -> S: {cert_type,client_cert,
360 response_data}client_write_key
361 server-finish S -> C: {session_id}server_write_key
363 In this last exchange, the response_data is a function of the
368 Error handling in the SSL connection protocol is very simple. When
369 an error is detected, the detecting party sends a message to the
370 other party. Errors that are not recoverable cause the client and
371 server to abort the secure connection. Servers and client are
372 required to "forget" any session-identifiers associated with a
375 The SSL Handshake Protocol defines the following errors:
378 This error is returned by the client to the server when it
379 cannot find a cipher or key size that it supports that is
380 also supported by the server. This error is not recoverable.
383 When a REQUEST-CERTIFICATE message is sent, this error may be
384 returned if the client has no certificate to reply with. This
385 error is recoverable (for client authentication only).
387 BAD-CERTIFICATE-ERROR
388 This error is returned when a certificate is deemed bad by
389 the receiving party. Bad means that either the signature of
390 the certificate was bad or that the values in the certificate
391 were inappropriate (e.g. a name in the certificate did not
392 match the expected name). This error is recoverable (for
393 client authentication only).
395 UNSUPPORTED-CERTIFICATE-TYPE-ERROR
396 This error is returned when a client/server receives a
397 certificate type that it can't support. This error is
398 recoverable (for client authentication only).
400 2.4 SSL Handshake Protocol Messages
402 The SSL Handshake Protocol messages are encapsulated in the SSL
403 Record Protocol and are composed of two parts: a single byte
404 message type code, and some data. The client and server exchange
405 messages until both ends have sent their "finished" message,
406 indicating that they are satisfied with the SSL Handshake Protocol
407 conversation. While one end may be finished, the other may not,
408 therefore the finished end must continue to receive SSL Handshake
409 Protocol messages until it too receives a "finished" message.
411 After the pair of session keys has been determined by each party,
412 the message bodies are encrypted using it. For the client, this
413 happens after it verifies the session-identifier or creates a new
414 session key and has sent it to the server. For the server, this
415 happens after the session-identifier is found to be good, or the
416 server receives the client's session key message.
418 The following notation is used for SSLHP messages:
425 char THING-DATA[(MSB<<8)|LSB];
428 This notation defines the data in the protocol message, including
429 the message type code. The order is presented top to bottom, with
430 the top most element being transmitted first, and the bottom most
431 element transferred last.
433 For the "THING-DATA" entry, the MSB and LSB values are actually
434 THING-MSB and THING-LSB (respectively) and define the number of
435 bytes of data actually present in the message. For example, if
436 THING-MSB were zero and THING-LSB were 8 then the THING-DATA array
437 would be exactly 8 bytes long. This shorthand is used below.
439 Length codes are unsigned values, and when the MSB and LSB are
440 combined the result is an unsigned value. Unless otherwise
441 specified lengths values are "length in bytes".
443 2.5 Client Only Protocol Messages
445 There are several messages that are only generated by clients.
446 These messages are never generated by correctly functioning
447 servers. A client receiving such a message closes the connection
448 to the server and returns an error status to the application
449 through some unspecified mechanism.
451 CLIENT-HELLO (Phase 1; Sent in the clear)
453 char MSG-CLIENT-HELLO
454 char CLIENT-VERSION-MSB
455 char CLIENT-VERSION-LSB
456 char CIPHER-SPECS-LENGTH-MSB
457 char CIPHER-SPECS-LENGTH-LSB
458 char SESSION-ID-LENGTH-MSB
459 char SESSION-ID-LENGTH-LSB
460 char CHALLENGE-LENGTH-MSB
461 char CHALLENGE-LENGTH-LSB
462 char CIPHER-SPECS-DATA[(MSB<<8)|LSB]
463 char SESSION-ID-DATA[(MSB<<8)|LSB]
464 char CHALLENGE-DATA[(MSB<<8)|LSB]
466 When a client first connects to a server it is required to send
467 the CLIENT-HELLO message. The server is expecting this message
468 from the client as its first message. It is an error for a client
469 to send anything else as its first message.
471 The client sends to the server its SSL version, its cipher specs
472 (see below), some challenge data, and the session-identifier data.
473 The session-identifier data is only sent if the client found a
474 session-identifier in its cache for the server, and the
475 SESSION-ID-LENGTH will be non-zero. When there is no
476 session-identifier for the server SESSION-ID-LENGTH must be zero.
477 The challenge data is used to authenticate the server. After the
478 client and server agree on a pair of session keys, the server
479 returns a SERVER-VERIFY message with the encrypted form of the
482 Also note that the server will not send its SERVER-HELLO message
483 until it has received the CLIENT-HELLO message. This is done so
484 that the server can indicate the status of the client's
485 session-identifier back to the client in the server's first
486 message (i.e. to increase protocol efficiency and reduce the
487 number of round trips required).
489 The server examines the CLIENT-HELLO message and will verify that
490 it can support the client version and one of the client cipher
491 specs. The server can optionally edit the cipher specs, removing
492 any entries it doesn't choose to support. The edited version will
493 be returned in the SERVER-HELLO message if the session-identifier
494 is not in the server's cache.
496 The CIPHER-SPECS-LENGTH must be greater than zero and a multiple
497 of 3. The SESSION-ID-LENGTH must either be zero or 16. The
498 CHALLENGE-LENGTH must be greater than or equal to 16 and less than
501 This message must be the first message sent by the client to the
502 server. After the message is sent the client waits for a
503 SERVER-HELLO message. Any other message returned by the server
504 (other than ERROR) is disallowed.
506 CLIENT-MASTER-KEY (Phase 1; Sent primarily in the clear)
508 char MSG-CLIENT-MASTER-KEY
510 char CLEAR-KEY-LENGTH-MSB
511 char CLEAR-KEY-LENGTH-LSB
512 char ENCRYPTED-KEY-LENGTH-MSB
513 char ENCRYPTED-KEY-LENGTH-LSB
514 char KEY-ARG-LENGTH-MSB
515 char KEY-ARG-LENGTH-LSB
516 char CLEAR-KEY-DATA[MSB<<8|LSB]
517 char ENCRYPTED-KEY-DATA[MSB<<8|LSB]
518 char KEY-ARG-DATA[MSB<<8|LSB]
520 The client sends this message when it has determined a master key
521 for the server to use. Note that when a session-identifier has
522 been agreed upon, this message is not sent.
524 The CIPHER-KIND field indicates which cipher was chosen from the
525 server's CIPHER-SPECS.
527 The CLEAR-KEY-DATA contains the clear portion of the MASTER-KEY.
528 The CLEAR-KEY-DATA is combined with the SECRET-KEY-DATA (described
529 shortly) to form the MASTER-KEY, with the SECRET-KEY-DATA being
530 the least significant bytes of the final MASTER-KEY. The
531 ENCRYPTED-KEY-DATA contains the secret portions of the MASTER-KEY,
532 encrypted using the server's public key. The encryption block is
533 formatted using block type 2 from PKCS#1 [5]. The data portion of
534 the block is formatted as follows:
536 char SECRET-KEY-DATA[SECRET-LENGTH]
538 SECRET-LENGTH is the number of bytes of each session key that is
539 being transmitted encrypted. The SECRET-LENGTH plus the
540 CLEAR-KEY-LENGTH equals the number of bytes present in the cipher
541 key (as defined by the CIPHER-KIND). It is an error if the
542 SECRET-LENGTH found after decrypting the PKCS#1 formatted
543 encryption block doesn't match the expected value. It is also an
544 error if CLEAR-KEY-LENGTH is non-zero and the CIPHER-KIND is not
547 If the key algorithm needs an argument (for example, DES-CBC's
548 initialization vector) then the KEY-ARG-LENGTH fields will be
549 non-zero and the KEY-ARG-DATA will contain the relevant data. For
550 the SSL_CK_RC2_128_CBC_WITH_MD5,
551 SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5,
552 SSL_CK_IDEA_128_CBC_WITH_MD5, SSL_CK_DES_64_CBC_WITH_MD5 and
553 SSL_CK_DES_192_EDE3_CBC_WITH_MD5 algorithms the KEY-ARG data must
554 be present and be exactly 8 bytes long.
556 Client and server session key production is a function of the
559 SSL_CK_RC4_128_WITH_MD5
560 SSL_CK_RC4_128_EXPORT40_WITH_MD5
561 SSL_CK_RC2_128_CBC_WITH_MD5
562 SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5
563 SSL_CK_IDEA_128_CBC_WITH_MD5
565 KEY-MATERIAL-0 = MD5[ MASTER-KEY, "0", CHALLENGE, CONNECTION-ID ]
566 KEY-MATERIAL-1 = MD5[ MASTER-KEY, "1", CHALLENGE, CONNECTION-ID ]
568 CLIENT-READ-KEY = KEY-MATERIAL-0[0-15]
569 CLIENT-WRITE-KEY = KEY-MATERIAL-1[0-15]
571 Where KEY-MATERIAL-0[0-15] means the first 16 bytes of the
572 KEY-MATERIAL-0 data, with KEY-MATERIAL-0[0] becoming the most
573 significant byte of the CLIENT-READ-KEY.
575 Data is fed to the MD5 hash function in the order shown, from
576 left to right: first the MASTER-KEY, then the "0" or "1",
577 then the CHALLENGE and then finally the CONNECTION-ID.
579 Note that the "0" means the ascii zero character (0x30), not
580 a zero value. "1" means the ascii 1 character (0x31). MD5
581 produces 128 bits of output data which are used directly as
582 the key to the cipher algorithm (The most significant byte of
583 the MD5 output becomes the most significant byte of the key
586 SSL_CK_DES_64_CBC_WITH_MD5
588 KEY-MATERIAL-0 = MD5[ MASTER-KEY, CHALLENGE, CONNECTION-ID ]
590 CLIENT-READ-KEY = KEY-MATERIAL-0[0-7]
591 CLIENT-WRITE-KEY = KEY-MATERIAL-0[8-15]
593 For DES-CBC, a single 16 bytes of key material are produced
594 using MD5. The first 8 bytes of the MD5 digest are used as
595 the CLIENT-READ-KEY while the remaining 8 bytes are used as
596 the CLIENT-WRITE-KEY. The initialization vector is provided
597 in the KEY-ARG-DATA. Note that the raw key data is not parity
598 adjusted and that this step must be performed before the keys
599 are legitimate DES keys.
601 SSL_CK_DES_192_EDE3_CBC_WITH_MD5
603 KEY-MATERIAL-0 = MD5[ MASTER-KEY, "0", CHALLENGE, CONNECTION-ID ]
604 KEY-MATERIAL-1 = MD5[ MASTER-KEY, "1", CHALLENGE, CONNECTION-ID ]
605 KEY-MATERIAL-2 = MD5[ MASTER-KEY, "2", CHALLENGE, CONNECTION-ID ]
607 CLIENT-READ-KEY-0 = KEY-MATERIAL-0[0-7]
608 CLIENT-READ-KEY-1 = KEY-MATERIAL-0[8-15]
609 CLIENT-READ-KEY-2 = KEY-MATERIAL-1[0-7]
610 CLIENT-WRITE-KEY-0 = KEY-MATERIAL-1[8-15]
611 CLIENT-WRITE-KEY-1 = KEY-MATERIAL-2[0-7]
612 CLIENT-WRITE-KEY-2 = KEY-MATERIAL-2[8-15]
614 Data is fed to the MD5 hash function in the order shown, from
615 left to right: first the MASTER-KEY, then the "0", "1" or
616 "2", then the CHALLENGE and then finally the CONNECTION-ID.
618 Note that the "0" means the ascii zero character (0x30), not
619 a zero value. "1" means the ascii 1 character (0x31). "2"
620 means the ascii 2 character (0x32).
622 A total of 6 keys are produced, 3 for the read side DES-EDE3
623 cipher and 3 for the write side DES-EDE3 function. The
624 initialization vector is provided in the KEY-ARG-DATA. The
625 keys that are produced are not parity adjusted. This step
626 must be performed before proper DES keys are usable.
628 Recall that the MASTER-KEY is given to the server in the
629 CLIENT-MASTER-KEY message. The CHALLENGE is given to the server by
630 the client in the CLIENT-HELLO message. The CONNECTION-ID is given
631 to the client by the server in the SERVER-HELLO message. This
632 makes the resulting cipher keys a function of the original session
633 and the current session. Note that the master key is never
634 directly used to encrypt data, and therefore cannot be easily
637 The CLIENT-MASTER-KEY message must be sent after the CLIENT-HELLO
638 message and before the CLIENT-FINISHED message. The
639 CLIENT-MASTER-KEY message must be sent if the SERVER-HELLO message
640 contains a SESSION-ID-HIT value of 0.
642 CLIENT-CERTIFICATE (Phase 2; Sent encrypted)
644 char MSG-CLIENT-CERTIFICATE
645 char CERTIFICATE-TYPE
646 char CERTIFICATE-LENGTH-MSB
647 char CERTIFICATE-LENGTH-LSB
648 char RESPONSE-LENGTH-MSB
649 char RESPONSE-LENGTH-LSB
650 char CERTIFICATE-DATA[MSB<<8|LSB]
651 char RESPONSE-DATA[MSB<<8|LSB]
653 This message is sent by one an SSL client in response to a server
654 REQUEST-CERTIFICATE message. The CERTIFICATE-DATA contains data
655 defined by the CERTIFICATE-TYPE value. An ERROR message is sent
656 with error code NO-CERTIFICATE-ERROR when this request cannot be
657 answered properly (e.g. the receiver of the message has no
658 registered certificate).
660 CERTIFICATE-TYPE is one of:
663 The CERTIFICATE-DATA contains an X.509 (1988) [3] signed
666 The RESPONSE-DATA contains the authentication response data. This
667 data is a function of the AUTHENTICATION-TYPE value sent by the
670 When AUTHENTICATION-TYPE is SSL_AT_MD5_WITH_RSA_ENCRYPTION then
671 the RESPONSE-DATA contains a digital signature of the following
672 components (in the order shown):
675 * the KEY-MATERIAL-1 (only if defined by the cipher kind)
676 * the KEY-MATERIAL-2 (only if defined by the cipher kind)
677 * the CERTIFICATE-CHALLENGE-DATA (from the REQUEST-CERTIFICATE
679 * the server's signed certificate (from the SERVER-HELLO
682 The digital signature is constructed using MD5 and then encrypted
683 using the clients private key, formatted according to PKCS#1's
684 digital signature standard [5]. The server authenticates the
685 client by verifying the digital signature using standard
686 techniques. Note that other digest functions are supported. Either
687 a new AUTHENTICATION-TYPE can be added, or the algorithm-id in the
688 digital signature can be changed.
690 This message must be sent by the client only in response to a
691 REQUEST-CERTIFICATE message.
693 CLIENT-FINISHED (Phase 2; Sent encrypted)
695 char MSG-CLIENT-FINISHED
696 char CONNECTION-ID[N-1]
698 The client sends this message when it is satisfied with the
699 server. Note that the client must continue to listen for server
700 messages until it receives a SERVER-FINISHED message. The
701 CONNECTION-ID data is the original connection-identifier the
702 server sent with its SERVER-HELLO message, encrypted using the
703 agreed upon session key.
705 "N" is the number of bytes in the message that was sent, so "N-1"
706 is the number of bytes in the message without the message header
709 For version 2 of the protocol, the client must send this message
710 after it has received the SERVER-HELLO message. If the
711 SERVER-HELLO message SESSION-ID-HIT flag is non-zero then the
712 CLIENT-FINISHED message is sent immediately, otherwise the
713 CLIENT-FINISHED message is sent after the CLIENT-MASTER-KEY
716 2.6 Server Only Protocol Messages
718 There are several messages that are only generated by servers. The
719 messages are never generated by correctly functioning clients.
721 SERVER-HELLO (Phase 1; Sent in the clear)
723 char MSG-SERVER-HELLO
725 char CERTIFICATE-TYPE
726 char SERVER-VERSION-MSB
727 char SERVER-VERSION-LSB
728 char CERTIFICATE-LENGTH-MSB
729 char CERTIFICATE-LENGTH-LSB
730 char CIPHER-SPECS-LENGTH-MSB
731 char CIPHER-SPECS-LENGTH-LSB
732 char CONNECTION-ID-LENGTH-MSB
733 char CONNECTION-ID-LENGTH-LSB
734 char CERTIFICATE-DATA[MSB<<8|LSB]
735 char CIPHER-SPECS-DATA[MSB<<8|LSB]
736 char CONNECTION-ID-DATA[MSB<<8|LSB]
738 The server sends this message after receiving the clients
739 CLIENT-HELLO message. The server returns the SESSION-ID-HIT flag
740 indicating whether or not the received session-identifier is known
741 by the server (i.e. in the server's session-identifier cache). The
742 SESSION-ID-HIT flag will be non-zero if the client sent the server
743 a session-identifier (in the CLIENT-HELLO message with
744 SESSION-ID-LENGTH != 0) and the server found the client's
745 session-identifier in its cache. If the SESSION-ID-HIT flag is
746 non-zero then the CERTIFICATE-TYPE, CERTIFICATE-LENGTH and
747 CIPHER-SPECS-LENGTH fields will be zero.
749 The CERTIFICATE-TYPE value, when non-zero, has one of the values
750 described above (see the information on the CLIENT-CERTIFICATE
753 When the SESSION-ID-HIT flag is zero, the server packages up its
754 certificate, its cipher specs and a connection-id to send to the
755 client. Using this information the client can generate a session
756 key and return it to the server with the CLIENT-MASTER-KEY
759 When the SESSION-ID-HIT flag is non-zero, both the server and the
760 client compute a new pair of session keys for the current session
761 derived from the MASTER-KEY that was exchanged when the SESSION-ID
762 was created. The SERVER-READ-KEY and SERVER-WRITE-KEY are derived
763 from the original MASTER-KEY keys in the same manner as the
764 CLIENT-READ-KEY and CLIENT-WRITE-KEY:
766 SERVER-READ-KEY = CLIENT-WRITE-KEY
767 SERVER-WRITE-KEY = CLIENT-READ-KEY
769 Note that when keys are being derived and the SESSION-ID-HIT flag
770 is set and the server discovers the client's session-identifier in
771 the servers cache, then the KEY-ARG-DATA is used from the time
772 when the SESSION-ID was established. This is because the client
773 does not send new KEY-ARG-DATA (recall that the KEY-ARG-DATA is
774 sent only in the CLIENT-MASTER-KEY message).
776 The CONNECTION-ID-DATA is a string of randomly generated bytes
777 used by the server and client at various points in the protocol.
778 The CLIENT-FINISHED message contains an encrypted version of the
779 CONNECTION-ID-DATA. The length of the CONNECTION-ID must be
780 between 16 and than 32 bytes, inclusive.
782 The CIPHER-SPECS-DATA define a cipher type and key length (in
783 bits) that the receiving end supports. Each SESSION-CIPHER-SPEC is
784 3 bytes long and looks like this:
790 Where CIPHER-KIND is one of:
792 * SSL_CK_RC4_128_WITH_MD5
793 * SSL_CK_RC4_128_EXPORT40_WITH_MD5
794 * SSL_CK_RC2_128_CBC_WITH_MD5
795 * SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5
796 * SSL_CK_IDEA_128_CBC_WITH_MD5
797 * SSL_CK_DES_64_CBC_WITH_MD5
798 * SSL_CK_DES_192_EDE3_CBC_WITH_MD5
800 This list is not exhaustive and may be changed in the future.
802 The SSL_CK_RC4_128_EXPORT40_WITH_MD5 cipher is an RC4 cipher where
803 some of the session key is sent in the clear and the rest is sent
804 encrypted (exactly 40 bits of it). MD5 is used as the hash
805 function for production of MAC's and session key's. This cipher
806 type is provided to support "export" versions (i.e. versions of
807 the protocol that can be distributed outside of the United States)
808 of the client or server.
810 An exportable implementation of the SSL Handshake Protocol will
811 have secret key lengths restricted to 40 bits. For non-export
812 implementations key lengths can be more generous (we recommend at
813 least 128 bits). It is permissible for the client and server to
814 have a non-intersecting set of stream ciphers. This, simply put,
815 means they cannot communicate.
817 Version 2 of the SSL Handshake Protocol defines the
818 SSL_CK_RC4_128_WITH_MD5 to have a key length of 128 bits. The
819 SSL_CK_RC4_128_EXPORT40_WITH_MD5 also has a key length of 128
820 bits. However, only 40 of the bits are secret (the other 88 bits
821 are sent in the clear by the client to the server).
823 The SERVER-HELLO message is sent after the server receives the
824 CLIENT-HELLO message, and before the server sends the
825 SERVER-VERIFY message.
827 SERVER-VERIFY (Phase 1; Sent encrypted)
829 char MSG-SERVER-VERIFY
830 char CHALLENGE-DATA[N-1]
832 The server sends this message after a pair of session keys
833 (SERVER-READ-KEY and SERVER-WRITE-KEY) have been agreed upon
834 either by a session-identifier or by explicit specification with
835 the CLIENT-MASTER-KEY message. The message contains an encrypted
836 copy of the CHALLENGE-DATA sent by the client in the CLIENT-HELLO
839 "N" is the number of bytes in the message that was sent, so "N-1"
840 is the number of bytes in the CHALLENGE-DATA without the message
843 This message is used to verify the server as follows. A legitimate
844 server will have the private key that corresponds to the public
845 key contained in the server certificate that was transmitted in
846 the SERVER-HELLO message. Accordingly, the legitimate server will
847 be able to extract and reconstruct the pair of session keys
848 (SERVER-READ-KEY and SERVER-WRITE-KEY). Finally, only a server
849 that has done the extraction and decryption properly can correctly
850 encrypt the CHALLENGE-DATA. This, in essence, "proves" that the
851 server has the private key that goes with the public key in the
852 server's certificate.
854 The CHALLENGE-DATA must be the exact same length as originally
855 sent by the client in the CLIENT-HELLO message. Its value must
856 match exactly the value sent in the clear by the client in the
857 CLIENT-HELLO message. The client must decrypt this message and
858 compare the value received with the value sent, and only if the
859 values are identical is the server to be "trusted". If the lengths
860 do not match or the value doesn't match then the connection is to
861 be closed by the client.
863 This message must be sent by the server to the client after either
864 detecting a session-identifier hit (and replying with a
865 SERVER-HELLO message with SESSION-ID-HIT not equal to zero) or
866 when the server receives the CLIENT-MASTER-KEY message. This
867 message must be sent before any Phase 2 messages or a
868 SEVER-FINISHED message.
870 SERVER-FINISHED (Phase 2; Sent encrypted)
872 char MSG-SERVER-FINISHED
873 char SESSION-ID-DATA[N-1]
875 The server sends this message when it is satisfied with the
876 clients security handshake and is ready to proceed with
877 transmission/reception of the higher level protocols data. The
878 SESSION-ID-DATA is used by the client and the server at this time
879 to add entries to their respective session-identifier caches. The
880 session-identifier caches must contain a copy of the MASTER-KEY
881 sent in the CLIENT-MASTER-KEY message as the master key is used
882 for all subsequent session key generation.
884 "N" is the number of bytes in the message that was sent, so "N-1"
885 is the number of bytes in the SESSION-ID-DATA without the message
888 This message must be sent after the SERVER-VERIFY message.
890 REQUEST-CERTIFICATE (Phase 2; Sent encrypted)
892 char MSG-REQUEST-CERTIFICATE
893 char AUTHENTICATION-TYPE
894 char CERTIFICATE-CHALLENGE-DATA[N-2]
896 A server may issue this request at any time during the second
897 phase of the connection handshake, asking for the client's
898 certificate. The client responds with a CLIENT-CERTIFICATE message
899 immediately if it has one, or an ERROR message (with error code
900 NO-CERTIFICATE-ERROR) if it doesn't. The
901 CERTIFICATE-CHALLENGE-DATA is a short byte string (whose length is
902 greater than or equal to 16 bytes and less than or equal to 32
903 bytes) that the client will use to respond to this message.
905 The AUTHENTICATION-TYPE value is used to choose a particular means
906 of authenticating the client. The following types are defined:
908 * SSL_AT_MD5_WITH_RSA_ENCRYPTION
910 The SSL_AT_MD5_WITH_RSA_ENCRYPTION type requires that the client
911 construct an MD5 message digest using information as described
912 above in the section on the CLIENT-CERTIFICATE message. Once the
913 digest is created, the client encrypts it using its private key
914 (formatted according to the digital signature standard defined in
915 PKCS#1). The server authenticates the client when it receives the
916 CLIENT-CERTIFICATE message.
918 This message may be sent after a SERVER-VERIFY message and before
919 a SERVER-FINISHED message.
921 2.7 Client/Server Protocol Messages
923 These messages are generated by both the client and the server.
925 ERROR (Sent clear or encrypted)
931 This message is sent when an error is detected. After the message
932 is sent, the sending party shuts the connection down. The
933 receiving party records the error and then shuts its connection
936 This message is sent in the clear if an error occurs during
937 session key negotiation. After a session key has been agreed upon,
938 errors are sent encrypted like all other messages.
940 ------------------------------------------------------------------------
942 Appendix A: ASN.1 Syntax For Certificates
944 Certificates are used by SSL to authenticate servers and clients. SSL
945 Certificates are based largely on the X.509 [3] certificates. An X.509
946 certificate contains the following information (in ASN.1 [1] notation):
948 X.509-Certificate ::= SEQUENCE {
949 certificateInfo CertificateInfo,
950 signatureAlgorithm AlgorithmIdentifier,
954 CertificateInfo ::= SEQUENCE {
955 version [0] Version DEFAULT v1988,
956 serialNumber CertificateSerialNumber,
957 signature AlgorithmIdentifier,
961 subjectPublicKeyInfo SubjectPublicKeyInfo
964 Version ::= INTEGER { v1988(0) }
966 CertificateSerialNumber ::= INTEGER
968 Validity ::= SEQUENCE {
973 SubjectPublicKeyInfo ::= SEQUENCE {
974 algorithm AlgorithmIdentifier,
975 subjectPublicKey BIT STRING
978 AlgorithmIdentifier ::= SEQUENCE {
979 algorithm OBJECT IDENTIFIER,
980 parameters ANY DEFINED BY ALGORITHM OPTIONAL
983 For SSL's purposes we restrict the values of some of the X.509 fields:
985 * The X.509-Certificate::signatureAlgorithm and
986 CertificateInfo::signature fields must be identical in value.
988 * The issuer name must resolve to a name that is deemed acceptable
989 by the application using SSL. How the application using SSL does
990 this is outside the scope of this memo.
992 Certificates are validated using a few straightforward steps. First,
993 the signature on the certificate is checked and if invalid, the
994 certificate is invalid (either a transmission error or an attempted
995 forgery occurred). Next, the CertificateInfo::issuer field is verified
996 to be an issuer that the application trusts (using an unspecified
997 mechanism). The CertificateInfo::validity field is checked against the
998 current date and verified.
1000 Finally, the CertificateInfo::subject field is checked. This check is
1001 optional and depends on the level of trust required by the application
1004 Appendix B: Attribute Types and Object Identifiers
1006 SSL uses a subset of the X.520 selected attribute types as well as a
1007 few specific object identifiers. Future revisions of the SSL protocol
1008 may include support for more attribute types and more object
1011 B.1 Selected attribute types
1013 commonName { attributeType 3 }
1014 The common name contained in the distinguished name contained
1015 within a certificate issuer or certificate subject.
1017 countryName { attributeType 6 }
1018 The country name contained in the distinguished name contained
1019 within a certificate issuer or certificate subject.
1021 localityName { attributeType 7 }
1022 The locality name contained in the distinguished name contained
1023 within a certificate issuer or certificate subject.
1025 stateOrProvinceName { attributeType 8 }
1026 The state or province name contained in the distinguished name
1027 contained within a certificate issuer or certificate subject.
1029 organizationName { attributeType 10 }
1030 The organization name contained in the distinguished name
1031 contained within a certificate issuer or certificate subject.
1033 organizationalUnitName { attributeType 11 }
1034 The organizational unit name contained in the distinguished name
1035 contained within a certificate issuer or certificate subject.
1037 B.2 Object identifiers
1039 md2withRSAEncryption { ... pkcs(1) 1 2 }
1040 The object identifier for digital signatures that use both MD2 and
1041 RSA encryption. Used by SSL for certificate signature
1044 md5withRSAEncryption { ... pkcs(1) 1 4 }
1045 The object identifier for digital signatures that use both MD5 and
1046 RSA encryption. Used by SSL for certificate signature
1049 rc4 { ... rsadsi(113549) 3 4 }
1050 The RC4 symmetric stream cipher algorithm used by SSL for bulk
1053 Appendix C: Protocol Constant Values
1055 This section describes various protocol constants. A special value
1056 needs mentioning - the IANA reserved port number for "https" (HTTP
1057 using SSL). IANA has reserved port number 443 (decimal) for "https".
1059 C.1 Protocol Version Codes
1061 #define SSL_CLIENT_VERSION 0x0002
1062 #define SSL_SERVER_VERSION 0x0002
1064 C.2 Protocol Message Codes
1066 The following values define the message codes that are used by version
1067 2 of the SSL Handshake Protocol.
1069 #define SSL_MT_ERROR 0
1070 #define SSL_MT_CLIENT_HELLO 1
1071 #define SSL_MT_CLIENT_MASTER_KEY 2
1072 #define SSL_MT_CLIENT_FINISHED 3
1073 #define SSL_MT_SERVER_HELLO 4
1074 #define SSL_MT_SERVER_VERIFY 5
1075 #define SSL_MT_SERVER_FINISHED 6
1076 #define SSL_MT_REQUEST_CERTIFICATE 7
1077 #define SSL_MT_CLIENT_CERTIFICATE 8
1079 C.3 Error Message Codes
1081 The following values define the error codes used by the ERROR message.
1083 #define SSL_PE_NO_CIPHER 0x0001
1084 #define SSL_PE_NO_CERTIFICATE 0x0002
1085 #define SSL_PE_BAD_CERTIFICATE 0x0004
1086 #define SSL_PE_UNSUPPORTED_CERTIFICATE_TYPE 0x0006
1088 C.4 Cipher Kind Values
1090 The following values define the CIPHER-KIND codes used in the
1091 CLIENT-HELLO and SERVER-HELLO messages.
1093 #define SSL_CK_RC4_128_WITH_MD5 0x01,0x00,0x80
1094 #define SSL_CK_RC4_128_EXPORT40_WITH_MD5 0x02,0x00,0x80
1095 #define SSL_CK_RC2_128_CBC_WITH_MD5 0x03,0x00,0x80
1096 #define SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5 0x04,0x00,0x80
1097 #define SSL_CK_IDEA_128_CBC_WITH_MD5 0x05,0x00,0x80
1098 #define SSL_CK_DES_64_CBC_WITH_MD5 0x06,0x00,0x40
1099 #define SSL_CK_DES_192_EDE3_CBC_WITH_MD5 0x07,0x00,0xC0
1101 C.5 Certificate Type Codes
1103 The following values define the certificate type codes used in the
1104 SERVER-HELLO and CLIENT-CERTIFICATE messages.
1106 #define SSL_CT_X509_CERTIFICATE 0x01
1108 C.6 Authentication Type Codes
1110 The following values define the authentication type codes used in the
1111 REQUEST-CERTIFICATE message.
1113 #define SSL_AT_MD5_WITH_RSA_ENCRYPTION 0x01
1115 C.7 Upper/Lower Bounds
1117 The following values define upper/lower bounds for various protocol
1120 #define SSL_MAX_MASTER_KEY_LENGTH_IN_BITS 256
1121 #define SSL_MAX_SESSION_ID_LENGTH_IN_BYTES 16
1122 #define SSL_MIN_RSA_MODULUS_LENGTH_IN_BYTES 64
1123 #define SSL_MAX_RECORD_LENGTH_2_BYTE_HEADER 32767
1124 #define SSL_MAX_RECORD_LENGTH_3_BYTE_HEADER 16383
1128 Because protocols have to be implemented to be of value, we recommend
1129 the following values for various operational parameters. This is only a
1130 recommendation, and not a strict requirement for conformance to the
1133 Session-identifier Cache Timeout
1135 Session-identifiers are kept in SSL clients and SSL servers.
1136 Session-identifiers should have a lifetime that serves their
1137 purpose (namely, reducing the number of expensive public key
1138 operations for a single client/server pairing). Consequently, we
1139 recommend a maximum session-identifier cache timeout value of 100
1140 seconds. Given a server that can perform N private key operations
1141 per second, this reduces the server load for a particular client
1146 In this section we attempt to describe various attacks that might be
1147 used against the SSL protocol. This list is not guaranteed to be
1148 exhaustive. SSL was defined to thwart these attacks.
1150 D.1 Cracking Ciphers
1152 SSL depends on several cryptographic technologies. RSA Public Key
1153 encryption [5] is used for the exchange of the session key and
1154 client/server authentication. Various cryptographic algorithms are used
1155 for the session cipher. If successful cryptographic attacks are made
1156 against these technologies then SSL is no longer secure.
1158 Attacks against a specific communications session can be made by
1159 recording the session, and then spending some large number of compute
1160 cycles to crack either the session key or the RSA public key until the
1161 communication can be seen in the clear. This approach is easier than
1162 cracking the cryptographic technologies for all possible messages. Note
1163 that SSL tries to make the cost of such of an attack greater than the
1164 benefits gained from a successful attack, thus making it a waste of
1165 money/time to perform such an attack.
1167 There have been many books [9] and papers [10] written on cryptography.
1168 This document does not attempt to reference them all.
1170 D.2 Clear Text Attack
1172 A clear text attack is done when the attacker has an idea of what kind
1173 of message is being sent using encryption. The attacker can generate a
1174 data base whose keys are the encrypted value of the known text (or
1175 clear text), and whose values are the session cipher key (we call this
1176 a "dictionary"). Once this data base is constructed, a simple lookup
1177 function identifies the session key that goes with a particular
1178 encrypted value. Once the session key is known, the entire message
1179 stream can be decrypted. Custom hardware can be used to make this cost
1180 effective and very fast.
1182 Because of the very nature of SSL clear text attacks are possible. For
1183 example, the most common byte string sent by an HTTP client application
1184 to an HTTP server is "GET". SSL attempts to address this attack by
1185 using large session cipher keys. First, the client generates a key
1186 which is larger than allowed by export, and sends some of it in the
1187 clear to the server (this is allowed by United States government export
1188 rules). The clear portion of the key concatenated with the secret
1189 portion make a key which is very large (for RC4, exactly 128 bits).
1191 The way that this "defeats" a clear text attack is by making the amount
1192 of custom hardware needed prohibitively large. Every bit added to the
1193 length of the session cipher key increases the dictionary size by a
1194 factor of 2. By using a 128 bit session cipher key length the size of
1195 the dictionary required is beyond the ability of anyone to fabricate
1196 (it would require more atoms to construct than exist in the entire
1197 universe). Even if a smaller dictionary is to be used, it must first be
1198 generated using the clear key bits. This is a time consumptive process
1199 and also eliminates many possible custom hardware architectures (e.g.
1200 static prom arrays).
1202 The second way that SSL attacks this problem is by using large key
1203 lengths when permissible (e.g. in the non-export version). Large key
1204 sizes require larger dictionaries (just one more bit of key size
1205 doubles the size of the dictionary). SSL attempts to use keys that are
1208 Note that the consequence of the SSL defense is that a brute force
1209 attack becomes the cheapest way to attack the key. Brute force attacks
1210 have well known space/time tradeoffs and so it becomes possible to
1211 define a cost of the attack. For the 128 bit secret key, the known cost
1212 is essentially infinite. For the 40 bit secret key, the cost is much
1213 smaller, but still outside the range of the "random hacker".
1217 The replay attack is simple. A bad-guy records a communication session
1218 between a client and server. Later, it reconnects to the server, and
1219 plays back the previously recorded client messages.
1221 SSL defeats this attack using a "nonce" (the connection-id) which is
1222 "unique" to the connection. In theory the bad-guy cannot predict the
1223 nonce in advance as it is based on a set of random events outside the
1224 bad-guys control, and therefore the bad-guy cannot respond properly to
1227 A bad-guy with large resources can record many sessions between a
1228 client and a server, and attempt to choose the right session based on
1229 the nonce the server sends initially in its SERVER-HELLO message.
1230 However, SSL nonces are at least 128 bits long, so a bad-guy would need
1231 to record approximately 2^64 nonces to even have a 50% chance of
1232 choosing the right session. This number is sufficiently large that one
1233 cannot economically construct a device to record 2^64 messages, and
1234 therefore the odds are overwhelmingly against the replay attack ever
1237 D.4 The Man In The Middle
1239 The man in the middle attack works by having three people in a
1240 communications session: the client, the server, and the bad guy. The
1241 bad guy sits between the client and the server on the network and
1242 intercepts traffic that the client sends to the server, and traffic
1243 that the server sends to the client.
1245 The man in the middle operates by pretending to be the real server to
1246 the client. With SSL this attack is impossible because of the usage of
1247 server certificates. During the security connection handshake the
1248 server is required to provide a certificate that is signed by a
1249 certificate authority. Contained in the certificate is the server's
1250 public key as well as its name and the name of the certificate issuer.
1251 The client verifies the certificate by first checking the signature and
1252 then verifying that the name of the issuer is somebody that the client
1255 In addition, the server must encrypt something with the private key
1256 that goes with the public key mentioned in the certificate. This in
1257 essence is a single pass "challenge response" mechanism. Only a server
1258 that has both the certificate and the private key can respond properly
1261 If the man in the middle provides a phony certificate, then the
1262 signature check will fail. If the certificate provided by the bad guy
1263 is legitimate, but for the bad guy instead of for the real server, then
1264 the signature will pass but the name check will fail (note that the man
1265 in the middle cannot forge certificates without discovering a
1266 certificate authority's private key).
1268 Finally, if the bad guy provides the real server's certificate then the
1269 signature check will pass and the name check will pass. However,
1270 because the bad guy does not have the real server's private key, the
1271 bad guy cannot properly encode the response to the challenge code, and
1272 this check will fail.
1274 In the unlikely case that a bad guy happens to guess the response code
1275 to the challenge, the bad guy still cannot decrypt the session key and
1276 therefore cannot examine the encrypted data.
1280 Application Protocol
1281 An application protocol is a protocol that normally layers
1282 directly on top of TCP/IP. For example: HTTP, TELNET, FTP, and
1286 Authentication is the ability of one entity to determine the
1287 identity of another entity. Identity is defined by this document
1288 to mean the binding between a public key and a name and the
1289 implicit ownership of the corresponding private key.
1292 This term is used to describe a cryptographic technique with
1293 certain performance properties. Bulk ciphers are used when large
1294 quantities of data are to be encrypted/decrypted in a timely
1295 manner. Examples include RC2, RC4, and IDEA.
1298 In this document client refers to the application entity that is
1299 initiates a connection to a server.
1302 The session key that the client uses to initialize the client read
1303 cipher. This key has the same value as the SERVER-WRITE-KEY.
1306 The session key that the client uses to initialize the client
1307 write cipher. This key has the same value as the SERVER-READ-KEY.
1310 The master key that the client and server use for all session key
1311 generation. The CLIENT-READ-KEY, CLIENT-WRITE-KEY, SERVER-READ-KEY
1312 and SERVER-WRITE-KEY are generated from the MASTER-KEY.
1315 MD2 [8] is a hashing function that converts an arbitrarily long
1316 data stream into a digest of fixed size. This function predates
1317 MD5 [7] which is viewed as a more robust hash function [9].
1320 MD5 [7] is a hashing function that converts an arbitrarily long
1321 data stream into a digest of fixed size. The function has certain
1322 properties that make it useful for security, the most important of
1323 which is it's inability to be reversed.
1326 A randomly generated value used to defeat "playback" attacks. One
1327 party randomly generates a nonce and sends it to the other party.
1328 The receiver encrypts it using the agreed upon secret key and
1329 returns it to the sender. Because the nonce was randomly generated
1330 by the sender this defeats playback attacks because the replayer
1331 can't know in advance the nonce the sender will generate. The
1332 receiver denies connections that do not have the correctly
1335 Non-repudiable Information Exchange
1336 When two entities exchange information it is sometimes valuable to
1337 have a record of the communication that is non-repudiable. Neither
1338 party can then deny that the information exchange occurred.
1339 Version 2 of the SSL protocol does not support Non-repudiable
1340 information exchange.
1342 Public Key Encryption
1343 Public key encryption is a technique that leverages asymmetric
1344 ciphers. A public key system consists of two keys: a public key
1345 and a private key. Messages encrypted with the public key can only
1346 be decrypted with the associated private key. Conversely, messages
1347 encrypted with the private key can only be decrypted with the
1348 public key. Public key encryption tends to be extremely compute
1349 intensive and so is not suitable as a bulk cipher.
1352 Privacy is the ability of two entities to communicate without fear
1353 of eavesdropping. Privacy is often implemented by encrypting the
1354 communications stream between the two entities.
1357 Proprietary bulk ciphers invented by RSA (There is no good
1358 reference to these as they are unpublished works; however, see
1359 [9]). RC2 is block cipher and RC4 is a stream cipher.
1362 The server is the application entity that responds to requests for
1363 connections from clients. The server is passive, waiting for
1364 requests from clients.
1367 A session cipher is a "bulk" cipher that is capable of encrypting
1368 or decrypting arbitrarily large amounts of data. Session ciphers
1369 are used primarily for performance reasons. The session ciphers
1370 used by this protocol are symmetric. Symmetric ciphers have the
1371 property of using a single key for encryption and decryption.
1374 A session identifier is a random value generated by a client that
1375 identifies itself to a particular server. The session identifier
1376 can be thought of as a handle that both parties use to access a
1377 recorded secret key (in our case a session key). If both parties
1378 remember the session identifier then the implication is that the
1379 secret key is already known and need not be negotiated.
1382 The key to the session cipher. In SSL there are four keys that are
1383 called session keys: CLIENT-READ-KEY, CLIENT-WRITE-KEY,
1384 SERVER-READ-KEY, and SERVER-WRITE-KEY.
1387 The session key that the server uses to initialize the server read
1388 cipher. This key has the same value as the CLIENT-WRITE-KEY.
1391 The session key that the server uses to initialize the server
1392 write cipher. This key has the same value as the CLIENT-READ-KEY.
1395 A symmetric cipher has the property that the same key can be used
1396 for decryption and encryption. An asymmetric cipher does not have
1397 this behavior. Some examples of symmetric ciphers: IDEA, RC2, RC4.
1401 [1] CCITT. Recommendation X.208: "Specification of Abstract Syntax
1402 Notation One (ASN.1). 1988.
1404 [2] CCITT. Recommendation X.209: "Specification of Basic Encoding Rules
1405 for Abstract Syntax Notation One (ASN.1). 1988.
1407 [3] CCITT. Recommendation X.509: "The Directory - Authentication
1410 [4] CCITT. Recommendation X.520: "The Directory - Selected Attribute
1413 [5] RSA Laboratories. PKCS #1: RSA Encryption Standard, Version 1.5,
1416 [6] RSA Laboratories. PKCS #6: Extended-Certificate Syntax Standard,
1417 Version 1.5, November 1993.
1419 [7] R. Rivest. RFC 1321: The MD5 Message Digest Algorithm. April 1992.
1421 [8] R. Rivest. RFC 1319: The MD2 Message Digest Algorithm. April 1992.
1423 [9] B. Schneier. Applied Cryptography: Protocols, Algorithms, and
1424 Source Code in C, Published by John Wiley & Sons, Inc. 1994.
1426 [10] M. Abadi and R. Needham. Prudent engineering practice for
1427 cryptographic protocols. 1994.
1431 This version of the SSL protocol relies on the use of patented public
1432 key encryption technology for authentication and encryption. The
1433 Internet Standards Process as defined in RFC 1310 requires a written
1434 statement from the Patent holder that a license will be made available
1435 to applicants under reasonable terms and conditions prior to approving
1436 a specification as a Proposed, Draft or Internet Standard.
1438 The Massachusetts Institute of Technology and the Board of Trustees of
1439 the Leland Stanford Junior University have granted Public Key Partners
1440 (PKP) exclusive sub-licensing rights to the following patents issued in
1441 the United States, and all of their corresponding foreign patents:
1443 Cryptographic Apparatus and Method
1444 ("Diffie-Hellman")............................... No. 4,200,770
1446 Public Key Cryptographic Apparatus
1447 and Method ("Hellman-Merkle").................... No. 4,218,582
1449 Cryptographic Communications System and
1450 Method ("RSA")................................... No. 4,405,829
1452 Exponential Cryptographic Apparatus
1453 and Method ("Hellman-Pohlig").................... No. 4,424,414
1455 These patents are stated by PKP to cover all known methods of
1456 practicing the art of Public Key encryption, including the variations
1457 collectively known as El Gamal.
1459 Public Key Partners has provided written assurance to the Internet
1460 Society that parties will be able to obtain, under reasonable,
1461 nondiscriminatory terms, the right to use the technology covered by
1462 these patents. This assurance is documented in RFC 1170 titled "Public
1463 Key Standards and Licenses". A copy of the written assurance dated
1464 April 20, 1990, may be obtained from the Internet Assigned Number
1467 The Internet Society, Internet Architecture Board, Internet Engineering
1468 Steering Group and the Corporation for National Research Initiatives
1469 take no position on the validity or scope of the patents and patent
1470 applications, nor on the appropriateness of the terms of the assurance.
1471 The Internet Society and other groups mentioned above have not made any
1472 determination as to any other intellectual property rights which may
1473 apply to the practice of this standard. Any further consideration of
1474 these matters is the user's own responsibility.
1476 Security Considerations
1478 This entire document is about security.
1483 AOL/Netscape Communications Corp.
1485 Mountain View, CA 94043-4042