
    \dr                         d Z ddlmZ ddlmZ ddlmZ ddlmZ  e ee	
                    d                                        d          j                  Z G d d	ej                  Z G d
 d          Zd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)FilePathzutf-8s
   server.pemc                       e Zd ZdZdZd ZdS )ClientTLSContextz:
    SSL Context Factory for client-side connections.
       c                 >    t          j        t           j                  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)selfs    8lib/python3.11/site-packages/twisted/test/ssl_helpers.py
getContextzClientTLSContext.getContext   s     {3,---    N)__name__
__module____qualname____doc__isClientr    r   r   r   r      s4          H. . . . .r   r   c                   (    e Zd ZdZdZedfdZd ZdS )ServerTLSContextz:
    SSL Context Factory for server-side connections.
    r   Nc                 >    || _         |t          j        }|| _        d S )N)filenamer   r   _method)r   r   methods      r   __init__zServerTLSContext.__init__-   s!     >&Fr   c                     t          j        | 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.
        )r   r   r   use_certificate_filer   use_privatekey_file)r   ctxs     r   r   zServerTLSContext.getContext4   sF     k$,''  ///...
r   )r   r   r   r   r   certPathr   r   r   r   r   r   r   &   sM          H (        r   r   N)r   OpenSSLr   twisted.internetr   twisted.python.compatr   twisted.python.filepathr   __file__encodesiblingpathr"   ClientContextFactoryr   r   r   r   r   <module>r,      s                       . . . . . . , , , , , ,<!9!9::BB=QQVWW. . . . .s/ . . .$         r   