HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/twisted/test/__pycache__/ssl_helpers.cpython-310.pyc
o

�br�@srdZddlmZddlmZddlmZddlmZeee	�
d���d�j�Z
Gdd	�d	ej�ZGd
d�d�ZdS)
z�
Helper classes for twisted.test.test_ssl.

They are in a separate module so they will not prevent test_ssl importing if
pyOpenSSL is unavailable.
�)�SSL)�ssl)�nativeString)�FilePathzutf-8s
server.pemc@seZdZdZdZdd�ZdS)�ClientTLSContextz:
    SSL Context Factory for client-side connections.
    �cCst�tj�S)z�
        Return an L{SSL.Context} to be use for client-side connections.

        Will not return a cached context.
        This is done to improve the test coverage as most implementation
        are caching the context.
        )r�Context�
SSLv23_METHOD)�self�r�:/usr/lib/python3/dist-packages/twisted/test/ssl_helpers.py�
getContextszClientTLSContext.getContextN)�__name__�
__module__�__qualname__�__doc__�isClientr
rrrrrsrc@s*eZdZdZdZedfdd�Zdd�ZdS)�ServerTLSContextz:
    SSL Context Factory for server-side connections.
    rNcCs||_|dur
tj}||_dS)N)�filenamerr	�_method)r
r�methodrrr�__init__-s
zServerTLSContext.__init__cCs(t�|j�}|�|j�|�|j�|S)z�
        Return an L{SSL.Context} to be use for server-side connections.

        Will not return a cached context.
        This is done to improve the test coverage as most implementation
        are caching the context.
        )rrr�use_certificate_filer�use_privatekey_file)r
�ctxrrrr
4szServerTLSContext.getContext)rrrrr�certPathrr
rrrrr&s
rN)r�OpenSSLr�twisted.internetr�twisted.python.compatr�twisted.python.filepathr�__file__�encode�sibling�pathr�ClientContextFactoryrrrrrr�<module>s