Part of twisted.internet.ssl View Source
If you are writing any client-side TLS code with Twisted, you should use
this as the trustRoot
argument to CertificateOptions
.
The result of this function should be like the up-to-date list of
certificates in a web browser. When developing code that uses
platformTrust
, you can think of it that way. However, the
choice of which certificate authorities to trust is never Twisted's
responsibility. Unless you're writing a very unusual application or
library, it's not your code's responsibility either. The user may use
platform-specific tools for defining which server certificates should be
trusted by programs using TLS. The purpose of using this API is to respect
that decision as much as possible.
This should be a set of trust settings most appropriate for client TLS connections; i.e. those which need to verify a server's authenticity. You should probably use this by default for any client TLS connection that you create. For servers, however, client certificates are typically not verified; or, if they are, their verification will depend on a custom, application-specific certificate authority.
Returns | an appropriate trust settings object for your platform. (type: IOpenSSLTrustRoot ) | |
Raises | NotImplementedError | if this platform is not yet supported by Twisted. At present, only OpenSSL is supported. |
Present Since | 14.0 | |
Note | Currently, platformTrust
depends entirely upon your OpenSSL build supporting a set of "default verify
paths " which correspond to certificate authority trust
roots. Unfortunately, whether this is true of your system is both outside
of Twisted's control and difficult (if not impossible) for Twisted to
detect automatically.
Nevertheless, this ought to work as desired by default on:
Hopefully soon, this API will be updated to use more sophisticated trust-root discovery mechanisms. Until then, you can follow tickets in the Twisted tracker for progress on this implementation on Microsoft Windows, Mac OS X, and a fallback for other platforms which do not have native trust management tools. |