
     h&                         d dl mZmZmZmZ d dlZd dlZd dlZd dlZddl	m
Z
mZ ddlmZ ddlmZmZ g dZ ej                    ZddddZd	 Zd
 ZddZd Zd Zd Zd ZdS )    )unicode_literalsdivisionabsolute_importprint_functionN   )str_cls	type_name)LibraryNotFoundError)__version____version_info__)r   r   backendffi
load_order
use_ctypesuse_openssluse_winlegacy)r   backend_configr   c                     t           d         t           d         S t          5  t           d         t           d         cddd           S t          j        dk    r3t          j                    d         dk     rdt           d<   n0dt           d<   n%t          j        dk    rd	t           d<   n
d
t           d<   t           d         cddd           S # 1 swxY w Y   dS )zs
    :return:
        A unicode string of the backend being used: "openssl", "mac", "win",
        "winlegacy"
    r   Nwin32r      	winlegacywindarwinmacopenssl)_module_values_backend_locksysplatformgetwindowsversion     M/var/www/html/Sam_Eipo/venv/lib/python3.11/site-packages/oscrypto/__init__.pyr   r   "   s-    i ,i((	 ) ))$0!),) ) ) ) ) ) ) ) <7""$&&q)A--,7y)),1y))\X%%(-N9%%(1N9%i() ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )s   C
	A4C

CCc                     t                      dk    ri S t          d         t          d         S t          5  t          d         t          d         cddd           S i t          d<   t          d         cddd           S # 1 swxY w Y   dS )z
    :return:
        A dict of config info for the backend. Only currently used by "openssl",
        it may contains zero or more of the following keys:
         - "libcrypto_path"
         - "libssl_path"
    r   r   N)r   r   r   r!   r"   r#   _backend_configr%   >   s     yyI	&'3.//	 0 0*+7!"230 0 0 0 0 0 0 0 ,.'(./0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0s   B B  BBc                 t   t          | t                    st          dt          |           z            t          |t                    st          dt          |          z            t          j                            |           st          d| z            t          j                            |          st          d|z            |et          |t                    st          dt          |          z            t          j                            |          st          d|z            t          5  | ||d}t          d	         d
k    rt          d         |k    r	 ddd           dS t          d	         t          d          d
t          d	<   |t          d<   ddd           dS # 1 swxY w Y   dS )a  
    Forces using OpenSSL dynamic libraries on OS X (.dylib) or Windows (.dll),
    or using a specific dynamic library on Linux/BSD (.so).

    This can also be used to configure oscrypto to use LibreSSL dynamic
    libraries.

    This method must be called before any oscrypto submodules are imported.

    :param libcrypto_path:
        A unicode string of the file path to the OpenSSL/LibreSSL libcrypto
        dynamic library.

    :param libssl_path:
        A unicode string of the file path to the OpenSSL/LibreSSL libssl
        dynamic library.

    :param trust_list_path:
        An optional unicode string of the path to a file containing
        OpenSSL-compatible CA certificates in PEM format. If this is not
        provided and the platform is OS X or Windows, the system trust roots
        will be exported from the OS and used for all TLS connections.

    :raises:
        ValueError - when one of the paths is not a unicode string
        OSError - when the trust_list_path does not exist on the filesystem
        oscrypto.errors.LibraryNotFoundError - when one of the path does not exist on the filesystem
        RuntimeError - when this function is called after another part of oscrypto has been imported
    z/libcrypto_path must be a unicode string, not %sz,libssl_path must be a unicode string, not %szlibcrypto does not exist at %szlibssl does not exist at %sNz0trust_list_path must be a unicode string, not %sz$trust_list_path does not exist at %s)libcrypto_pathlibssl_pathtrust_list_pathr   r   r   zRAnother part of oscrypto has already been imported, unable to force use of OpenSSL)
isinstancer   
ValueErrorr	   ospathexistsr
   OSErrorr   r   RuntimeError)r'   r(   r)   
