/var/opt/nydus/ops/oscrypto/_mac/__pycache__
NameSizeModeActions
asymmetric.cpython-312.pyc664580644editdlrm
symmetric.cpython-312.pyc238590644editdlrm
tls.cpython-312.pyc532230644editdlrm
trust_list.cpython-312.pyc71190644editdlrm
util.cpython-312.pyc107170644editdlrm
_common_crypto.cpython-312.pyc8860644editdlrm
_common_crypto_cffi.cpython-312.pyc10530644editdlrm
_common_crypto_ctypes.cpython-312.pyc9580644editdlrm
_core_foundation.cpython-312.pyc102550644editdlrm
_core_foundation_cffi.cpython-312.pyc126230644editdlrm
_core_foundation_ctypes.cpython-312.pyc147580644editdlrm
_security.cpython-312.pyc49470644editdlrm
_security_cffi.cpython-312.pyc114580644editdlrm
_security_ctypes.cpython-312.pyc177310644editdlrm
__init__.cpython-312.pyc1680644editdlrm
Edit: /var/opt/nydus/ops/oscrypto/_mac/__pycache__/util.cpython-312.pyc (10717B)
N j,'ddlmZmZmZmZddlZddlmZddlm Z m Z m Z m Z ddl mZmZmZmZddlmZdd lmZmZdd lmZgd Zd Zd d gZdZdZdZde_dZ ddl!m"Z"dZ#dZ$y#e$r ddl%m$Z$YywxYw))unicode_literalsdivisionabsolute_importprint_functionN)pretty_message)buffer_from_bytesbytes_from_buffererrnobyte_string_from_buffer) type_namestr_clsbyte_cls int_types)LibraryNotFoundError) CommonCryptoCommonCryptoConst)Security)pbkdf2 pkcs12_kdf rand_bytesutf-8cp1252c t|tS#t$r/tD]#} t||dccYS#t$rY!wxYwYnwxYwt|dS)Nstrict)errorsreplace)r _encodingUnicodeDecodeError_fallback_encodings)valueencodings C/opt/nydus/tmp/pip-target-a90h98xg/lib/python/oscrypto/_mac/util.py _try_decoder%sd ui(( +H uhx@@&  , 5 ++s/A  7A  AA AA  A ct} tj|}t |tr|St |S#t$rt |cYSwxYw)z~ Extracts the last OS error message into a python unicode string :return: A unicode string error message )r osstrerror ValueErrorr isinstancer%) error_num error_strings r$_extract_errorr-*sWI"{{9- ,( | $$ "y!!"s>AAc t|tsttdt |t|tsttdt |t|t sttdt ||dkr t dt|t sttdt ||dkr t d|tgdvrt td t|tjtjtjtjtjd|}t|}t!j"tj$|t'||t'||||| }|d k7rt)t+t-|S) a PBKDF2 from PKCS#5 :param hash_algorithm: The string name of the hash algorithm to use: "sha1", "sha224", "sha256", "sha384", "sha512" :param password: A byte string of the password to use an input to the KDF :param salt: A cryptographic random byte string :param iterations: The numbers of iterations to use when deriving the key :param key_length: The length of the desired key in bytes :raises: ValueError - when any of the parameters contain an invalid value TypeError - when any of the parameters are of the wrong type OSError - when an error is returned by the OS crypto library :return: The derived key as a byte string z@ password must be a byte string, not %s z< salt must be a byte string, not %s z? iterations must be an integer, not %s rz!iterations must be greater than 0z? key_length must be an integer, not %s z!key_length must be greater than 0)sha1sha224sha256sha384sha512zz hash_algorithm must be one of "sha1", "sha224", "sha256", "sha384", "sha512", not %s r)r*r TypeErrorrr rr)setreprrkCCPRFHmacAlgSHA1kCCPRFHmacAlgSHA224kCCPRFHmacAlgSHA256kCCPRFHmacAlgSHA384kCCPRFHmacAlgSHA512r rCCKeyDerivationPBKDF kCCPBKDF2lenOSErrorr-r )hash_algorithmpasswordsalt iterations key_lengthalgo output_bufferresults r$rr?s8 h )  h      dH %  dO     j) ,  j !    A~<== j) ,  j !    A~<==S!QRR      "33#77#77#77#77     D&j1M  . .## H   D   F{n&'' ] ++FcDt|tsttdt ||dkr t d|dkDr t dt |}tjtj||}|dk7rttt|S)a Returns a number of random bytes suitable for cryptographic purposes :param length: The desired number of bytes :raises: ValueError - when any of the parameters contain an invalid value TypeError - when any of the parameters are of the wrong type OSError - when an error is returned by the OS crypto library :return: A byte string z; length must be an integer, not %s rzlength must be greater than 0iz$length must not be greater than 1024r) r*rr4rr r)r rSecRandomCopyByteskSecRandomDefaultr?r-r )lengthbufferrGs r$rrs fi (  f     z899 }?@@ v &F  ( ()C)CVV TF {n&'' V $$rH) libcryptoctj}td}tj||t |}t |S)z Extracts the last OpenSSL error message into a python unicode string :return: A unicode string error message x)rN ERR_get_errorr ERR_error_stringr r%)r+rMr,s r$_extract_openssl_errorrSsC++- "3'""9f5/v6 <((rHc |t|tsttdt |t|tsttdt |t|t sttdt ||dkrt tdt|t|t sttdt ||dkrt tdt||tgdvrt td t||tgd vrt td t||jd jd dz} tjtjtjtjtj tj"d|}t%|}tj&|t)||t)|||||| } | dk7rt+t-t/|S)a KDF from RFC7292 appendix B.2 - https://tools.ietf.org/html/rfc7292#page-19 :param hash_algorithm: The string name of the hash algorithm to use: "md5", "sha1", "sha224", "sha256", "sha384", "sha512" :param password: A byte string of the password to use an input to the KDF :param salt: A cryptographic random byte string :param iterations: The numbers of iterations to use when deriving the key :param key_length: The length of the desired key in bytes :param id_: The ID of the usage - 1 for key, 2 for iv, 3 for mac :raises: ValueError - when any of the parameters contain an invalid value TypeError - when any of the parameters are of the wrong type OSError - when an error is returned by the OS crypto library :return: The derived key as a byte string zH password must be a byte string, not %s zD salt must be a byte string, not %s zG iterations must be an integer, not %s rzK iterations must be greater than 0 - is %s zG key_length must be an integer, not %s zK key_length must be greater than 0 - is %s )md5r/r0r1r2r3z hash_algorithm must be one of "md5", "sha1", "sha224", "sha256", "sha384", "sha512", not %s )rrzD id_ must be one of 1, 2, 3, not %s rzutf-16bes)r*rr4rr rr)r6r5decodeencoderNEVP_md5EVP_sha1 EVP_sha224 EVP_sha256 EVP_sha384 EVP_sha512r PKCS12_key_gen_unir>r?rSr ) r@rArBrCrDid_utf16_password digest_typerFrGs r$rrsL>(H-N(#  $)N$  *i0N*%   >^Z  *i0N*%   >^Z   %\!] ]^^$   c)n $^S  "188D{R$$&&********    **5 --     I        Q;023 3 //rH)r)& __future__rrrrr'_errorsr_ffir r r r _typesr rrrrr_common_cryptorr _securityr__all__rr!r%r-r pure_pythonr_openssl._libcryptorNrSr_pkcs12rHr$rnsRR $WW<<);   ),"%*b,J#%PR%/)"z0x %$%s! A.. A<;A<