Tests for twisted.internet._sslverify.

Function counter Each time we're called, return the next integer in the natural numbers.
Function makeCertificate Undocumented
Function certificatesForAuthorityAndServer Create a self-signed CA certificate and server certificate signed by the CA.
Function loopbackTLSConnection Create a loopback TLS connection with the given trust and keys.
Function loopbackTLSConnectionInMemory Create a loopback TLS connection with the given trust and keys. Like loopbackTLSConnection, but using in-memory certificates and keys rather than writing them to disk.
Function pathContainingDumpOf Create a temporary file to store some serializable-as-PEM objects in, and return its name.
Class DataCallbackProtocol Undocumented
Class WritingProtocol Undocumented
Class FakeContext Introspectable fake of an OpenSSL.SSL.Context.
Class ClientOptionsTests Tests for sslverify.optionsForClientTLS.
Class FakeChooseDiffieHellmanEllipticCurve A fake implementation of _ChooseDiffieHellmanEllipticCurve
Class OpenSSLOptionsTestsMixin A mixin for OpenSSLOptions test cases creates client and server certificates, signs them with a CA, and provides a loopback that creates TLS a connections with them.
Class OpenSSLOptionsTests Tests for sslverify.OpenSSLOptions.
Class OpenSSLOptionsECDHIntegrationTests ECDH-related integration tests for OpenSSLOptions.
Class DeprecationTests Tests for deprecation of sslverify.OpenSSLCertificateOptions's support of the pickle protocol.
Class TrustRootTests Tests for sslverify.OpenSSLCertificateOptions' trustRoot argument, sslverify.platformTrust, and their interactions.
Class ServiceIdentityTests Tests for the verification of the peer's service's identity via the hostname argument to sslverify.OpenSSLCertificateOptions.
Function negotiateProtocol Create the TLS connection and negotiate a next protocol.
Class NPNOrALPNTests NPN and ALPN protocol selection.
Class ALPNTests ALPN protocol selection.
Class NPNAndALPNAbsentTests NPN/ALPN operations fail on platforms that do not support them.
Class ConstructorsTests No class docstring; 6/6 methods documented
Class MultipleCertificateTrustRootTests Test the behavior of the trustRootFromCertificates() API call.
Class OpenSSLCipherTests Tests for twisted.internet._sslverify.OpenSSLCipher.
Class ExpandCipherStringTests Tests for twisted.internet._sslverify._expandCipherString.
Class AcceptableCiphersTests Tests for twisted.internet._sslverify.OpenSSLAcceptableCiphers.
Class DiffieHellmanParametersTests Tests for twisted.internet._sslverify.OpenSSLDHParameters.
Class FakeLibState State for FakeLib
Class FakeLib An introspectable fake of cryptography's lib object.
Class FakeLibTests Tests for FakeLib.
Class FakeCryptoState State for FakeCrypto
Class FakeCrypto An introspectable fake of pyOpenSSL's OpenSSL.crypto module.
Class FakeCryptoTests Tests for FakeCrypto.
Class ChooseDiffieHellmanEllipticCurveTests Tests for sslverify._ChooseDiffieHellmanEllipticCurve.
Class KeyPairTests Tests for sslverify.KeyPair.
Class SelectVerifyImplementationTests Tests for _selectVerifyImplementation.
Function _loopbackTLSConnection Common implementation code for both loopbackTLSConnection and loopbackTLSConnectionInMemory. Creates a loopback TLS connection using the provided server and client context factories.
Class _NotSSLTransport Undocumented
Class _MaybeSSLTransport Undocumented
Class _ActualSSLTransport Undocumented
def counter(counter=itertools.count()):

Each time we're called, return the next integer in the natural numbers.

def makeCertificate(**kw):
Undocumented
def certificatesForAuthorityAndServer(serviceIdentity=u'example.com'):

Create a self-signed CA certificate and server certificate signed by the CA.

ParametersserviceIdentityThe identity (hostname) of the server. (type: unicode)
Returnsa 2-tuple of (certificate_authority_certificate, server_certificate) (type: tuple of (sslverify.Certificate, sslverify.PrivateCertificate))
def _loopbackTLSConnection(serverOpts, clientOpts):

Common implementation code for both loopbackTLSConnection and loopbackTLSConnectionInMemory. Creates a loopback TLS connection using the provided server and client context factories.

ParametersserverOptsAn OpenSSL context factory for the server. (type: OpenSSLCertificateOptions, or any class with an equivalent API.)
clientOptsAn OpenSSL context factory for the client. (type: OpenSSLCertificateOptions, or any class with an equivalent API.)
Returns5-tuple of server-tls-protocol, server-inner-protocol, client-tls-protocol, client-inner-protocol and IOPump (type: tuple)
def loopbackTLSConnection(trustRoot, privateKeyFile, chainedCertFile=None):

Create a loopback TLS connection with the given trust and keys.

ParameterstrustRootthe trustRoot argument for the client connection's context. (type: sslverify.IOpenSSLTrustRoot)
privateKeyFileThe name of the file containing the private key. (type: str (native string; file name))
chainedCertFileThe name of the chained certificate file. (type: str (native string; file name))
Returns3-tuple of server-protocol, client-protocol, and IOPump (type: tuple)
def loopbackTLSConnectionInMemory(trustRoot, privateKey, serverCertificate, clientProtocols=None, serverProtocols=None, clientOptions=None):

Create a loopback TLS connection with the given trust and keys. Like loopbackTLSConnection, but using in-memory certificates and keys rather than writing them to disk.

ParameterstrustRootthe trustRoot argument for the client connection's context. (type: sslverify.IOpenSSLTrustRoot)
privateKeyThe private key. (type: str (native string))
serverCertificateThe certificate used by the server.
clientProtocolsThe protocols the client is willing to negotiate using NPN/ALPN.
serverProtocolsThe protocols the server is willing to negotiate using NPN/ALPN.
clientOptionsThe type of OpenSSLCertificateOptions class to use for the client. Defaults to OpenSSLCertificateOptions.
Returns3-tuple of server-protocol, client-protocol, and IOPump (type: tuple)
def pathContainingDumpOf(testCase, *dumpables):

Create a temporary file to store some serializable-as-PEM objects in, and return its name.

ParameterstestCasea test case to use for generating a temporary directory. (type: twisted.trial.unittest.TestCase)
dumpablesarguments are objects from pyOpenSSL with a dump method, taking a pyOpenSSL file-type constant, such as OpenSSL.crypto.FILETYPE_PEM or OpenSSL.crypto.FILETYPE_ASN1. (type: tuple of object with dump method taking int returning bytes)
Returnsthe path to a file where all of the dumpables were dumped in PEM format. (type: str)
def negotiateProtocol(serverProtocols, clientProtocols, clientOptions=None):

Create the TLS connection and negotiate a next protocol.

ParametersserverProtocolsThe protocols the server is willing to negotiate.
clientProtocolsThe protocols the client is willing to negotiate.
clientOptionsThe type of OpenSSLCertificateOptions class to use for the client. Defaults to OpenSSLCertificateOptions.
ReturnsA tuple of the negotiated protocol and the reason the connection was lost.
API Documentation for twisted, generated by pydoctor at 2020-03-25 17:34:30.