module documentation
Class AcceptableCiphersTests Tests for twisted.internet._sslverify.OpenSSLAcceptableCiphers.
Class ALPNTests ALPN protocol selection.
Class ChooseDiffieHellmanEllipticCurveTests Tests for sslverify._ChooseDiffieHellmanEllipticCurve.
Class ClientOptionsTests Tests for sslverify.optionsForClientTLS.
Class ConstructorsTests No class docstring; 6/6 methods documented
Class DataCallbackProtocol Undocumented
Class DeprecationTests Tests for deprecation of sslverify.OpenSSLCertificateOptions's support of the pickle protocol.
Class DiffieHellmanParametersTests Tests for twisted.internet._sslverify.OpenSSLDHParameters.
Class ExpandCipherStringTests Tests for twisted.internet._sslverify._expandCipherString.
Class FakeChooseDiffieHellmanEllipticCurve A fake implementation of _ChooseDiffieHellmanEllipticCurve
Class FakeContext Introspectable fake of an OpenSSL.SSL.Context.
Class FakeCrypto An introspectable fake of pyOpenSSL's OpenSSL.crypto module.
Class FakeCryptoState State for FakeCrypto
Class FakeCryptoTests Tests for FakeCrypto.
Class FakeLib An introspectable fake of cryptography's lib object.
Class FakeLibState State for FakeLib
Class FakeLibTests Tests for FakeLib.
Class KeyPairTests Tests for sslverify.KeyPair.
Class MultipleCertificateTrustRootTests Test the behavior of the trustRootFromCertificates() API call.
Class NPNAndALPNAbsentTests NPN/ALPN operations fail on platforms that do not support them.
Class NPNOrALPNTests NPN and ALPN protocol selection.
Class OpenSSLCipherTests Tests for twisted.internet._sslverify.OpenSSLCipher.
Class OpenSSLOptionsECDHIntegrationTests ECDH-related integration tests for OpenSSLOptions.
Class OpenSSLOptionsTests Tests for sslverify.OpenSSLOptions.
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 SelectVerifyImplementationTests Tests for _selectVerifyImplementation.
Class ServiceIdentityTests Tests for the verification of the peer's service's identity via the hostname argument to sslverify.OpenSSLCertificateOptions.
Class TrustRootTests Tests for sslverify.OpenSSLCertificateOptions' trustRoot argument, sslverify.platformTrust, and their interactions.
Class WritingProtocol Undocumented
Function certificatesForAuthorityAndServer Create a self-signed CA certificate and server certificate signed by the CA.
Function counter Each time we're called, return the next integer in the natural numbers.
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 makeCertificate Undocumented
Function negotiateProtocol Create the TLS connection and negotiate a next protocol.
Function pathContainingDumpOf Create a temporary file to store some serializable-as-PEM objects in, and return its name.
Constant A_HOST_CERTIFICATE_PEM Undocumented
Constant A_KEYPAIR Undocumented
Constant A_PEER_CERTIFICATE_PEM Undocumented
Variable ctx Undocumented
Variable skipALPN Undocumented
Variable skipNPN Undocumented
Variable skipSNI Undocumented
Variable skipSSL Undocumented
Class _ActualSSLTransport Undocumented
Class _MaybeSSLTransport Undocumented
Class _NotSSLTransport Undocumented
Function _loopbackTLSConnection Common implementation code for both loopbackTLSConnection and loopbackTLSConnectionInMemory. Creates a loopback TLS connection using the provided server and client context factories.
def certificatesForAuthorityAndServer(serviceIdentity='example.com'): (source)

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

Parameters
serviceIdentity:unicodeThe identity (hostname) of the server.
Returns
tuple of (sslverify.Certificate, sslverify.PrivateCertificate)a 2-tuple of (certificate_authority_certificate, server_certificate)
def counter(counter=itertools.count()): (source)

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

def loopbackTLSConnection(trustRoot, privateKeyFile, chainedCertFile=None): (source)

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

