
    h                        S r SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
  \" \
" \R                  S5      5      R                  S5      R                  5      r " S	 S
\R                   5      r " S S5      rg)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                  &    \ rS rSrSrSrSS jrSrg)ClientTLSContext   z2
SSL Context Factory for client-side connections.
   c                J    [         R                  " [         R                  5      $ )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    _/root/1688_scrapy/alibaba-scraper/venv/lib/python3.13/site-packages/twisted/test/ssl_helpers.py
getContextClientTLSContext.getContext   s     {{3,,--     NreturnzSSL.Context)__name__
__module____qualname____firstlineno____doc__isClientr   __static_attributes__r   r   r   r	   r	      s     H.r   r	   c                  B    \ rS rSrSrSr\S4     SS jjrS	S jrSr	g)
ServerTLSContext'   z2
SSL Context Factory for server-side connections.
r   Nc                B    Xl         Uc  [        R                  nX l        g )N)filenamer   r   _method)r   r"   methods      r   __init__ServerTLSContext.__init__.   s     !>&&Fr   c                    [         R                  " U R                  5      nUR                  U R                  5        UR                  U R                  5        U$ )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   ServerTLSContext.getContext7   s?     kk$,,'  /.
r   )r#   r"   )r"   zstr | bytesr$   z
int | Noner   Noner   )
r   r   r   r   r   r   certPathr%   r   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>r8      s`    #    . ,!9:BB=QVVW.s// .$ r   