
    Vh                        d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
  e e
ej                  d            j                  d      j                        Z G d	 d
ej                         Z G d d      Zy)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.
    )annotations)SSL)ssl)nativeString)FilePathzutf-8s
   server.pemc                      e Zd ZdZdZddZy)ClientTLSContextz:
    SSL Context Factory for client-side connections.
       c                H    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    H/home/dcms/DCMS/lib/python3.12/site-packages/twisted/test/ssl_helpers.py
getContextzClientTLSContext.getContext   s     {{3,,--    NreturnzSSL.Context)__name__
__module____qualname____doc__isClientr    r   r   r	   r	      s     H.r   r	   c                  4    e Zd ZdZdZedf	 	 	 	 	 ddZddZy)ServerTLSContextz:
    SSL Context Factory for server-side connections.
    r   Nc                D    || _         |t        j                  }|| _        y )N)filenamer   r   _method)r   r   methods      r   __init__zServerTLSContext.__init__.   s"     !>&&Fr   c                    t        j                  | j                        }|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.getContext7   s?     kk$,,'  /.
r   )r   zstr | bytesr   z
int | Noner   Noner   )r   r   r   r   r   certPathr    r   r   r   r   r   r   '   s7     H '/T#8B	r   r   N)r   
__future__r   OpenSSLr   twisted.internetr   twisted.python.compatr   twisted.python.filepathr   __file__encodesiblingpathr&   ClientContextFactoryr	   r   r   r   r   <module>r1      s`    #    . ,!9:BB=QVVW.s// .$ r   