HEX
Server: Apache
System: Linux 185.122.168.184.host.secureserver.net 5.14.0-570.52.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Oct 15 06:39:08 EDT 2025 x86_64
User: barbeatleanalyti (1024)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //var/opt/nydus/ops/oscrypto/__pycache__/__init__.cpython-39.pyc
a

�,�h&�@s�ddlmZmZmZmZddlZddlZddlZddlZddl	m
Z
mZddlm
Z
ddlmZmZgd�Ze��Zdddd�Zd	d
�Zdd�Zdd
d�Zdd�Zdd�Zdd�Zdd�ZdS)�)�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
cCs�tddurtdSt��tddur<tdWd�Stjdkrjt��ddkr`dtd<q�dtd<ntjdkr~d	td<nd
td<tdWd�S1s�0YdS)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�rr�B/opt/nydus/tmp/pip-target-wkfpz8uv/lib/python/oscrypto/__init__.pyr"s




rcCs|t�dkriStddur"tdSt�BtddurJtdWd�Sitd<tdWd�S1sn0YdS)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"
    rrN)rrrrrrr �_backend_config>s	
r!cCs t|t�stdt|���t|t�s4tdt|���tj�|�sLtd|��tj�|�sdtd|��|dur�t|t�s�tdt|���tj�|�s�td|��t	�h|||d�}t
d	d
kr�t
d|kr�Wd�dSt
d	dur�td��d
t
d	<|t
d<Wd�n1�s0YdS)
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 %szlibcrypto does not exist at %szlibssl 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rrzRAnother part of oscrypto has already been imported, unable to force use of OpenSSL)�
isinstancer�
ValueErrorr�os�path�existsr	�OSErrorrr�RuntimeError)r"r#r$Z
new_configrrr rUs0


�rcCs�tjdkr0t��ptj}|dkr$d}td|��t�HtddkrRWd�dStddurftd��dtd<Wd�n1s�0YdS)	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�DarwinzOS Xz9The winlegacy backend can only be used on Windows, not %srrNzcAnother part of oscrypto has already been imported, unable to force use of Windows legacy CryptoAPI)rr�system�EnvironmentErrorrrr+)�platrrr r�s
�rcCs`t�Htddkr"Wd�dStddur6td��dtd<Wd�n1sR0YdS)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)rrr+rrrr r�s�rc	CsttddurtdSt�Hzddl}dtd<WntyHdtd<Yn0tdWd�S1sf0YdS)zh
    Returns the FFI module being used

    :return:
        A unicode string of "cffi" or "ctypes"
    r
Nr�cffir0)rrr1�ImportError)r1rrr r
�sr
cCsgd�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
    )Ezoscrypto._asn1zoscrypto._cipher_suiteszoscrypto._errorsz
oscrypto._intzoscrypto._typeszoscrypto.errorszoscrypto.versionZoscryptoz
oscrypto._ffizoscrypto._pkcs12zoscrypto._pkcs5zoscrypto._randz
oscrypto._tlszoscrypto._linux_bsd.trust_listz!oscrypto._mac._common_crypto_cffiz#oscrypto._mac._common_crypto_ctypeszoscrypto._mac._common_cryptoz#oscrypto._mac._core_foundation_cffiz%oscrypto._mac._core_foundation_ctypeszoscrypto._mac._core_foundationzoscrypto._mac._security_cffizoscrypto._mac._security_ctypeszoscrypto._mac._securityzoscrypto._mac.trust_listzoscrypto._mac.utilz!oscrypto._openssl._libcrypto_cffiz#oscrypto._openssl._libcrypto_ctypeszoscrypto._openssl._libcryptozoscrypto._openssl._libssl_cffiz oscrypto._openssl._libssl_ctypeszoscrypto._openssl._libsslzoscrypto._openssl.utilzoscrypto._win._cng_cffizoscrypto._win._cng_ctypeszoscrypto._win._cngzoscrypto._win._decodezoscrypto._win._advapi32_cffizoscrypto._win._advapi32_ctypeszoscrypto._win._advapi32zoscrypto._win._kernel32_cffizoscrypto._win._kernel32_ctypeszoscrypto._win._kernel32zoscrypto._win._secur32_cffizoscrypto._win._secur32_ctypeszoscrypto._win._secur32zoscrypto._win._crypt32_cffizoscrypto._win._crypt32_ctypeszoscrypto._win._crypt32zoscrypto._win.trust_listzoscrypto._win.utilzoscrypto.trust_listz
oscrypto.utilzoscrypto.kdfzoscrypto._mac.symmetriczoscrypto._openssl.symmetriczoscrypto._win.symmetriczoscrypto.symmetriczoscrypto._asymmetriczoscrypto._ecdsazoscrypto._pkcs1zoscrypto._mac.asymmetriczoscrypto._openssl.asymmetriczoscrypto._win.asymmetriczoscrypto.asymmetricz
oscrypto.keyszoscrypto._mac.tlszoscrypto._openssl.tlszoscrypto._win.tlszoscrypto.tlsrrrrr r�s
r)N)�
__future__rrrrr'rr�	threading�_typesrr�errorsr	�versionr
r�__all__�Lockrrrr!rrrr
rrrrr �<module>s(�
B