§ f¥Øf{"ãó€—ddlmZddlZddlmZmZddlZddlmZm Z m Z ddl m Z ddlm Z Gd„d¦«Zd d „ZdS) é)ÚMGF1N)ÚbordÚ _copy_bytes)Úceil_divÚ bytes_to_longÚ long_to_bytes)Ústrxor)ÚRandomcó0—eZdZdZd„Zd„Zd„Zd„Zd„ZdS)ÚPKCS1OAEP_CipherzXCipher object for PKCS#1 v1.5 OAEP. Do not create directly: use :func:`new` instead.c󸇗|‰_|r|‰_ntjj‰_|r|‰_n ˆfd„‰_t dd|¦«‰_|‰_dS)aInitialize this PKCS#1 OAEP cipher object. :Parameters: key : an RSA key object If a private half is given, both encryption and decryption are possible. If a public half is given, only encryption is possible. hashAlgo : hash object The hash function to use. This can be a module under `Crypto.Hash` or an existing hash object created from any of such modules. If not specified, `Crypto.Hash.SHA1` is used. mgfunc : callable A mask generation function that accepts two parameters: a string to use as seed, and the lenth of the mask to generate, in bytes. If not specified, the standard MGF1 consistent with ``hashAlgo`` is used (a safe choice). label : bytes/bytearray/memoryview A label to apply to this particular encryption. If not specified, an empty string is used. Specifying a label does not improve security. randfunc : callable A function that returns random bytes. :attention: Modify the mask generation function only if you know what you are doing. Sender and receiver must use the same one. có0•—t||‰j¦«S)N)rÚ_hashObj)ÚxÚyÚselfs €úz/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/Cipher/PKCS1_OAEP.pyúz+PKCS1OAEP_Cipher.__init__..Gsø€¥D¨¨1¨T¬]Ñ$;Ô$;€óN) Ú_keyrÚCryptoÚHashÚSHA1Ú_mgfrÚ_labelÚ _randfunc)rÚkeyÚhashAlgoÚmgfuncÚlabelÚrandfuncs` rÚ__init__zPKCS1OAEP_Cipher.__init__$shø€ð2ˆŒ à ð -Ø$ˆDŒMˆMå"œKÔ,ˆDŒMà ð <؈DŒIˆIà;Ð;Ð;Ð;ˆDŒIå! $¨¨eÑ4Ô4ˆŒ Ø!ˆŒˆˆrcó4—|j ¦«S)zVLegacy function to check if you can call :meth:`encrypt`. .. deprecated:: 3.0)rÚ can_encrypt©rs rr$zPKCS1OAEP_Cipher.can_encryptLó€ðŒy×$Ò$Ñ&Ô&Ð&rcó4—|j ¦«S)zVLegacy function to check if you can call :meth:`decrypt`. .. deprecated:: 3.0)rÚ can_decryptr%s rr(zPKCS1OAEP_Cipher.can_decryptRr&rcóî—tjj |jj¦«}t |d¦«}|jj}t|¦«}||z d|zz dz }|dkrtd¦«‚|j  |j ¦«  ¦«}d|z}||zdztdd|¦«z} | |¦«} | | ||z dz ¦«} t#| | ¦«} | | |¦«} t#| | ¦«}d|z| z}t%|¦«}|j |¦«}t)||¦«}|S) a\Encrypt a message with PKCS#1 OAEP. :param message: The message to encrypt, also known as plaintext. It can be of variable length, but not longer than the RSA modulus (in bytes) minus 2, minus twice the hash output size. For instance, if you use RSA 2048 and SHA-256, the longest message you can encrypt is 190 byte long. :type message: bytes/bytearray/memoryview :returns: The ciphertext, as large as the RSA modulus. :rtype: bytes :raises ValueError: if the message is too long. éérzPlaintext is too long.óóNé)rÚUtilÚnumberÚsizerÚnrrÚ digest_sizeÚlenÚ ValueErrorÚnewrÚdigestrrrr rÚ_encryptr)rÚmessageÚmodBitsÚkÚhLenÚmLenÚps_lenÚlHashÚpsÚdbÚrosÚdbMaskÚmaskedDBÚseedMaskÚ maskedSeedÚemÚem_intÚm_intÚcs rÚencryptzPKCS1OAEP_Cipher.encryptXsc€õ&”+Ô$×)Ò)¨$¬)¬+Ñ6Ô6ˆÝ W˜aÑ Ô ˆØŒ}Ô(ˆÝ7‰|Œ|ˆðT‘˜A ™HÑ$ qÑ(ˆØ AŠ:ˆ:ÝÐ5Ñ6Ô6Ð 6à” ×!Ò! $¤+Ñ.Ô.×5Ò5Ñ7Ô7ˆà vÑ ˆà R‰Z˜'Ñ !¥K°°d¸GÑ$DÔ$DÑ DˆànŠn˜TÑ"Ô"ˆà—’˜3  $¡ q¡Ñ)Ô)ˆå˜"˜fÑ%Ô%ˆà—9’9˜X tÑ,Ô,ˆå˜C Ñ*Ô*ˆ à zÑ ! HÑ ,ˆå˜rÑ"Ô"ˆà” ×"Ò" 6Ñ*Ô*ˆå ˜% Ñ #Ô #ˆØˆrcó—tjj |jj¦«}t |d¦«}|jj}t|¦«|ks ||dzkrtd¦«‚t|¦«}|j  |¦«}t||¦«}|j |j¦« ¦«}|d} |d|dz…} ||dzd…} | | |¦«} t%| | ¦«} | | ||z dz ¦«}t%| |¦«}|||d… d¦«z}|d|…}t)| ¦«t+||k¦«z}t%||¦«}|D]}|t)|¦«z}Œ|||…D]}|t)|¦«z}Œ|dkrtd¦«‚||dzd…S) a5Decrypt a message with PKCS#1 OAEP. :param ciphertext: The encrypted message. :type ciphertext: bytes/bytearray/memoryview :returns: The original message (plaintext). :rtype: bytes :raises ValueError: if the ciphertext has the wrong length, or if decryption fails the integrity check (in which case, the decryption key is probably wrong). :raises TypeError: if the RSA key has no private half (i.e. you are trying to decrypt using a public key). r*r+z!Ciphertext with incorrect length.rr.Nr-zIncorrect decryption.)rr/r0r1rr2rrr3r4r5rÚ_decryptrr6rr7rr ÚfindrÚint)rÚ ciphertextr:r;r<Úct_intrIrGr?rrFrDrEÚseedrCrAÚone_posÚlHash1ÚinvalidÚ hash_comparers rÚdecryptzPKCS1OAEP_Cipher.decryptŽs€õ&”+Ô$×)Ò)¨$¬)¬+Ñ6Ô6ˆÝ W˜QÑ Ô ˆØŒ}Ô(ˆõ ˆz‰?Œ?˜aÒ Ð  1 T¨!¡V¢8 8ÝÐ@ÑAÔAÐ Aå˜zÑ*Ô*ˆà” ×"Ò" 6Ñ*Ô*ˆå ˜5 !Ñ $Ô $ˆà” ×!Ò! $¤+Ñ.Ô.×5Ò5Ñ7Ô7ˆà ˆqŒEˆð˜˜$˜q™&˜”\ˆ Ød˜1‘fgg”;ˆà—9’9˜X tÑ,Ô,ˆåj (Ñ+Ô+ˆà—’˜4  4¡¨¡Ñ*Ô*ˆå H˜fÑ %Ô %ˆà˜˜D˜E˜EœŸš¨Ñ0Ô0Ñ0ˆØETE”ˆÝq‘'”'C ¨$¢Ñ/Ô/Ñ/ˆÝ˜f eÑ,Ô,ˆ Øð ð ˆAØ •t˜A‘w”wÑ ˆGˆGØD˜LÔ!ð ð ˆAØ •t˜A‘w”wÑ ˆGˆGØ aŠ<ˆ<ÝÐ4Ñ5Ô5Ð 5à'˜A‘+,,ÔÐrN) Ú__name__Ú __module__Ú __qualname__Ú__doc__r"r$r(rKrW©rrr r sk€€€€€ð8ð8ð&"ð&"ð&"ðP'ð'ð'ð 'ð'ð'ð 4ð4ð4ðl< ð< ð< ð< ð< rr rcóD—|€ tj}t|||||¦«S)a›Return a cipher object :class:`PKCS1OAEP_Cipher` that can be used to perform PKCS#1 OAEP encryption or decryption. :param key: The key object to use to encrypt or decrypt the message. Decryption is only possible with a private RSA key. :type key: RSA key object :param hashAlgo: The hash function to use. This can be a module under `Crypto.Hash` or an existing hash object created from any of such modules. If not specified, `Crypto.Hash.SHA1` is used. :type hashAlgo: hash object :param mgfunc: A mask generation function that accepts two parameters: a string to use as seed, and the lenth of the mask to generate, in bytes. If not specified, the standard MGF1 consistent with ``hashAlgo`` is used (a safe choice). :type mgfunc: callable :param label: A label to apply to this particular encryption. If not specified, an empty string is used. Specifying a label does not improve security. :type label: bytes/bytearray/memoryview :param randfunc: A function that returns random bytes. The default is `Random.get_random_bytes`. :type randfunc: callable )r Úget_random_bytesr )rrrr r!s rr6r6Ìs)€ð@ÐÝÔ*ˆÝ ˜C ¨6°5¸(Ñ CÔ CÐCr)NNrN)ÚCrypto.Signature.pssrÚCrypto.Hash.SHA1rÚCrypto.Util.py3compatrrÚCrypto.Util.numberrrrÚCrypto.Util.strxorr r r r6r\rrúrdsàðð.&Ð%Ð%Ð%Ð%Ð%ØÐÐÐà3Ð3Ð3Ð3Ð3Ð3Ð3Ð3ØÐÐÐØGÐGÐGÐGÐGÐGÐGÐGÐGÐGØ'Ð'Ð'Ð'Ð'Ð'ØÐÐÐÐÐðj ðj ðj ðj ðj ñj ôj ðj ðX"Dð"Dð"Dð"Dð"Dð"Dr