/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__/symmetric.cpython-312.pyc (23859B)
N jTddlmZmZmZmZddlmZddlmZm Z ddl m Z m Z m Z ddlmZddlmZdd lmZmZgd Zd Zd Zd ZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#y))unicode_literalsdivisionabsolute_importprint_function)pretty_message)newnull)CoreFoundation CFHelpershandle_cf_error)Security) rand_bytes) type_namebyte_cls) aes_cbc_no_padding_decryptaes_cbc_no_padding_encryptaes_cbc_pkcs7_decryptaes_cbc_pkcs7_encryptdes_cbc_pkcs5_decryptdes_cbc_pkcs5_encryptrc2_cbc_pkcs5_decryptrc2_cbc_pkcs5_encrypt rc4_decrypt rc4_encrypttripledes_cbc_pkcs5_decrypttripledes_cbc_pkcs5_encryptct|dvrttdt||s td}n,t|dk7rttdt|t|dzdk7rttdt||t t j |||t jfS)a Encrypts plaintext using AES in CBC mode with a 128, 192 or 256 bit key and no padding. This means the ciphertext must be an exact multiple of 16 bytes long. :param key: The encryption key - a byte string either 16, 24 or 32 bytes long :param data: The plaintext - a byte string :param iv: The initialization vector - either a byte string 16-bytes long or None to generate an IV :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 tuple of two byte strings (iv, ciphertext)  c key must be either 16, 24 or 32 bytes (128, 192 or 256 bits) long - is %s r!: iv must be 16 bytes long - is %s rzJ data must be a multiple of 16 bytes long - is %s )len ValueErrorrr_encryptrkSecAttrKeyTypeAESkSecPaddingNoneKeykeydataivs H/opt/nydus/tmp/pip-target-a90h98xg/lib/python/oscrypto/_mac/symmetric.pyrrs2 3x|#  H      ^ RB  G     4y2~  I     44c4XE`E`a bbct|dvrttdt|t|dk7rttdt|ttj |||tj S)a[ Decrypts AES ciphertext in CBC mode using a 128, 192 or 256 bit key and no padding. :param key: The encryption key - a byte string either 16, 24 or 32 bytes long :param data: The ciphertext - a byte string :param iv: The initialization vector - a byte string 16-bytes long :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 of the plaintext r r$r!r%)r&r'r_decryptrr)r*r+s r/rrRs. 3x|#  H     2w"}  G     H//dB@[@[ \\r0c&t|dvrttdt||s td}n,t|dk7rttdt||t t j |||t jfS)a Encrypts plaintext using AES in CBC mode with a 128, 192 or 256 bit key and PKCS#7 padding. :param key: The encryption key - a byte string either 16, 24 or 32 bytes long :param data: The plaintext - a byte string :param iv: The initialization vector - either a byte string 16-bytes long or None to generate an IV :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 tuple of two byte strings (iv, ciphertext) r r$r!r%)r&r'rrr(rr)kSecPaddingPKCS7Keyr+s r/rr|s0 3x|#  H      ^ RB  G     44c4XEaEab ccr0ct|dvrttdt|t|dk7rttdt|ttj |||tj S)aG Decrypts AES ciphertext in CBC mode using a 128, 192 or 256 bit key :param key: The encryption key - a byte string either 16, 24 or 32 bytes long :param data: The ciphertext - a byte string :param iv: The initialization vector - a byte string 16-bytes long :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 of the plaintext r zo key must be either 16, 24 or 32 bytes (128, 192 or 256 bits) long - is %s r!r%)r&r'rr2rr)r4r+s r/rrs, 3x|#  H     2w"}  G     H//dB@\@\ ]]r0ct|dkst|dkDrttdt|ttj ||ddS)a Encrypts plaintext using RC4 with a 40-128 bit key :param key: The encryption key - a byte string 5-16 bytes long :param data: The plaintext - a byte string :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 of the ciphertext r!Q key must be 5 to 16 bytes (40 to 128 bits) long - is %s N)r&r'rr(rkSecAttrKeyTypeRC4r,r-s r/rrV& 3x!|s3x"}  H     H//dD$ GGr0ct|dkst|dkDrttdt|ttj ||ddS)a Decrypts RC4 ciphertext using a 40-128 bit key :param key: The encryption key - a byte string 5-16 bytes long :param data: The ciphertext - a byte string :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 of the plaintext r7r!r8N)r&r'rr2rr9r:s r/rrr;r0cDt|dkst|dkDrttdt||s td}n,t|dk7rttdt||t t j |||t jfS)ab Encrypts plaintext using RC2 with a 64 bit key :param key: The encryption key - a byte string 8 bytes long :param data: The plaintext - a byte string :param iv: The 8-byte initialization vector to use - a byte string - set as None to generate an appropriate one :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 tuple of two byte strings (iv, ciphertext) r7r!r89 iv must be 8 bytes long - is %s )r&r'rrr(rkSecAttrKeyTypeRC2kSecPaddingPKCS5Keyr+s r/rrs. 3x!|s3x"}  H      ] RA  G     44c4XEaEab ccr0c$t|dkst|dkDrttdt|t|dk7rttdt|ttj |||tj S)a" Decrypts RC2 ciphertext using a 64 bit key :param key: The encryption key - a byte string 8 bytes long :param data: The ciphertext - a byte string :param iv: The initialization vector used for encryption - a byte string :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 of the plaintext r7r!r8r>r?)r&r'rr2rr@rAr+s r/rr;s, 3x!|s3x"}  H     2w!|  G     H//dB@\@\ ]]r0cpt|dk7r,t|dk7rttdt||s td}n,t|dk7rttdt|t|dk(r||ddz}|t t j |||t jfS)a Encrypts plaintext using 3DES in either 2 or 3 key mode :param key: The encryption key - a byte string 16 or 24 bytes long (2 or 3 key mode) :param data: The plaintext - a byte string :param iv: The 8-byte initialization vector to use - a byte string - set as None to generate an appropriate one :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 tuple of two byte strings (iv, ciphertext) r!r"zT key must be 16 bytes (2 key) or 24 bytes (3 key) long - %s r>z6 iv must be 8 bytes long - %s r)r&r'rrr(rkSecAttrKeyType3DESrAr+s r/rrds. 3x2~#c(b.  H      ] RA  G     3x2~C!Hn 55sD"hFbFbc ddr0cPt|dk7r,t|dk7rttdt|t|dk7rttdt|t|dk(r||ddz}ttj |||tj S)aC Decrypts 3DES ciphertext in either 2 or 3 key mode :param key: The encryption key - a byte string 16 or 24 bytes long (2 or 3 key mode) :param data: The ciphertext - a byte string :param iv: The initialization vector used for encryption - a byte string :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 of the plaintext r!r"zW key must be 16 bytes (2 key) or 24 bytes (3 key) long - is %s r>r?r)r&r'rr2rrDrAr+s r/rrs, 3x2~#c(b.  H     2w!|  G     3x2~C!Hn H00#tRA]A] ^^r0c(t|dk7rttdt||s td}n,t|dk7rttdt||t t j |||t jfS)a Encrypts plaintext using DES with a 56 bit key :param key: The encryption key - a byte string 8 bytes long (includes error correction bits) :param data: The plaintext - a byte string :param iv: The 8-byte initialization vector to use - a byte string - set as None to generate an appropriate one :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 tuple of two byte strings (iv, ciphertext) r>T key must be 8 bytes (56 bits + 8 parity bits) long - is %s r?)r&r'rrr(rkSecAttrKeyTypeDESrAr+s r/rrs. 3x1}  H      ] RA  G     44c4XEaEab ccr0ct|dk7rttdt|t|dk7rttdt|ttj |||tj S)aC Decrypts DES ciphertext using a 56 bit key :param key: The encryption key - a byte string 8 bytes long (includes error correction bits) :param data: The ciphertext - a byte string :param iv: The initialization vector used for encryption - a byte string :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 of the plaintext r>rGr?)r&r'rr2rrHrAr+s r/rrs, 3x1}  H     2w!|  G     H//dB@\@\ ]]r0cft|tsttdt |t|tsttdt ||t j k7r.t|tsttdt ||t j k7r |s tdd}d}d}d}d} d} tjt j|fg}tj|}tj|}ttd} t j||| } t| t j | | } t| |t j k7rt j"| t j$t'| t| t j"| t j(|| t| tj|}t j"| t j*|| t| t j"| t j,|| t| t j.| | } t| tj0| |rtj2||rtj2||rtj2||rtj2|| rtj2| | rtj2| SS#|rtj2||rtj2||rtj2||rtj2|| rtj2| | rtj2| wwxYw)a Encrypts plaintext :param cipher: A kSecAttrKeyType* value that specifies the cipher to use :param key: The encryption key - a byte string 5-16 bytes long :param data: The plaintext - a byte string :param iv: The initialization vector - a byte string - unused for RC4 :param padding: The padding mode to use, specified as a kSecPadding*Key value - unused for RC4 :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 of the ciphertext ; key must be a byte string, not %s < data must be a byte string, not %s : iv must be a byte string, not %s padding must be specifiedN CFErrorRef *) isinstancer TypeErrorrrrr9r'r cf_dictionary_from_pairskSecAttrKeyTypecf_data_from_bytesr r SecKeyCreateFromDatarSecEncryptTransformCreateSecTransformSetAttributekSecModeCBCKeyr kSecPaddingKey kSecIVKeykSecTransformInputAttributeNameSecTransformExecutecf_data_to_bytes CFRelease) cipherr,r-r.paddingcf_dictcf_keycf_datacf_ivsec_key sec_transform error_pointer ciphertexts r/r(r(s8 c8 $  cN     dH %  dO    ,,,ZH5M  bM    ,,,W455G FG EGM0444x7O7OQW6X5YZ--c2..t4NN; //O & ::7MR  & X00 0  - -mX=T=TVZV\^k l M *  - -mX=T=TV]_l m M *004E  - -mX=O=OQVXe f M *))   4 4     &11-O  &))*5   $ $W -   $ $V ,   $ $W -   $ $U +   $ $W -   $ $] 3    $ $W -   $ $V ,   $ $W -   $ $U +   $ $W -   $ $] 3  G L##B N0cft|tsttdt |t|tsttdt ||t j k7r.t|tsttdt ||t j k7r |s tdd}d}d}d}d} d} tjt j|fg}tj|}tj|}ttd} t j||| } t| t j | | } t| |t j k7rt j"| t j$t'| t| t j"| t j(|| t| tj|}t j"| t j*|| t| t j"| t j,|| t| t j.| | } t| tj0| |rtj2||rtj2||rtj2||rtj2|| rtj2| | rtj2| SS#|rtj2||rtj2||rtj2||rtj2|| rtj2| | rtj2| wwxYw)a Decrypts AES/RC4/RC2/3DES/DES ciphertext :param cipher: A kSecAttrKeyType* value that specifies the cipher to use :param key: The encryption key - a byte string 5-16 bytes long :param data: The ciphertext - a byte string :param iv: The initialization vector - a byte string - unused for RC4 :param padding: The padding mode to use, specified as a kSecPadding*Key value - unused for RC4 :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 of the plaintext rKrLrMrNNrO)rPrrQrrrr9r'r rRrSrTr r rUrSecDecryptTransformCreaterWrXr rYrZr[r\r]r^) r_r,r-r.r`rarbrcrdrerfrg plaintexts r/r2r2s8 c8 $  cN     dH %  dO    ,,,ZH5M  bM    ,,,W455G FG EGM0444x7O7OQW6X5YZ--c2..t4NN; //O & ::7MR  & X00 0  - -mX=T=TVZV\^k l M *  - -mX=T=TV]_l m M *004E  - -mX=O=OQVXe f M *))   4 4     &00 N  &)))4   $ $W -   $ $V ,   $ $W -   $ $U +   $ $W -   $ $] 3    $ $W -   $ $V ,   $ $W -   $ $U +   $ $W -   $ $] 3 riN)$ __future__rrrr_errorsr_ffir r _core_foundationr r r _securityrutilr_typesrr__all__rrrrrrrrrrrrr(r2r0r/rvsRR$HH(  3cl']T*dZ'^TH<H<)dX&^R-e`*_Z)dX&^Rn4bn4r0