GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing docs.python.org — ssl — TLS/SSL wrapper for socket objects
|
client / server |
SSLv2 |
SSLv3 |
TLS [3] |
TLSv1 |
TLSv1.1 |
TLSv1.2 |
SSLv2 |
yes |
no |
no [1] |
no |
no |
no |
SSLv3 |
no |
yes |
no [2] |
no |
no |
no |
TLS (SSLv23) [3] |
no [1] |
no [2] |
yes |
yes |
yes |
yes |
TLSv1 |
no |
no |
yes |
yes |
no |
no |
TLSv1.1 |
no |
no |
yes |
no |
yes |
no |
TLSv1.2 |
no |
no |
yes |
no |
no |
yes |
Footnotes
See also
create_default_context() lets the ssl module choose
security settings for a given purpose.
Changed in version 3.6: The context is created with secure default values. The options
OP_NO_COMPRESSION, OP_CIPHER_SERVER_PREFERENCE,
OP_SINGLE_DH_USE, OP_SINGLE_ECDH_USE,
OP_NO_SSLv2,
and OP_NO_SSLv3 (except for PROTOCOL_SSLv3) are
set by default. The initial cipher suite list contains only HIGH
ciphers, no NULL ciphers and no MD5 ciphers.
Deprecated since version 3.10: SSLContext without protocol argument is deprecated. The
context class will either require PROTOCOL_TLS_CLIENT or
PROTOCOL_TLS_SERVER protocol in the future.
Changed in version 3.10: The default cipher suites now include only secure AES and ChaCha20
ciphers with forward secrecy and security level 2. RSA and DH keys with
less than 2048 bits and ECC keys with less than 224 bits are prohibited.
PROTOCOL_TLS, PROTOCOL_TLS_CLIENT, and
PROTOCOL_TLS_SERVER use TLS 1.2 as minimum TLS version.
Note
SSLContext only supports limited mutation once it has been used
by a connection. Adding new certificates to the internal trust store is
allowed, but changing ciphers, verification settings, or mTLS
certificates may result in surprising behavior.
Note
SSLContext is designed to be shared and used by multiple
connections.
Thus, it is thread-safe as long as it is not reconfigured after being
used by a connection.
SSLContext objects have the following methods and attributes:
Get statistics about quantities of loaded X.509 certificates, count of X.509 certificates flagged as CA certificates and certificate revocation lists as dictionary.
Example for a context with one CA cert and one other cert:
>>> context.cert_store_stats() {'crl': 0, 'x509_ca': 1, 'x509': 2}
Added in version 3.4.
Load a private key and the corresponding certificate. The certfile string must be the path to a single file in PEM format containing the certificate as well as any number of CA certificates needed to establish the certificate’s authenticity. The keyfile string, if present, must point to a file containing the private key. Otherwise the private key will be taken from certfile as well. See the discussion of Certificates for more information on how the certificate is stored in the certfile.
The password argument may be a function to call to get the password for decrypting the private key. It will only be called if the private key is encrypted and a password is necessary. It will be called with no arguments, and it should return a string, bytes, or bytearray. If the return value is a string it will be encoded as UTF-8 before using it to decrypt the key. Alternatively a string, bytes, or bytearray value may be supplied directly as the password argument. It will be ignored if the private key is not encrypted and no password is needed.
If the password argument is not specified and a password is required, OpenSSL’s built-in password prompting mechanism will be used to interactively prompt the user for a password.
An SSLError is raised if the private key doesn’t
match with the certificate.
Changed in version 3.3: New optional argument password.
Load a set of default “certification authority” (CA) certificates from
default locations. On Windows it loads CA certs from the CA and
ROOT system stores. On all systems it calls
SSLContext.set_default_verify_paths(). In the future the method may
load CA certificates from other locations, too.
The purpose flag specifies what kind of CA certificates are loaded. The
default settings Purpose.SERVER_AUTH loads certificates, that are
flagged and trusted for TLS web server authentication (client side
sockets). Purpose.CLIENT_AUTH loads CA certificates for client
certificate verification on the server side.
Added in version 3.4.
Load a server’s Encrypted Client Hello (ECH) private key and configuration. The keyfile must be the path to a PEM file containing a private key followed by its matching ECHConfigList.
The password argument is used to decrypt encrypted private keys. It accepts
a string, bytes, bytearray, or a callable returning one of those types, as in
load_cert_chain().
Each call adds keys and configurations to those already loaded into the context. If for_retry is true, the new configurations are included in ECH retry configurations sent to clients.
Raises SSLError if the context uses PROTOCOL_TLS_CLIENT.
Only available when HAS_ECH is True.
Added in version 3.16.
Load a set of “certification authority” (CA) certificates used to validate
other peers’ certificates when verify_mode is other than
CERT_NONE. At least one of cafile or capath must be specified.
This method can also load certification revocation lists (CRLs) in PEM or
DER format. In order to make use of CRLs, SSLContext.verify_flags
must be configured properly.
The cafile string, if present, is the path to a file of concatenated CA certificates in PEM format. See the discussion of Certificates for more information about how to arrange the certificates in this file.
The capath string, if present, is the path to a directory containing several CA certificates in PEM format, following an OpenSSL specific layout.
The cadata object, if present, is either an ASCII string of one or more PEM-encoded certificates or a bytes-like object of DER-encoded certificates. Like with capath extra lines around PEM-encoded certificates are ignored but at least one certificate must be present.
Changed in version 3.4: New optional argument cadata
Get a list of loaded “certification authority” (CA) certificates. If the
binary_form parameter is False each list
entry is a dict like the output of SSLSocket.getpeercert(). Otherwise
the method returns a list of DER-encoded certificates. The returned list
does not contain certificates from capath unless a certificate was
requested and loaded by a SSL connection.
Note
Certificates in a capath directory aren’t loaded unless they have been used at least once.
Added in version 3.4.
Get a list of enabled ciphers. The list is in order of cipher priority.
See SSLContext.set_ciphers().
Example:
>>> ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23) >>> ctx.set_ciphers('ECDHE+AESGCM:!ECDSA') >>> ctx.get_ciphers() [{'aead': True, 'alg_bits': 256, 'auth': 'auth-rsa', 'description': 'ECDHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH Au=RSA ' 'Enc=AESGCM(256) Mac=AEAD', 'digest': None, 'id': 50380848, 'kea': 'kx-ecdhe', 'name': 'ECDHE-RSA-AES256-GCM-SHA384', 'protocol': 'TLSv1.2', 'strength_bits': 256, 'symmetric': 'aes-256-gcm'}, {'aead': True, 'alg_bits': 128, 'auth': 'auth-rsa', 'description': 'ECDHE-RSA-AES128-GCM-SHA256 TLSv1.2 Kx=ECDH Au=RSA ' 'Enc=AESGCM(128) Mac=AEAD', 'digest': None, 'id': 50380847, 'kea': 'kx-ecdhe', 'name': 'ECDHE-RSA-AES128-GCM-SHA256', 'protocol': 'TLSv1.2', 'strength_bits': 128, 'symmetric': 'aes-128-gcm'}]
Added in version 3.6.
Get a list of groups implemented for key agreement, taking into
account the current TLS minimum_version and
maximum_version values. For example:
>>> ctx = ssl.create_default_context() >>> ctx.minimum_version = ssl.TLSVersion.TLSv1_3 >>> ctx.maximum_version = ssl.TLSVersion.TLSv1_3 >>> ctx.get_groups() ['secp256r1', 'secp384r1', 'secp521r1', 'x25519', 'x448', ...]
By default, this method returns only the preferred IANA names for the
available groups. However, if the include_aliases parameter is set to
True this method will also return any associated aliases such as
the ECDH curve names supported in older versions of OpenSSL.
Added in version 3.15.
Load a set of default “certification authority” (CA) certificates from a filesystem path defined when building the OpenSSL library. Unfortunately, there’s no easy way to know whether this method succeeds: no error is returned if no certificates are to be found. When the OpenSSL library is provided as part of the operating system, though, it is likely to be configured properly.
Set the allowed ciphers for sockets created with this context when
connecting using TLS 1.2 and earlier. The ciphers argument should
be a string in the OpenSSL cipher list format.
To set allowed TLS 1.3 ciphers, use SSLContext.set_ciphersuites().
If no cipher can be selected (because compile-time options or other
configuration forbids use of all the specified ciphers), an
SSLError will be raised.
Note
When connected, the SSLSocket.cipher() method of SSL sockets will
return details about the negotiated cipher.
Set the allowed ciphers for sockets created with this context when
connecting using TLS 1.3. The ciphersuites argument should be a
colon-separate string of TLS 1.3 cipher names. If no cipher can be
selected (because compile-time options or other configuration forbids
use of all the specified ciphers), an SSLError will be raised.
Note
When connected, the SSLSocket.cipher() method of SSL sockets will
return details about the negotiated cipher.
Added in version 3.15.
Set the groups allowed for key agreement for sockets created with this context. It should be a string in the OpenSSL group list format.
Note
When connected, the SSLSocket.group() method of SSL sockets will
return the group used for key agreement on that connection.
Added in version 3.15.
Set the signature algorithms allowed for certificate-based client authentication. It should be a string in the OpenSSL client sigalgs list format.
Note
When connected, the SSLSocket.client_sigalg() method of SSL
sockets will return the signature algorithm used for performing
certificate-based client authentication on that connection.
Added in version 3.15.
Set the signature algorithms allowed for the server to complete the TLS handshake. It should be a string in the OpenSSL sigalgs list format.
Note
When connected, the SSLSocket.server_sigalg() method of SSL
sockets will return the signature algorithm used by the server to
complete the TLS handshake on that connection.
Added in version 3.15.
Specify which protocols the socket should advertise during the SSL/TLS
handshake. It should be a list of ASCII strings, like ['http/1.1',
'spdy/2'], ordered by preference. The selection of a protocol will happen
during the handshake, and will play out according to RFC 7301. After a
successful handshake, the SSLSocket.selected_alpn_protocol() method will
return the agreed-upon protocol.
This method will raise NotImplementedError if HAS_ALPN is
False.
Added in version 3.5.
Sets an Encrypted Client Hello (ECH) configuration, which may be discovered from
an HTTPS resource record in DNS or from
SSLECHRejectedError.retry_config after ECH rejection.
The configuration applies to every connection made from the context, and a
server that cannot decrypt it rejects the connection with
SSLECHRejectedError. Because ECH configurations are published per
host, a context with a configuration should only be used for connections to
the hosts that publish it. To use a configuration for a single connection,
pass it as the ech_config argument of wrap_socket() or
wrap_bio() instead.
Raises SSLError if the input is invalid or contains no usable
configuration.
The ech_config parameter should be a bytes-like object containing an ECHConfigList in binary or Base64 encoding.
Note
OpenSSL 4.0 can reject the entire list with SSLError if one entry
is unusable. It also rejects binary lists whose first entry
uses an unsupported ECH version, although unknown versions after a
supported entry are skipped.
These limitations prevent falling back to usable configurations as
described in RFC 9849.
Raises SSLError if the context uses PROTOCOL_TLS_SERVER.
Only available when HAS_ECH is True.
Added in version 3.16.
Specify which protocols the socket should advertise during the SSL/TLS
handshake. It should be a list of strings, like ['http/1.1', 'spdy/2'],
ordered by preference. The selection of a protocol will happen during the
handshake, and will play out according to the Application Layer Protocol Negotiation. After a
successful handshake, the SSLSocket.selected_npn_protocol() method will
return the agreed-upon protocol.
This method will raise NotImplementedError if HAS_NPN is
False.
Added in version 3.3.
Deprecated since version 3.10: NPN has been superseded by ALPN
Specify which protocols the socket should advertise during the TLS
handshake in the outer ClientHello when ECH is used. The protocols
argument accepts the same values as for
set_alpn_protocols().
Note
OpenSSL 4.0 validates the server’s ALPN selection against the inner
protocol list even when ECH is rejected. If the server selects an outer
protocol absent from the inner list, the handshake fails with a SSLError.
To support ECH rejection and retry on affected versions, choose outer
protocols that also appear in the inner list.
Only available when HAS_ECH is True.
Added in version 3.16.
Register a callback function that will be called after the TLS Client Hello handshake message has been received by the SSL/TLS server when the TLS client specifies a server name indication. The server name indication mechanism is specified in RFC 6066 section 3 - Server Name Indication.
Only one callback can be set per SSLContext. If sni_callback
is set to None then the callback is disabled. Calling this function a
subsequent time will disable the previously registered callback.
The callback function will be called with three
arguments; the first being the ssl.SSLSocket, the second is a string
that represents the server name that the client is intending to communicate
(or None if the TLS Client Hello does not contain a server name)
and the third argument is the original SSLContext. The server name
argument is text. For internationalized domain name, the server
name is an IDN A-label ("xn--pythn-mua.org").
A typical use of this callback is to change the ssl.SSLSocket’s
SSLSocket.context attribute to a new object of type
SSLContext representing a certificate chain that matches the server
name.
If the callback assigns a new context to SSLSocket.context, any
further ClientHello message on the same connection (for example after a
TLS 1.3 HelloRetryRequest) is dispatched to the new context’s
sni_callback, if it has one; the original callback is not called again
for that connection.
Due to the early negotiation phase of the TLS connection, only limited
methods and attributes are usable like
SSLSocket.selected_alpn_protocol() and SSLSocket.context.
The SSLSocket.getpeercert(), SSLSocket.get_verified_chain(),
SSLSocket.get_unverified_chain() SSLSocket.cipher()
and SSLSocket.compression() methods require that
the TLS connection has progressed beyond the TLS Client Hello and therefore
will not return meaningful values nor can they be called safely.
The sni_callback function must return None to allow the
TLS negotiation to continue. If a TLS failure is required, a constant
ALERT_DESCRIPTION_* can be
returned. Other return values will result in a TLS fatal error with
ALERT_DESCRIPTION_INTERNAL_ERROR.
If an exception is raised from the sni_callback function the TLS
connection will terminate with a fatal TLS alert message
ALERT_DESCRIPTION_HANDSHAKE_FAILURE.
This method will raise NotImplementedError if the OpenSSL library
had OPENSSL_NO_TLSEXT defined when it was built.
Added in version 3.7.
Changed in version 3.16: After the callback assigns a new SSLSocket.context, later
ClientHello messages on the connection are dispatched to the new
context’s sni_callback.
This is a legacy API retained for backwards compatibility. When possible,
you should use sni_callback instead. The given server_name_callback
is similar to sni_callback, except that when the server hostname is an
IDN-encoded internationalized domain name, the server_name_callback
receives a decoded U-label ("pythön.org").
If there is a decoding error on the server name, the TLS connection will
terminate with an ALERT_DESCRIPTION_INTERNAL_ERROR fatal TLS
alert message to the client.
Added in version 3.4.
Load the key generation parameters for Diffie-Hellman (DH) key exchange. Using DH key exchange improves forward secrecy at the expense of computational resources (both on the server and on the client). The dhfile parameter should be the path to a file containing DH parameters in PEM format.
This setting doesn’t apply to client sockets. You can also use the
OP_SINGLE_DH_USE option to further improve security.
Added in version 3.3.
Set the curve name for Elliptic Curve-based Diffie-Hellman (ECDH) key
exchange. ECDH is significantly faster than regular DH while arguably
as secure. The curve_name parameter should be a string describing
a well-known elliptic curve, for example prime256v1 for a widely
supported curve.
This setting doesn’t apply to client sockets. You can also use the
OP_SINGLE_ECDH_USE option to further improve security.
This method is not available if HAS_ECDH is False.
Added in version 3.3.
See also
Vincent Bernat.
Wrap an existing Python socket sock and return an instance of
SSLContext.sslsocket_class (default SSLSocket). The
returned SSL socket is tied to the context, its settings and certificates.
sock must be a SOCK_STREAM socket; other
socket types are unsupported.
The parameter server_side is a boolean which identifies whether
server-side or client-side behavior is desired from this socket.
For client-side sockets, if sock is not yet connected, the underlying
SSL object is created when connect() is called.
For server-side sockets, if the socket has no remote peer, it is assumed
to be a listening socket, and the server-side SSL wrapping is
automatically performed on client connections accepted via the
accept() method. The method may raise SSLError.
On client connections, the optional parameter server_hostname specifies
the hostname of the service which we are connecting to. This allows a
single server to host multiple SSL-based services with distinct certificates,
quite similarly to HTTP virtual hosts. Specifying server_hostname will
raise a ValueError if server_side is true.
The parameter do_handshake_on_connect specifies whether to do the SSL
handshake automatically after doing a socket.connect(), or whether the
application program will call it explicitly, by invoking the
SSLSocket.do_handshake() method. Calling
SSLSocket.do_handshake() explicitly gives the program control over the
blocking behavior of the socket I/O involved in the handshake.
The parameter suppress_ragged_eofs specifies how the
SSLSocket.recv() method should signal unexpected EOF from the other end
of the connection. If specified as True (the default), it returns a
normal EOF (an empty bytes object) in response to unexpected EOF errors
raised from the underlying socket; if False, it will raise the
exceptions back to the caller.
session, see session.
ech_config, see SSLSocket.set_ech_config(). Specifying
ech_config will raise a ValueError if server_side is true, and
a NotImplementedError if HAS_ECH is False.
To wrap an SSLSocket in another SSLSocket, use
SSLContext.wrap_bio().
Changed in version 3.5: Always allow a server_hostname to be passed, even if OpenSSL does not have SNI.
Changed in version 3.6: session argument was added.
Changed in version 3.7: The method returns an instance of SSLContext.sslsocket_class
instead of hard-coded SSLSocket.
Changed in version 3.16: ech_config argument was added.
The return type of SSLContext.wrap_socket(), defaults to
SSLSocket. The attribute can be assigned to on instances of
SSLContext in order to return a custom subclass of
SSLSocket.
Added in version 3.7.
Wrap the BIO objects incoming and outgoing and return an instance of
SSLContext.sslobject_class (default SSLObject). The SSL
routines will read input data from the incoming BIO and write data to the
outgoing BIO.
The server_side, server_hostname, session and ech_config
parameters have the same meaning as in SSLContext.wrap_socket(),
and are validated in the same way: in particular a ValueError is raised when
check_hostname is enabled but no server_hostname is
given, since there would be no name to match the peer’s certificate
against.
Changed in version 3.6: session argument was added.
Changed in version 3.7: The method returns an instance of SSLContext.sslobject_class
instead of hard-coded SSLObject.
Changed in version 3.16: The server_side, server_hostname and session parameters are now
validated as SSLContext.wrap_socket() validates them. Previously
a context with check_hostname enabled and no
server_hostname was accepted, and verified the certificate chain but
never the peer’s identity.
Changed in version 3.16: ech_config argument was added.
The return type of SSLContext.wrap_bio(), defaults to
SSLObject. The attribute can be overridden on instance of class
in order to return a custom subclass of SSLObject.
Added in version 3.7.
Get statistics about the SSL sessions created or managed by this context. A dictionary is returned which maps the names of each piece of information to their numeric values. For example, here is the total number of hits and misses in the session cache since the context was created:
>>> stats = context.session_stats() >>> stats['hits'], stats['misses'] (0, 0)
Whether to match the peer cert’s hostname in
SSLSocket.do_handshake(). The context’s
verify_mode must be set to CERT_OPTIONAL or
CERT_REQUIRED, and you must pass server_hostname to
wrap_socket() in order to match the hostname. Enabling
hostname checking automatically sets verify_mode from
CERT_NONE to CERT_REQUIRED. It cannot be set back to
CERT_NONE as long as hostname checking is enabled. The
PROTOCOL_TLS_CLIENT protocol enables hostname checking by default.
With other protocols, hostname checking must be enabled explicitly.
Example:
import socket, ssl context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2) context.verify_mode = ssl.CERT_REQUIRED context.check_hostname = True context.load_default_certs() s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ssl_sock = context.wrap_socket(s, server_hostname='www.verisign.com') ssl_sock.connect(('www.verisign.com', 443))
Added in version 3.4.
Changed in version 3.7: verify_mode is now automatically changed
to CERT_REQUIRED when hostname checking is enabled and
verify_mode is CERT_NONE. Previously
the same operation would have failed with a ValueError.
Write TLS keys to a keylog file, whenever key material is generated or received. The keylog file is designed for debugging purposes only. The file format is specified by NSS and used by many traffic analyzers such as Wireshark. The log file is opened in append-only mode. Writes are synchronized between threads, but not between processes.
Added in version 3.8.
A TLSVersion enum member representing the highest supported
TLS version. The value defaults to TLSVersion.MAXIMUM_SUPPORTED.
The attribute is read-only for protocols other than PROTOCOL_TLS,
PROTOCOL_TLS_CLIENT, and PROTOCOL_TLS_SERVER.
The attributes maximum_version,
minimum_version and
SSLContext.options all affect the supported SSL
and TLS versions of the context. The implementation does not prevent
invalid combinations. For example a context with
OP_NO_TLSv1_2 in options and
maximum_version set to TLSVersion.TLSv1_2
will not be able to establish a TLS 1.2 connection.
Added in version 3.7.
Like SSLContext.maximum_version except it is the lowest
supported version or TLSVersion.MINIMUM_SUPPORTED.
Added in version 3.7.
Control the number of TLS 1.3 session tickets of a
PROTOCOL_TLS_SERVER context. The setting has no impact on TLS
1.0 to 1.2 connections.
Added in version 3.8.
An integer representing the set of SSL options enabled on this context.
The default value is OP_ALL, but you can specify other options
such as OP_NO_SSLv2 by ORing them together.
Changed in version 3.6: SSLContext.options returns Options flags:
>>> ssl.create_default_context().options <Options.OP_ALL|OP_NO_SSLv3|OP_NO_SSLv2|OP_NO_COMPRESSION: 2197947391>
Deprecated since version 3.7: All OP_NO_SSL* and OP_NO_TLS* options have been deprecated since
Python 3.7. Use SSLContext.minimum_version and
SSLContext.maximum_version instead.
Enable TLS 1.3 post-handshake client authentication. Post-handshake auth is disabled by default and a server can only request a TLS client certificate during the initial handshake. When enabled, a server may request a TLS client certificate at any time after the handshake.
When enabled on client-side sockets, the client signals the server that it supports post-handshake authentication.
When enabled on server-side sockets, SSLContext.verify_mode must
be set to CERT_OPTIONAL or CERT_REQUIRED, too. The
actual client cert exchange is delayed until
SSLSocket.verify_client_post_handshake() is called and some I/O is
performed.
Added in version 3.8.
The protocol version chosen when constructing the context. This attribute is read-only.
Whether check_hostname falls back to verify the cert’s
subject common name in the absence of a subject alternative name
extension (default: true).
Added in version 3.7.
Changed in version 3.10: The flag had no effect with OpenSSL before version 1.1.1l. Python 3.8.9, 3.9.3, and 3.10 include workarounds for previous versions.
An integer representing the security level for the context. This attribute is read-only.
Added in version 3.10.
The flags for certificate verification operations. You can set flags like
VERIFY_CRL_CHECK_LEAF by ORing them together. By default OpenSSL
does neither require nor verify certificate revocation lists (CRLs).
Added in version 3.4.
Changed in version 3.6: SSLContext.verify_flags returns VerifyFlags flags:
>>> ssl.create_default_context().verify_flags <VerifyFlags.VERIFY_X509_TRUSTED_FIRST: 32768>
Whether to try to verify other peers’ certificates and how to behave
if verification fails. This attribute must be one of
CERT_NONE, CERT_OPTIONAL or CERT_REQUIRED.
Changed in version 3.6: SSLContext.verify_mode returns VerifyMode enum:
>>> ssl.create_default_context().verify_mode <VerifyMode.CERT_REQUIRED: 2>
Enables TLS-PSK (pre-shared key) authentication on a client-side connection.
In general, certificate based authentication should be preferred over this method.
The parameter callback is a callable object with the signature:
def callback(hint: str | None) -> tuple[str | None, bytes].
The hint parameter is an optional identity hint sent by the server.
The return value is a tuple in the form (client-identity, psk).
Client-identity is an optional string which may be used by the server to
select a corresponding PSK for the client. The string must be less than or
equal to 256 octets when UTF-8 encoded. PSK is a
bytes-like object representing the pre-shared key. With TLS 1.2
and earlier, return a zero length PSK to reject the connection.
Setting callback to None removes any existing callback.
Note
When using TLS 1.3:
the hint parameter is always None.
client-identity must be a non-empty string.
the PSK is only offered to the server, which may decline it and
authenticate with a certificate instead. That certificate is checked
according to verify_mode, so a client relying on
the PSK to authenticate the server should not set it to
CERT_NONE, or should check SSLSocket.session_reused,
which is true if the PSK was used. A PSK handshake does not need any
CA certificates to be loaded when using CERT_REQUIRED.
a zero length PSK does not reject the connection, it only means that no PSK is offered. An exception raised by the callback has the same effect.
the PSK is used with the SHA-256 handshake digest, so a server can only accept it with a cipher suite that uses SHA-256.
Example usage:
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) context.check_hostname = False context.maximum_version = ssl.TLSVersion.TLSv1_2 context.set_ciphers('PSK') # A simple lambda: psk = bytes.fromhex('c0ffee') context.set_psk_client_callback(lambda hint: (None, psk)) # A table using the hint from the server: psk_table = { 'ServerId_1': bytes.fromhex('c0ffee'), 'ServerId_2': bytes.fromhex('facade') } def callback(hint): return 'ClientId_1', psk_table.get(hint, b'') context.set_psk_client_callback(callback)
This method will raise NotImplementedError if HAS_PSK is
False.
Added in version 3.13.
Enables TLS-PSK (pre-shared key) authentication on a server-side connection.
In general, certificate based authentication should be preferred over this method.
The parameter callback is a callable object with the signature:
def callback(identity: str | None) -> bytes.
The identity parameter is an optional identity sent by the client which can
be used to select a corresponding PSK.
The return value is a bytes-like object representing the pre-shared key.
With TLS 1.2 and earlier, return a zero length PSK to reject the connection.
Setting callback to None removes any existing callback.
The parameter identity_hint is an optional identity hint string sent to
the client. The string must be less than or equal to 256 octets when
UTF-8 encoded.
Note
When using TLS 1.3:
the identity_hint parameter is not sent to the client.
a zero length PSK, or an exception raised by the callback, only
declines the client’s PSK. If a certificate was loaded with
load_cert_chain(), the handshake continues with
certificate authentication instead of failing, so a server relying on
the PSK to authenticate clients should not load one, or should check
SSLSocket.session_reused, which is true if the PSK was used.
the PSK can only be accepted with a cipher suite that uses SHA-256. When a certificate is loaded, OpenSSL’s default TLS 1.3 cipher suite order selects a SHA-384 suite instead, so the PSK is declined even if it matches.
Example usage:
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) context.maximum_version = ssl.TLSVersion.TLSv1_2 context.set_ciphers('PSK') # A simple lambda: psk = bytes.fromhex('c0ffee') context.set_psk_server_callback(lambda identity: psk) # A table using the identity of the client: psk_table = { 'ClientId_1': bytes.fromhex('c0ffee'), 'ClientId_2': bytes.fromhex('facade') } def callback(identity): return psk_table.get(identity, b'') context.set_psk_server_callback(callback, 'ServerId_1')
This method will raise NotImplementedError if HAS_PSK is
False.
Added in version 3.13.
Certificates in general are part of a public-key / private-key system. In this system, each principal, (which may be a machine, or a person, or an organization) is assigned a unique two-part encryption key. One part of the key is public, and is called the public key; the other part is kept secret, and is called the private key. The two parts are related, in that if you encrypt a message with one of the parts, you can decrypt it with the other part, and only with the other part.
A certificate contains information about two principals. It contains the name of a subject, and the subject’s public key. It also contains a statement by a second principal, the issuer, that the subject is who they claim to be, and that this is indeed the subject’s public key. The issuer’s statement is signed with the issuer’s private key, which only the issuer knows. However, anyone can verify the issuer’s statement by finding the issuer’s public key, decrypting the statement with it, and comparing it to the other information in the certificate. The certificate also contains information about the time period over which it is valid. This is expressed as two fields, called “notBefore” and “notAfter”.
In the Python use of certificates, a client or server can use a certificate to prove who they are. The other side of a network connection can also be required to produce a certificate, and that certificate can be validated to the satisfaction of the client or server that requires such validation. The connection attempt can be set to raise an exception if the validation fails. Validation is done automatically, by the underlying OpenSSL framework; the application need not concern itself with its mechanics. But the application does usually need to provide sets of certificates to allow this process to take place.
Python uses files to contain certificates. They should be formatted as “PEM” (see RFC 1422), which is a base-64 encoded form wrapped with a header line and a footer line:
-----BEGIN CERTIFICATE----- ... (certificate in base64 PEM encoding) ... -----END CERTIFICATE-----
The Python files which contain certificates can contain a sequence of certificates, sometimes called a certificate chain. This chain should start with the specific certificate for the principal who “is” the client or server, and then the certificate for the issuer of that certificate, and then the certificate for the issuer of that certificate, and so on up the chain till you get to a certificate which is self-signed, that is, a certificate which has the same subject and issuer, sometimes called a root certificate. The certificates should just be concatenated together in the certificate file. For example, suppose we had a three certificate chain, from our server certificate to the certificate of the certification authority that signed our server certificate, to the root certificate of the agency which issued the certification authority’s certificate:
-----BEGIN CERTIFICATE----- ... (certificate for your server)... -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- ... (the certificate for the CA)... -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- ... (the root certificate for the CA's issuer)... -----END CERTIFICATE-----
If you are going to require validation of the other side of the connection’s
certificate, you need to provide a “CA certs” file, filled with the certificate
chains for each issuer you are willing to trust. Again, this file just contains
these chains concatenated together. For validation, Python will use the first
chain it finds in the file which matches. The platform’s certificates file can
be used by calling SSLContext.load_default_certs(), this is done
automatically with create_default_context().
Often the private key is stored in the same file as the certificate; in this
case, only the certfile parameter to SSLContext.load_cert_chain()
needs to be passed. If the private key is stored
with the certificate, it should come before the first certificate in
the certificate chain:
-----BEGIN RSA PRIVATE KEY----- ... (private key in base64 encoding) ... -----END RSA PRIVATE KEY----- -----BEGIN CERTIFICATE----- ... (certificate in base64 PEM encoding) ... -----END CERTIFICATE-----
If you are going to create a server that provides SSL-encrypted connection services, you will need to acquire a certificate for that service. There are many ways of acquiring appropriate certificates, such as buying one from a certification authority. Another common practice is to generate a self-signed certificate. The simplest way to do this is with the OpenSSL package, using something like the following:
% openssl req -new -x509 -days 365 -nodes -out cert.pem -keyout cert.pem Generating a 1024 bit RSA private key .......++++++ .............................++++++ writing new private key to 'cert.pem' ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [AU]:US State or Province Name (full name) [Some-State]:MyState Locality Name (eg, city) []:Some City Organization Name (eg, company) [Internet Widgits Pty Ltd]:My Organization, Inc. Organizational Unit Name (eg, section) []:My Group Common Name (eg, YOUR name) []:myserver.mygroup.myorganization.com Email Address []:ops@myserver.mygroup.myorganization.com %
The disadvantage of a self-signed certificate is that it is its own root certificate, and no one else will have it in their cache of known (and trusted) root certificates.
To test for the presence of SSL support in a Python installation, user code should use the following idiom:
try: import ssl except ImportError: pass else: ... # do something that requires SSL support
This example creates a SSL context with the recommended security settings for client sockets, including automatic certificate verification:
>>> context = ssl.create_default_context()
If you prefer to tune security settings yourself, you might create a context from scratch (but beware that you might not get the settings right):
>>> context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) >>> context.load_verify_locations("/etc/ssl/certs/ca-bundle.crt")
(this snippet assumes your operating system places a bundle of all CA
certificates in /etc/ssl/certs/ca-bundle.crt; if not, you’ll get an
error and have to adjust the location)
The PROTOCOL_TLS_CLIENT protocol configures the context for cert
validation and hostname verification. verify_mode is
set to CERT_REQUIRED and check_hostname is set
to True. All other protocols create SSL contexts with insecure defaults.
When you use the context to connect to a server, CERT_REQUIRED
and check_hostname validate the server certificate: it
ensures that the server certificate was signed with one of the CA
certificates, checks the signature for correctness, and verifies other
properties like validity and identity of the hostname:
>>> conn = context.wrap_socket(socket.socket(socket.AF_INET), ... server_hostname="www.python.org") >>> conn.connect(("www.python.org", 443))
You may then fetch the certificate:
>>> cert = conn.getpeercert()
Visual inspection shows that the certificate does identify the desired service
(that is, the HTTPS host www.python.org):
>>> pprint.pprint(cert) {'OCSP': ('http://ocsp.digicert.com',), 'caIssuers': ('http://cacerts.digicert.com/DigiCertSHA2ExtendedValidationServerCA.crt',), 'crlDistributionPoints': ('http://crl3.digicert.com/sha2-ev-server-g1.crl', 'http://crl4.digicert.com/sha2-ev-server-g1.crl'), 'issuer': ((('countryName', 'US'),), (('organizationName', 'DigiCert Inc'),), (('organizationalUnitName', 'www.digicert.com'),), (('commonName', 'DigiCert SHA2 Extended Validation Server CA'),)), 'notAfter': 'Sep 9 12:00:00 2016 GMT', 'notBefore': 'Sep 5 00:00:00 2014 GMT', 'serialNumber': '01BB6F00122B177F36CAB49CEA8B6B26', 'subject': ((('businessCategory', 'Private Organization'),), (('1.3.6.1.4.1.311.60.2.1.3', 'US'),), (('1.3.6.1.4.1.311.60.2.1.2', 'Delaware'),), (('serialNumber', '3359300'),), (('streetAddress', '16 Allen Rd'),), (('postalCode', '03894-4801'),), (('countryName', 'US'),), (('stateOrProvinceName', 'NH'),), (('localityName', 'Wolfeboro'),), (('organizationName', 'Python Software Foundation'),), (('commonName', 'www.python.org'),)), 'subjectAltName': (('DNS', 'www.python.org'), ('DNS', 'python.org'), ('DNS', 'pypi.org'), ('DNS', 'docs.python.org'), ('DNS', 'testpypi.org'), ('DNS', 'bugs.python.org'), ('DNS', 'wiki.python.org'), ('DNS', 'hg.python.org'), ('DNS', 'mail.python.org'), ('DNS', 'packaging.python.org'), ('DNS', 'pythonhosted.org'), ('DNS', 'www.pythonhosted.org'), ('DNS', 'test.pythonhosted.org'), ('DNS', 'us.pycon.org'), ('DNS', 'id.python.org')), 'version': 3}
Now the SSL channel is established and the certificate verified, you can proceed to talk with the server:
>>> conn.sendall(b"HEAD / HTTP/1.0\r\nHost: www.python.org\r\n\r\n") >>> pprint.pprint(conn.recv(1024).split(b"\r\n")) [b'HTTP/1.1 200 OK', b'Date: Sat, 18 Oct 2014 18:27:20 GMT', b'Server: nginx', b'Content-Type: text/html; charset=utf-8', b'X-Frame-Options: SAMEORIGIN', b'Content-Length: 45679', b'Accept-Ranges: bytes', b'Via: 1.1 varnish', b'Age: 2188', b'X-Served-By: cache-lcy1134-LCY', b'X-Cache: HIT', b'X-Cache-Hits: 11', b'Vary: Cookie', b'Strict-Transport-Security: max-age=63072000; includeSubDomains', b'Connection: close', b'', b'']
See the discussion of Security considerations below.
For server operation, typically you’ll need to have a server certificate, and
private key, each in a file. You’ll first create a context holding the key
and the certificate, so that clients can check your authenticity. Then
you’ll open a socket, bind it to a port, call listen() on it, and start
waiting for clients to connect:
import socket, ssl context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH) context.load_cert_chain(certfile="mycertfile", keyfile="mykeyfile") bindsocket = socket.socket() bindsocket.bind(('myaddr.example.com', 10023)) bindsocket.listen(5)
When a client connects, you’ll call accept() on the socket to get the
new socket from the other end, and use the context’s SSLContext.wrap_socket()
method to create a server-side SSL socket for the connection:
while True: newsocket, fromaddr = bindsocket.accept() connstream = context.wrap_socket(newsocket, server_side=True) try: deal_with_client(connstream) finally: connstream.shutdown(socket.SHUT_RDWR) connstream.close()
Then you’ll read data from the connstream and do something with it till you
are finished with the client (or the client is finished with you):
def deal_with_client(connstream): data = connstream.recv(1024) # empty data means the client is finished with us while data: if not do_something(connstream, data): # we'll assume do_something returns False # when we're finished with client break data = connstream.recv(1024) # finished with client
And go back to listening for new client connections (of course, a real server would probably handle each client connection in a separate thread, or put the sockets in non-blocking mode and use an event loop).
SSL sockets behave slightly different than regular sockets in non-blocking mode. When working with non-blocking sockets, there are thus several things you need to be aware of:
Most SSLSocket methods will raise either
SSLWantWriteError or SSLWantReadError instead of
BlockingIOError if an I/O operation would
block. SSLWantReadError will be raised if a read operation on
the underlying socket is necessary, and SSLWantWriteError for
a write operation on the underlying socket. Note that attempts to
write to an SSL socket may require reading from the underlying
socket first, and attempts to read from the SSL socket may require
a prior write to the underlying socket.
Changed in version 3.5: In earlier Python versions, the SSLSocket.send() method
returned zero instead of raising SSLWantWriteError or
SSLWantReadError.
Calling select() tells you that the OS-level socket can be
read from (or written to), but it does not imply that there is sufficient
data at the upper SSL layer. For example, only part of an SSL frame might
have arrived. Therefore, you must be ready to handle SSLSocket.recv()
and SSLSocket.send() failures, and retry after another call to
select().
Conversely, since the SSL layer has its own framing, a SSL socket may
still have data available for reading without select()
being aware of it. Therefore, you should first call
SSLSocket.recv() to drain any potentially available data, and then
only block on a select() call if still necessary.
(of course, similar provisions apply when using other primitives such as
poll(), or those in the selectors module)
The SSL handshake itself will be non-blocking: the
SSLSocket.do_handshake() method has to be retried until it returns
successfully. Here is a synopsis using select() to wait for
the socket’s readiness:
while True: try: sock.do_handshake() break except ssl.SSLWantReadError: select.select([sock], [], []) except ssl.SSLWantWriteError: select.select([], [sock], [])
See also
The asyncio module supports non-blocking SSL sockets and provides a higher level Streams API.
It polls for events using the selectors module and
handles SSLWantWriteError, SSLWantReadError and
BlockingIOError exceptions. It runs the SSL handshake asynchronously
as well.
Added in version 3.5.
Ever since the SSL module was introduced in Python 2.6, the SSLSocket
class has provided two related but distinct areas of functionality:
SSL protocol handling
Network IO
The network IO API is identical to that provided by socket.socket,
from which SSLSocket also inherits. This allows an SSL socket to be
used as a drop-in replacement for a regular socket, making it very easy to add
SSL support to an existing application.
Combining SSL protocol handling and network IO usually works well, but there
are some cases where it doesn’t. An example is async IO frameworks that want to
use a different IO multiplexing model than the “select/poll on a file
descriptor” (readiness based) model that is assumed by socket.socket
and by the internal OpenSSL socket IO routines. This is mostly relevant for
platforms like Windows where this model is not efficient. For this purpose, a
reduced scope variant of SSLSocket called SSLObject is
provided.
A reduced-scope variant of SSLSocket representing an SSL protocol
instance that does not contain any network IO methods. This class is
typically used by framework authors that want to implement asynchronous IO
for SSL through memory buffers.
This class implements an interface on top of a low-level SSL object as implemented by OpenSSL. This object captures the state of an SSL connection but does not provide any network IO itself. IO needs to be performed through separate “BIO” objects which are OpenSSL’s IO abstraction layer.
This class has no public constructor. An SSLObject instance
must be created using the wrap_bio() method. This
method will create the SSLObject instance and bind it to a
pair of BIOs. The incoming BIO is used to pass data from Python to the
SSL protocol instance, while the outgoing BIO is used to pass data the
other way around.
The following methods are available:
When compared to SSLSocket, this object lacks the following
features:
Any form of network IO; read() and write() read and write only to
the underlying MemoryBIO buffers.
There is no do_handshake_on_connect machinery. You must always manually
call do_handshake() to start the handshake.
There is no handling of suppress_ragged_eofs. All end-of-file conditions
that are in violation of the protocol are reported via the
SSLEOFError exception.
The method unwrap() call does not return anything,
unlike for an SSL socket where it returns the underlying socket.
The server_name_callback callback passed to
SSLContext.set_servername_callback() will get an SSLObject
instance instead of a SSLSocket instance as its first parameter.
Some notes related to the use of SSLObject:
All IO on an SSLObject is non-blocking.
This means that for example read() will raise an
SSLWantReadError if it needs more data than the incoming BIO has
available.
Changed in version 3.7: SSLObject instances must be created with
wrap_bio(). In earlier versions, it was possible to
create instances directly. This was never documented or officially
supported.
An SSLObject communicates with the outside world using memory buffers. The
class MemoryBIO provides a memory buffer that can be used for this
purpose. It wraps an OpenSSL memory BIO (Basic IO) object:
A memory buffer that can be used to pass data between Python and an SSL protocol instance.
Return the number of bytes currently in the memory buffer.
A boolean indicating whether the memory BIO is current at the end-of-file position.
Read up to n bytes from the memory buffer. If n is not specified or negative, all bytes are returned.
Write the bytes from buf to the memory BIO. The buf argument must be an object supporting the buffer protocol.
The return value is the number of bytes written, which is always equal to the length of buf.
Added in version 3.6.
For client use, if you don’t have any special requirements for your
security policy, it is highly recommended that you use the
create_default_context() function to create your SSL context.
It will load the system’s trusted CA certificates, enable certificate
validation and hostname checking, and try to choose reasonably secure
protocol and cipher settings.
For example, here is how you would use the smtplib.SMTP class to
create a trusted, secure connection to a SMTP server:
>>> import ssl, smtplib >>> smtp = smtplib.SMTP("mail.python.org", port=587) >>> context = ssl.create_default_context() >>> smtp.starttls(context=context) (220, b'2.0.0 Ready to start TLS')
If a client certificate is needed for the connection, it can be added with
SSLContext.load_cert_chain().
By contrast, if you create the SSL context by calling the SSLContext
constructor yourself, it will not have certificate validation nor hostname
checking enabled by default. If you do so, please read the paragraphs below
to achieve a good security level.
When calling the SSLContext constructor directly,
CERT_NONE is the default. Since it does not authenticate the other
peer, it can be insecure, especially in client mode where most of the time you
would like to ensure the authenticity of the server you’re talking to.
Therefore, when in client mode, it is highly recommended to use
CERT_REQUIRED. However, it is in itself not sufficient; you also
have to check that the server certificate, which can be obtained by calling
SSLSocket.getpeercert(), matches the desired service. For many
protocols and applications, the service can be identified by the hostname.
This common check is automatically performed when
SSLContext.check_hostname is enabled.
Changed in version 3.7: Hostname matchings is now performed by OpenSSL. Python no longer uses
match_hostname().
In server mode, if you want to authenticate your clients using the SSL layer
(rather than using a higher-level authentication mechanism), you’ll also have
to specify CERT_REQUIRED and similarly check the client certificate.
SSL versions 2 and 3 are considered insecure and are therefore dangerous to
use. If you want maximum compatibility between clients and servers, it is
recommended to use PROTOCOL_TLS_CLIENT or
PROTOCOL_TLS_SERVER as the protocol version. SSLv2 and SSLv3 are
disabled by default.
>>> client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) >>> client_context.minimum_version = ssl.TLSVersion.TLSv1_2 >>> client_context.maximum_version = ssl.TLSVersion.TLSv1_3
The SSL client context created above will only allow TLSv1.2 and TLSv1.3 (if
supported by your system) connections to a server. PROTOCOL_TLS_CLIENT
implies certificate validation and hostname checks by default. You have to
load certificates into the context.
If you have advanced security requirements, fine-tuning of the ciphers
enabled when negotiating a SSL session is possible through the
SSLContext.set_ciphers() method. Starting from Python 3.2.3, the
ssl module disables certain weak ciphers by default, but you may want
to further restrict the cipher choice. Be sure to read OpenSSL’s documentation
about the cipher list format.
If you want to check which ciphers are enabled by a given cipher list, use
SSLContext.get_ciphers() or the openssl ciphers command on your
system.
If using this module as part of a multi-processed application (using,
for example the multiprocessing or concurrent.futures modules),
be aware that OpenSSL’s internal random number generator does not properly
handle forked processes. Applications must change the PRNG state of the
parent process if they use any SSL feature with os.fork(). Any
successful call of RAND_add() or RAND_bytes() is
sufficient.
Added in version 3.7.
The TLS 1.3 protocol behaves slightly differently than previous version of TLS/SSL. Some new TLS 1.3 features are not yet available.
TLS 1.3 uses a disjunct set of cipher suites. All AES-GCM and ChaCha20
cipher suites are enabled by default. To restrict which TLS 1.3 ciphers
are allowed, the SSLContext.set_ciphersuites() method should be
called instead of SSLContext.set_ciphers(), which only affects
ciphers in older TLS versions. The SSLContext.get_ciphers() method
returns information about ciphers for both TLS 1.3 and earlier versions
and the method SSLSocket.cipher() returns information about the
negotiated cipher for both TLS 1.3 and earlier versions once a connection
is established.
Session tickets are no longer sent as part of the initial handshake and
are handled differently. SSLSocket.session and SSLSession
are not compatible with TLS 1.3.
Client-side certificates are also no longer verified during the initial handshake. A server can request a certificate at any time. Clients process certificate requests while they send or receive application data from the server.
TLS 1.3 features like early data, deferred TLS client cert request, and rekeying are not supported yet.
Added in version 3.16.
Encrypted Client Hello (ECH) encrypts values in the ClientHello record sent when
establishing a TLS connection. It requires an ECHConfigList containing algorithm
parameters, a public key, and a public name used in the unencrypted outer
ClientHello. ECH requires OpenSSL 4.0 or later with ECH enabled; check
HAS_ECH before using it.
Servers can load a PEM file containing their ECH private key and configuration
with SSLContext.load_ech_keys(). Clients use the corresponding public
ECHConfigList, published in DNS for each host, as the ech_config argument of
SSLContext.wrap_socket() or SSLContext.wrap_bio(), or for every
connection from a context with SSLContext.set_ech_config().
A server that has rotated its ECH keys rejects the connection and provides a
retry configuration, which the handshake raises as
SSLECHRejectedError. The following example uses a binary-encoded
ECHConfigList discovered through DNS and retries once with the server’s
SSLECHRejectedError.retry_config if it is not empty, or without ECH
if the authenticated server has securely disabled it.
The following example shows how to connect to a website with HTTP with an ECH configuration:
import http.client import socket import ssl def connect_with_tls_ech(hostname, ech_config): context = ssl.create_default_context() context.set_ech_config(ech_config) sock = socket.create_connection((hostname, 443), timeout=10) family = sock.family address = sock.getpeername() for attempt in range(2): try: if attempt: sock = socket.socket(family, socket.SOCK_STREAM) sock.settimeout(10) sock.connect(address) return context.wrap_socket(sock, server_hostname=hostname) except ssl.SSLECHRejectedError as exc: sock.close() if attempt: raise if exc.retry_config: context.set_ech_config(exc.retry_config) else: context = ssl.create_default_context() except BaseException: sock.close() raise hostname = "python.org" ech_config = ... # Replace with an ECHConfigList discovered through DNS. with connect_with_tls_ech(hostname, ech_config) as ssock: print("ECH status:", ssock.get_ech_status().name) request = ( "GET / HTTP/1.1\r\n" f"Host: {hostname}\r\n" "Connection: close\r\n\r\n" ) ssock.sendall(request.encode("ascii")) with http.client.HTTPResponse(ssock) as response: response.begin() print(f"HTTP {response.status} {response.reason}") for name, value in response.getheaders(): print(f"{name}: {value}") print() print(response.read().decode("utf-8", errors="replace"))
The following classes, methods, and attributes will be useful for using ECH:
See also
socket.socketDocumentation of underlying socket class
Intro from the Apache HTTP Server documentation
Steve Kent
Donald E. Eastlake, Jeffrey I. Schiller, Steve Crocker
David Cooper et al.
Tim Dierks and Eric Rescorla.
Donald E. Eastlake
IANA
IETF
Mozilla