new_configs       r#   r   r   U   s   > ng.. hJYWeMfMffgggk7++ bG)T_J`J``aaa7>>.)) V"#Cn#TUUU7>>+&& P"#@;#NOOO"/733 	nOR[\kRlRllmmmw~~o.. 	T@?RSSS	 6 6,&.
 

 )$	11nEU6VZd6d6d6 6 6 6 6 6 6 6 )$0sttt$-y!+5'(6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6s   9*F-00F--F14F1c                  b   t           j        dk    r9t          j                    pt           j        } | dk    rd} t          d| z            t          5  t
          d         dk    r	 ddd           dS t
          d         t          d          dt
          d<   ddd           dS # 1 swxY w Y   dS )	as  
    Forces use of the legacy Windows CryptoAPI. This should only be used on
    Windows XP or for testing. It is less full-featured than the Cryptography
    Next Generation (CNG) API, and as a result the elliptic curve and PSS
    padding features are implemented in pure Python. This isn't ideal, but it
    a shim for end-user client code. No one is going to run a server on Windows
    XP anyway, right?!

    :raises:
        EnvironmentError - when this function is called on an operating system other than Windows
        RuntimeError - when this function is called after another part of oscrypto has been imported
    r   DarwinzOS Xz9The winlegacy backend can only be used on Windows, not %sr   r   NzcAnother part of oscrypto has already been imported, unable to force use of Windows legacy CryptoAPI)r   r   systemEnvironmentErrorr   r   r0   )plats    r#   r   r      s    |w  0CL8DZ]aabbb	 	0 	0)$33	0 	0 	0 	0 	0 	0 	0 	0 )$0u   %0y!	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0s   B$1&B$$B(+B(c                      t           5  t          d         dk    r	 ddd           dS t          d         t          d          dt          d<   ddd           dS # 1 swxY w Y   dS )z
    Forces use of ctypes instead of cffi for the FFI layer

    :raises:
        RuntimeError - when this function is called after another part of oscrypto has been imported
    r   ctypesNr   zQAnother part of oscrypto has already been imported, unable to force use of ctypes)r   r   r0   r!   r"   r#   r   r      s     
 	) 	)% H,,	) 	) 	) 	) 	) 	) 	) 	) )$0c   !)u	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)s   A&AA"Ac                      t           d         t           d         S t          5  	 ddl} dt           d<   n# t          $ r dt           d<   Y nw xY wt           d         cddd           S # 1 swxY w Y   dS )zh
    Returns the FFI module being used

    :return:
        A unicode string of "cffi" or "ctypes"
    r   Nr   cffir8   )r   r   r:   ImportError)r:   s    r#   r   r      s     e(e$$	 % %	-KKK$*N5!! 	- 	- 	-$,N5!!!	- e$% % % % % % % % % % % % % % % % % %s1   A&3A&A
A&	A

A&&A*-A*c                  
    g dS )a)  
    Returns a list of the module and sub-module names for oscrypto in
    dependency load order, for the sake of live reloading code

    :return:
        A list of unicode strings of module names, as they would appear in
        sys.modules, ordered by which module should be reloaded first
    )Ezoscrypto._asn1zoscrypto._cipher_suiteszoscrypto._errorszoscrypto._intzoscrypto._typeszoscrypto.errorszoscrypto.versionoscryptozoscrypto._ffizoscrypto._pkcs12zoscrypto._pkcs5zoscrypto._randzoscrypto._tlszoscrypto._linux_bsd.trust_listz!oscrypto._mac._common_crypto_cffiz#oscrypto._mac._common_crypto_ctypeszoscrypto._mac._common_cryptoz#oscrypto._mac._core_foundation_cffiz%oscrypto._mac._core_foundation_ctypeszoscrypto._mac._core_foundationzoscrypto._mac._security_cffizoscrypto._mac._security_ctypeszoscrypto._mac._securityzoscrypto._mac.trust_listzoscrypto._mac.utilz!oscrypto._openssl._libcrypto_cffiz#oscrypto._openssl._libcrypto_ctypeszoscrypto._openssl._libcryptozoscrypto._openssl._libssl_cffiz oscrypto._openssl._libssl_ctypeszoscrypto._openssl._libsslzoscrypto._openssl.utilzoscrypto._win._cng_cffizoscrypto._win._cng_ctypeszoscrypto._win._cngzoscrypto._win._decodezoscrypto._win._advapi32_cffizoscrypto._win._advapi32_ctypeszoscrypto._win._advapi32zoscrypto._win._kernel32_cffizoscrypto._win._kernel32_ctypeszoscrypto._win._kernel32zoscrypto._win._secur32_cffizoscrypto._win._secur32_ctypeszoscrypto._win._secur32zoscrypto._win._crypt32_cffizoscrypto._win._crypt32_ctypeszoscrypto._win._crypt32zoscrypto._win.trust_listzoscrypto._win.utilzoscrypto.trust_listzoscrypto.utilzoscrypto.kdfzoscrypto._mac.symmetriczoscrypto._openssl.symmetriczoscrypto._win.symmetriczoscrypto.symmetriczoscrypto._asymmetriczoscrypto._ecdsazoscrypto._pkcs1zoscrypto._mac.asymmetriczoscrypto._openssl.asymmetriczoscrypto._win.asymmetriczoscrypto.asymmetriczoscrypto.keyszoscrypto._mac.tlszoscrypto._openssl.tlszoscrypto._win.tlszoscrypto.tlsr!   r!   r"   r#   r   r      s    F F F Fr"   )N)
__future__r   r   r   r   r,   r   r   	threading_typesr   r	   errorsr
   versionr   r   __all__Lockr   r   r   r%   r   r   r   r   r   r!   r"   r#   <module>rE      sH   R R R R R R R R R R R R 				  



     & & & & & & & & ( ( ( ( ( ( 2 2 2 2 2 2 2 2	 	 	 	   ) ) )80 0 0.?6 ?6 ?6 ?6D0 0 0@) ) )(% % %*P P P P Pr"   