
    9h                        S SK Jr  S SKrS SKJr  S SKJrJrJr  S SK	J
r
Jr  S SKJr  \R                  " \5      rSSSSSSS.             S	S jjrg)
    )annotationsN)PathLike)Purpose
SSLContextcreate_default_context)CallableUnion)Buffer)cafilecapathcadatacertfilekeyfilepasswordc                   U (       d  U(       a   [         R                  SU =(       d    U5        O.Ub+  [         R                  S5        [         R                  SU5        [        [        R
                  XUS9nUb_  [         R                  SU5        U(       a0  Ub  [         R                  SU5        O[         R                  SU5        UR                  X4U5        U$ )ad  
Simple helper, that creates an :class:`~ssl.SSLContext` based on params similar to
those in `kafka-python`_, but with some restrictions like:

* `check_hostname` is not optional, and will be set to :data:`True`
* `crlfile` option is missing. It is fairly hard to test it.

Arguments:
    cafile (str): Certificate Authority file path containing certificates
        used to sign broker certificates. If CA not specified (by either
        cafile, capath, cadata) default system CA will be used if found by
        OpenSSL. For more information see
        :meth:`~ssl.SSLContext.load_verify_locations`.
        Default: :data:`None`
    capath (str): Same as `cafile`, but points to a directory containing
        several CA certificates. For more information see
        :meth:`~ssl.SSLContext.load_verify_locations`.
        Default: :data:`None`
    cadata (str, bytes): Same as `cafile`, but instead contains already
        read data in either ASCII or bytes format. Can be used to specify
        DER-encoded certificates, rather than PEM ones. For more
        information see :meth:`~ssl.SSLContext.load_verify_locations`.
        Default: :data:`None`
    certfile (str): optional filename of file in PEM format containing
        the client certificate, as well as any CA certificates needed to
        establish the certificate's authenticity. For more information see
        :meth:`~ssl.SSLContext.load_cert_chain`.
        Default: :data:`None`.
    keyfile (str): optional filename containing the client private key.
        For more information see :meth:`~ssl.SSLContext.load_cert_chain`.
        Default: :data:`None`.
    password (str): optional password to be used when loading the
        certificate chain. For more information see
        :meth:`~ssl.SSLContext.load_cert_chain`.
        Default: :data:`None`.

.. _kafka-python: https://github.com/dpkp/kafka-python
zLoading SSL CA from %sz-Loading SSL CA from data provided in `cadata`z`cadata`: %r)r   r   r   zLoading SSL Cert from %sz%Loading SSL Key from %s with passwordz(Loading SSL Key from %s without password)loginfodebugr   r   SERVER_AUTHload_cert_chain)r   r   r   r   r   r   contexts          UC:\Suresh\moveshuttle\MDcreated\moveengine\venv\Lib\site-packages\aiokafka/helpers.pycreate_ssl_contextr      s    b )6+;V<		@A		.&)$F&G +X6#@'JCWM
 	8<N    )r   7Union[str, bytes, PathLike[str], PathLike[bytes], None]r   r   r   zUnion[str, Buffer, None]r   r   r   r   r   zNUnion[Callable[[], Union[str, bytes, bytearray]], str, bytes, bytearray, None]returnr   )
__future__r   loggingosr   sslr   r   r   typingr   r	   typing_extensionsr
   	getLogger__name__r   r    r   r   <module>r&      s    "   ; ; " $!
 GKFJ'+HLGK 	GCG DG %	G
 FG EGG Gr   