Parameters
trustRoot:sslverify.IOpenSSLTrustRootthe trustRoot argument for the client connection's context.
privateKeyFile:str (native string; file name)The name of the file containing the private key.
chainedCertFile:str (native string; file name)The name of the chained certificate file.
Returns
tuple3-tuple of server-protocol, client-protocol, and IOPump
def loopbackTLSConnectionInMemory(trustRoot, privateKey, serverCertificate, clientProtocols=None, serverProtocols=None, clientOptions=None): (source)

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.

Parameters
trustRoot:sslverify.IOpenSSLTrustRootthe trustRoot argument for the client connection's context.
privateKey:str (native string)The private key.
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.
chainedCertFile:str (native string)Undocumented
Returns
tuple3-tuple of server-protocol, client-protocol, and IOPump
def makeCertificate(**kw): (source)

Undocumented

def negotiateProtocol(serverProtocols, clientProtocols, clientOptions=None): (source)

Create the TLS connection and negotiate a next protocol.

Parameters
serverProtocolsThe 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.
Returns
A tuple of the negotiated protocol and the reason the connection was lost.
def pathContainingDumpOf(testCase, *dumpables): (source)

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

Parameters
testCase:twisted.trial.unittest.TestCasea test case to use for generating a temporary directory.
*dumpables:tuple of object with dump method taking int returning bytesarguments 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.
Returns
strthe path to a file where all of the dumpables were dumped in PEM format.
A_HOST_CERTIFICATE_PEM: str = (source)

Undocumented

Value
'''
-----BEGIN CERTIFICATE-----
        MIIC2jCCAkMCAjA5MA0GCSqGSIb3DQEBBAUAMIG0MQswCQYDVQQGEwJVUzEiMCAG
        A1UEAxMZZXhhbXBsZS50d2lzdGVkbWF0cml4LmNvbTEPMA0GA1UEBxMGQm9zdG9u
        MRwwGgYDVQQKExNUd2lzdGVkIE1hdHJpeCBMYWJzMRYwFAYDVQQIEw1NYXNzYWNo
        dXNldHRzMScwJQYJKoZIhvcNAQkBFhhub2JvZHlAdHdpc3RlZG1hdHJpeC5jb20x
        ETAPBgNVBAsTCFNlY3VyaXR5MB4XDTA2MDgxNjAxMDEwOFoXDTA3MDgxNjAxMDEw
...
A_KEYPAIR = (source)

Undocumented

Value
getModule(__name__).filePath.sibling('server.pem').getContent()
A_PEER_CERTIFICATE_PEM: str = (source)

Undocumented

Value
'''
-----BEGIN CERTIFICATE-----
        MIIC3jCCAkcCAjA6MA0GCSqGSIb3DQEBBAUAMIG2MQswCQYDVQQGEwJVUzEiMCAG
        A1UEAxMZZXhhbXBsZS50d2lzdGVkbWF0cml4LmNvbTEPMA0GA1UEBxMGQm9zdG9u
        MRwwGgYDVQQKExNUd2lzdGVkIE1hdHJpeCBMYWJzMRYwFAYDVQQIEw1NYXNzYWNo
        dXNldHRzMSkwJwYJKoZIhvcNAQkBFhpzb21lYm9keUB0d2lzdGVkbWF0cml4LmNv
        bTERMA8GA1UECxMIU2VjdXJpdHkwHhcNMDYwODE2MDEwMTU2WhcNMDcwODE2MDEw
...

Undocumented

skipALPN: str = (source)

Undocumented

Undocumented

Undocumented

Undocumented

def _loopbackTLSConnection(serverOpts, clientOpts): (source)

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

Parameters
serverOpts:OpenSSLCertificateOptions, or any class with an equivalent API.An OpenSSL context factory for the server.
clientOpts:OpenSSLCertificateOptions, or any class with an equivalent API.An OpenSSL context factory for the client.
Returns
tuple5-tuple of server-tls-protocol, server-inner-protocol, client-tls-protocol, client-inner-protocol and IOPump