end of this document.
Appendix C. CipherSuite Definitions
CipherSuite Key Exchange Cipher Hash
TLS_NULL_WITH_NULL_NULL NULL NULL NULL
TLS_RSA_WITH_NULL_MD5 RSA NULL MD5
TLS_RSA_WITH_NULL_SHA RSA NULL SHA
TLS_RSA_WITH_RC4_128_MD5 RSA RC4_128 MD5
TLS_RSA_WITH_RC4_128_SHA RSA RC4_128 SHA
TLS_RSA_WITH_IDEA_CBC_SHA RSA IDEA_CBC SHA
TLS_RSA_WITH_DES_CBC_SHA RSA DES_CBC SHA
TLS_RSA_WITH_3DES_EDE_CBC_SHA RSA 3DES_EDE_CBC SHA
TLS_DH_DSS_WITH_DES_CBC_SHA DH_DSS DES_CBC SHA
TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA DH_DSS 3DES_EDE_CBC SHA
TLS_DH_RSA_WITH_DES_CBC_SHA DH_RSA DES_CBC SHA
TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA DH_RSA 3DES_EDE_CBC SHA
TLS_DHE_DSS_WITH_DES_CBC_SHA DHE_DSS DES_CBC SHA
TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA DHE_DSS 3DES_EDE_CBC SHA
TLS_DHE_RSA_WITH_DES_CBC_SHA DHE_RSA DES_CBC SHA
TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA DHE_RSA 3DES_EDE_CBC SHA
TLS_DH_anon_WITH_RC4_128_MD5 DH_anon RC4_128 MD5
TLS_DH_anon_WITH_DES_CBC_SHA DH_anon DES_CBC SHA
TLS_DH_anon_WITH_3DES_EDE_CBC_SHA DH_anon 3DES_EDE_CBC SHA
Key
Exchange
Algorithm Description Key size limit
DHE_DSS Ephemeral DH with DSS signatures None
DHE_RSA Ephemeral DH with RSA signatures None
DH_anon Anonymous DH, no signatures None
DH_DSS DH with DSS-based certificates None
DH_RSA DH with RSA-based certificates None
RSA = none
NULL No key exchange N/A
RSA RSA key exchange None
Key Expanded IV Block
Cipher Type Material Key Material Size Size
NULL Stream 0 0 0 N/A
IDEA_CBC Block 16 16 8 8
RC2_CBC_40 Block 5 16 8 8
RC4_40 Stream 5 16 0 N/A
RC4_128 Stream 16 16 0 N/A
DES40_CBC Block 5 8 8 8
DES_CBC Block 8 8 8 8
3DES_EDE_CBC Block 24 24 8 8
Type
Indicates whether this is a stream cipher or a block cipher
running in CBC mode.
Key Material
The number of bytes from the key_block that are used for
generating the write keys.
Expanded Key Material
The number of bytes actually fed into the encryption algorithm.
IV Size
The amount of data needed to be generated for the initialization
vector. Zero for stream ciphers; equal to the block size for
block ciphers.
Block Size
The amount of data a block cipher enciphers in one chunk; a block
cipher running in CBC mode can only encrypt an even multiple of
its block size.
Hash Hash Padding
function Size Size
NULL 0 0
MD5 16 48
SHA 20 40
Appendix D. Implementation Notes
The TLS protocol cannot prevent many common security mistakes. This
section provides several recommendations to assist implementors.
D.1. Random Number Generation and Seeding
TLS requires a cryptographically secure pseudorandom number generator
(PRNG). Care must be taken in designing and seeding PRNGs. PRNGs
based on secure hash operations, most notably MD5 and/or SHA, are
acceptable, but cannot provide more security than the size of the
random number generator state. (For example, MD5-based PRNGs usually
provide 128 bits of state.)
To estimate the amount of seed material being produced, add the
number of bits of unpredictable information in each seed byte. For
example, keystroke timing values taken from a PC compatible’s 18.2 Hz
timer provide 1 or 2 secure bits each, even though the total size of
the counter value is 16 bits or more. Seeding a 128-bit PRNG would
thus require approximately 100 such timer values.
[RANDOM] provides guidance on the generation of random values.
D.2 Certificates and Authentication
Implementations are responsible for verifying the integrity of
certificates and should generally support certificate revocation
messages. Certificates should always be verified to ensure proper
signing by a trusted Certificate Authority (CA). The selection and
addition of trusted CAs should be done very carefully. Users should
be able to view information about the certificate and root CA.
D.3 CipherSuites
TLS supports a range of key sizes and security levels, including some
that provide no or minimal security. A proper implementation will
probably not support many cipher suites. For example, 40-bit
encryption is easily broken, so implementations requiring strong
security should not allow 40-bit keys. Similarly, anonymous Diffie-
Hellman is strongly discouraged because it cannot prevent man-in-
the-middle attacks. Applications should also enforce minimum and
maximum key sizes. For example, certificate chains containing 512-
bit RSA keys or signatures are not appropriate for high-security
applications.
Appendix E. Backward Compatibility with SSL
For historical reasons and in order to avoid a profligate consumption
of reserved port numbers, application protocols that are secured by
TLS 1.1, TLS 1.0, SSL 3.0, and SSL 2.0 all frequently share the same
connection port. For example, the https protocol (HTTP secured by
SSL or TLS) uses port 443 regardless of which security protocol it is
using. Thus, some mechanism must be determined to distinguish and
negotiate among the various protocols.
TLS versions 1.1 and 1.0, and SSL 3.0 are very similar; thus,
supporting both is easy. TLS clients who wish to negotiate with such
older servers SHOULD send client hello messages using the SSL 3.0
record format and client hello structure, sending {3, 2} for the
version field to note that they support TLS 1.1. If the server
supports only TLS 1.0 or SSL 3.0, it will respond with a downrev 3.0
server hello; if it supports TLS 1.1 it will respond with a TLS 1.1
server hello. The negotiation then proceeds as appropriate for the
negotiated protocol.
Similarly, a TLS 1.1 server that wishes to interoperate with TLS 1.0
or SSL 3.0 clients SHOULD accept SSL 3.0 client hello messages and
respond with a SSL 3.0 server hello if an SSL 3.0 client hello with a
version field of {3, 0} is received, denoting that this client does
not support TLS. Similarly, if a SSL 3.0 or TLS 1.0 hello with a
version field of {3, 1} is received, the server SHOULD respond with a
TLS 1.0 hello with a version field of {3, 1}.
Whenever a client already knows the highest protocol known to a
server (for example, when resuming a session), it SHOULD initiate the
connection in that native protocol.
TLS 1.1 clients that support SSL Version 2.0 servers MUST send SSL
Version 2.0 client hello messages [SSL2]. TLS servers SHOULD accept
either client hello format if they wish to support SSL 2.0 clients on
the same connection port. The only deviations from the Version 2.0
specification are the ability to specify a version with a value of
three and the support for more ciphering types in the CipherSpec.
Warning: The ability to send Version 2.0 client hello messages will be
phased out with all due haste. Implementors SHOULD make every
effort to move forward as quickly as possible. Version 3.0
provides better mechanisms for moving to newer versions.
The following cipher specifications are carryovers from SSL
Version 2.0. These are assumed to use RSA for key exchange and
authentication.
V2CipherSpec TLS_RC4_128_WITH_MD5 = { 0x01,0x00,0x80 };
V2CipherSpec TLS_RC4_128_EXPORT40_WITH_MD5 = { 0x02,0x00,0x80 };
V2CipherSpec TLS_RC2_CBC_128_CBC_WITH_MD5 = { 0x03,0x00,0x80 };
V2CipherSpec TLS_RC2_CBC_128_CBC_EXPORT40_WITH_MD5
= { 0x04,0x00,0x80 };
V2CipherSpec TLS_IDEA_128_CBC_WITH_MD5 = { 0x05,0x00,0x80 };
V2CipherSpec TLS_DES_64_CBC_WITH_MD5 = { 0x06,0x00,0x40 };
V2CipherSpec TLS_DES_192_EDE3_CBC_WITH_MD5 = { 0x07,0x00,0xC0 };
Cipher specifications native to TLS can be included in Version
2.0 client hello messages using the syntax below. Any
V2CipherSpec element with its first byte equal to zero will be
ignored by Version 2.0 servers. Clients sending any of the above
V2CipherSpecs SHOULD also include the TLS equivalent (see
Appendix A.5):
V2CipherSpec (see TLS name) = { 0x00, CipherSuite };
Note: TLS 1.1 clients may generate the SSLv2 EXPORT cipher suites in
handshakes for backward compatibility but MUST NOT negotiate them
in TLS 1.1 mode.
E.1. Version 2 Client Hello
The Version 2.0 client hello message is presented below using this
document’s presentation model. The true definition is still assumed
to be the SSL Version 2.0 specification. Note that this message MUST
be sent directly on the wire, not wrapped as an SSLv3 record
uint8 V2CipherSpec[3];
struct {
uint16 msg_length;
uint8 msg_type;
Version version;
uint16 cipher_spec_length;
uint16 session_id_length;
uint16 challenge_length;
V2CipherSpec cipher_specs[V2ClientHello.cipher_spec_length];
opaque session_id[V2ClientHello.session_id_length];
opaque challenge[V2ClientHello.challenge_length;
} V2ClientHello;
msg_length
This field is the length of the following data in bytes. The high
bit MUST be 1 and is not part of the length.
msg_type
This field, in conjunction with the version field, identifies a
version 2 client hello message. The value SHOULD be one (1).
version
The highest version of the protocol supported by the client
(equals ProtocolVersion.version; see Appendix A.1).
cipher_spec_length
This field is the total length of the field cipher_specs. It
cannot be zero and MUST be a multiple of the V2CipherSpec length
(3).
session_id_length
This field MUST have a value of zero.
challenge_length
The length in bytes of the client’s challenge to the server to
authenticate itself. When using the SSLv2 backward compatible
handshake the client MUST use a 32-byte challenge.
cipher_specs
This is a list of all CipherSpecs the client is willing and able
to use. There MUST be at least one CipherSpec acceptable to the
server.
session_id
This field MUST be empty.
challenge The client challenge to the server for the server to
identify itself is a (nearly) arbitrary-length random. The TLS
server will right-justify the challenge data to become the
ClientHello.random data (padded with leading zeroes, if
necessary), as specified in this protocol specification. If the
length of the challenge is greater than 32 bytes, only the last 32
bytes are used. It is legitimate (but not necessary) for a V3
server to reject a V2 ClientHello that has fewer than 16 bytes of
challenge data.
Note: Requests to resume a TLS session MUST use a TLS client
hello.
E.2. Avoiding Man-in-the-Middle Version Rollback
When TLS clients fall back to Version 2.0 compatibility mode, they
SHOULD use special PKCS #1 block formatting. This is done so that
TLS servers will reject Version 2.0 sessions with TLS-capable
clients.
When TLS clients are in Version 2.0 compatibility mode, they set the
right-hand (least significant) 8 random bytes of the PKCS padding
(not including the terminal null of the padding) for the RSA
encryption of the ENCRYPTED-KEY-DATA field of the CLIENT-MASTER-KEY
to 0x03 (the other padding bytes are random). After decrypting the
ENCRYPTED-KEY-DATA field, servers that support TLS SHOULD issue an
error if these eight padding bytes are 0x03. Version 2.0 servers
receiving blocks padded in this manner will proceed normally.
Appendix F. Security Analysis
The TLS protocol is designed to establish a secure connection between
a client and a server communicating over an insecure channel. This
document makes several traditional assumptions, including that
attackers have substantial computational resources and cannot obtain
secret information from sources outside the protocol. Attackers are
assumed to have the ability to capture, modify, delete, replay, and
otherwise tamper with messages sent over the communication channel.
This appendix outlines how TLS has been designed to resist a variety
of attacks.
F.1. Handshake Protocol
The handshake protocol is responsible for selecting a CipherSpec and
generating a Master Secret, which together comprise the primary
cryptographic parameters associated with a secure session. The
handshake protocol can also optionally authenticate parties who have
certificates signed by a trusted certificate authority.
F.1.1. Authentication and Key Exchange
TLS supports three authentication modes: authentication of both
parties, server authentication with an unauthenticated client, and
total anonymity. Whenever the server is authenticated, the channel
is secure against man-in-the-middle attacks, but completely anonymous
sessions are inherently vulnerable to such attacks. Anonymous
servers cannot authenticate clients. If the server is authenticated,
its certificate message must provide a valid certificate chain
leading to an acceptable certificate authority. Similarly,
authenticated clients must supply an acceptable certificate to the
server. Each party is responsible for verifying that the other’s
certificate is valid and has not expired or been revoked.
The general goal of the key exchange process is to create a
pre_master_secret known to the communicating parties and not to
attackers. The pre_master_secret will be used to generate the
master_secret (see Section 8.1). The master_secret is required to
generate the finished messages, encryption keys, and MAC secrets (see
Sections 7.4.8, 7.4.9, and 6.3). By sending a correct finished
message, parties thus prove that they know the correct
pre_master_secret.
F.1.1.1. Anonymous Key Exchange
Completely anonymous sessions can be established using RSA or Diffie-
Hellman for key exchange. With anonymous RSA, the client encrypts a
pre_master_secret with the server’s uncertified public key extracted
from the server key exchange message. The result is sent in a client
key exchange message. Since eavesdroppers do not know the server’s
private key, it will be infeasible for them to decode the
pre_master_secret.
Note: No anonymous RSA Cipher Suites are defined in this document.
With Diffie-Hellman, the server’s public parameters are contained in
the server key exchange message and the client’s are sent in the
client key exchange message. Eavesdroppers who do not know the
private values should not be able to find the Diffie-Hellman result
(i.e., the pre_master_secret).
Warning: Completely anonymous connections only provide protection
against passive eavesdropping. Unless an independent
tamper-proof channel is used to verify that the finished
messages were not replaced by an attacker, server
authentication is required in environments where active
man-in-the-middle attacks are a concern.
F.1.1.2. RSA Key Exchange and Authentication
With RSA, key exchange and server authentication are combined. The
public key either may be contained in the server’s certificate or may
be a temporary RSA key sent in a server key exchange message. When
temporary RSA keys are used, they are signed by the server’s RSA
certificate. The signature includes the current ClientHello.random,
so old signatures and temporary keys cannot be replayed. Servers may
use a single temporary RSA key for multiple negotiation sessions.
Note: The temporary RSA key option is useful if servers need large
certificates but must comply with government-imposed size
limits on keys used for key exchange.
Note that if ephemeral RSA is not used, compromise of the server’s
static RSA key results in a loss of confidentiality for all sessions
protected under that static key. TLS users desiring Perfect Forward
Secrecy should use DHE cipher suites. The damage done by exposure of
a private key can be limited by changing one’s private key (and
certificate) frequently.
After verifying the server’s certificate, the client encrypts a
pre_master_secret with the server’s public key. By successfully
decoding the pre_master_secret and producing a correct finished
message, the server demonstrates that it knows the private key
corresponding to the server certificate.
When RSA is used for key exchange, clients are authenticated using
the certificate verify message (see Section 7.4.8). The client signs
a value derived from the master_secret and all preceding handshake
messages. These handshake messages include the server certificate,
which binds the signature to the server, and ServerHello.random,
which binds the signature to the current handshake process.
F.1.1.3. Diffie-Hellman Key Exchange with Authentication
When Diffie-Hellman key exchange is used, the server can either
supply a certificate containing fixed Diffie-Hellman parameters or
use the server key exchange message to send a set of temporary
Diffie-Hellman parameters signed with a DSS or RSA certificate.
Temporary parameters are hashed with the hello.random values before
signing to ensure that attackers do not replay old parameters. In
either case, the client can verify the certificate or signature to
ensure that the parameters belong to the server.
If the client has a certificate containing fixed Diffie-Hellman
parameters, its certificate contains the information required to
complete the key exchange. Note that in this case the client and
server will generate the same Diffie-Hellman result (i.e.,
pre_master_secret) every time they communicate. To prevent the
pre_master_secret from staying in memory any longer than necessary,
it should be converted into the master_secret as soon as possible.
Client Diffie-Hellman parameters must be compatible with those
supplied by the server for the key exchange to work.
If the client has a standard DSS or RSA certificate or is
unauthenticated, it sends a set of temporary parameters to the server
in the client key exchange message, then optionally uses a
certificate verify message to authenticate itself.
If the same DH keypair is to be used for multiple handshakes, either
because the client or server has a certificate containing a fixed DH
keypair or because the server is reusing DH keys, care must be taken
to prevent small subgroup attacks. Implementations SHOULD follow the
guidelines found in [SUBGROUP].
Small subgroup attacks are most easily avoided by using one of the
DHE ciphersuites and generating a fresh DH private key (X) for each
handshake. If a suitable base (such as 2) is chosen, g^X mod p can
be computed very quickly, therefore the performance cost is
minimized. Additionally, using a fresh key for each handshake
provides Perfect Forward Secrecy. Implementations SHOULD generate a
new X for each handshake when using DHE ciphersuites.
F.1.2. Version Rollback Attacks
Because TLS includes substantial improvements over SSL Version 2.0,
attackers may try to make TLS-capable clients and servers fall back
to Version 2.0. This attack can occur if (and only if) two TLS-
capable parties use an SSL 2.0 handshake.
Although the solution using non-random PKCS #1 block type 2 message
padding is inelegant, it provides a reasonably secure way for Version
3.0 servers to detect the attack. This solution is not secure
against attackers who can brute force the key and substitute a new
ENCRYPTED-KEY-DATA message containing the same key (but with normal
padding) before the application specified wait threshold has expired.
Parties concerned about attacks of this scale should not use 40-bit
encryption keys. Altering the padding of the least-significant 8
bytes of the PKCS padding does not impact security for the size of
the signed hashes and RSA key lengths used in the protocol, since
this is essentially equivalent to increasing the input block size by
8 bytes.
F.1.3. Detecting Attacks against the Handshake Protocol
An attacker might try to influence the handshake exchange to make the
parties select different encryption algorithms than they would
normally chooses.
For this attack, an attacker must actively change one or more
handshake messages. If this occurs, the client and server will
compute different values for the handshake message hashes. As a
result, the parties will not accept each others’ finished messages.
Without the master_secret, the attacker cannot repair the finished
messages, so the attack will be discovered.
F.1.4. Resuming Sessions
When a connection is established by resuming a session, new
ClientHello.random and ServerHello.random values are hashed with the
session’s master_secret. Provided that the master_secret has not
been compromised and that the secure hash operations used to produce
the encryption keys and MAC secrets are secure, the connection should
be secure and effectively independent from previous connections.
Attackers cannot use known encryption keys or MAC secrets to
compromise the master_secret without breaking the secure hash
operations (which use both SHA and MD5).
Sessions cannot be resumed unless both the client and server agree.
If either party suspects that the session may have been compromised,
or that certificates may have expired or been revoked, it should
force a full handshake. An upper limit of 24 hours is suggested for
session ID lifetimes, since an attacker who obtains a master_secret
may be able to impersonate the compromised party until the
corresponding session ID is retired. Applications that may be run in