
                         @    d dl Z d dlZddlmZ ddlmZ  G d d      Zy)    N   )errors)SSLHTTPAdapterc                   4    e Zd ZdZdZdZdZdZ	 	 	 ddZd Z	y)	TLSConfiga@  
    TLS configuration.

    Args:
        client_cert (tuple of str): Path to client cert, path to client key.
        ca_cert (str): Path to CA cert file.
        verify (bool or str): This can be a bool or a path to a CA cert
            file to verify against. If ``True``, verify using ca_cert;
            if ``False`` or not specified, do not verify.
        ssl_version (int): A valid `SSL version`_.
        assert_hostname (bool): Verify the hostname of the server.

    .. _`SSL version`:
        https://docs.python.org/3.5/library/ssl.html#ssl.PROTOCOL_TLSv1
    Nc                 >   || _         || _        |r|| _        nt        j                  | _        |rf	 |\  }}|r@|r>t        j                  j                  |      rt        j                  j                  |      st        j                  d      ||f| _        || _        || _        | j                  rL| j                  r?t        j                  j                  | j                        st        j                  d      y y y # t
        $ r t        j                  d      w xY w)Nz=client_cert must be a tuple of (client certificate, key file)zRPath to a certificate and key files must be provided through the client_cert paramz.Invalid CA certificate provided for `ca_cert`.)assert_hostnameassert_fingerprintssl_versionsslPROTOCOL_TLS_CLIENT
ValueErrorr   TLSParameterErrorospathisfilecertverifyca_cert)	selfclient_certr   r   r   r	   r
   tls_certtls_keys	            lib/third_party/docker/tls.py__init__zTLSConfig.__init__   s     /"4 *D"66D $/!' "''..2J24''..2I..5  "7+DI ;;4<<t||0L**@  1M<;#  ..6 s   C= =Dc                 N   | j                   |_         | j                  r| j                  r| j                  |_        n| j                  |_        | j                  r| j                  |_        |j	                  dt        | j                   | j                  | j                               y)z<
        Configure a client with these TLS options.
        zhttps://)r   r	   r
   N)r   r   r   r   mountr   r	   r
   )r   clients     r   configure_clientzTLSConfig.configure_clientL   sw     "--;;4<< LLFM KKFM99))FKZ(( 00#66"
 	    )NNNNNN)
__name__
__module____qualname____doc__r   r   r   r   r   r    r    r   r   r      s1     DGFK>B37$(-^r    r   )r   r    r   	transportr   r   r%   r    r   <module>r(      s    	 
  %V Vr    