ffJdZdgZddlmZddlmZGddeZdZdS)z OpenPGP mode. OpenPgpMode) _copy_bytes)get_random_bytesc$eZdZdZdZdZdZdS)razOpenPGP mode. This mode is a variant of CFB, and it is only used in PGP and OpenPGP_ applications. If in doubt, use another mode. An Initialization Vector (*IV*) is required. Unlike CFB, the *encrypted* IV (not the IV itself) is transmitted to the receiver. The IV is a random data block. For legacy reasons, two of its bytes are duplicated to act as a checksum for the correctness of the key, which is now known to be insecure and is ignored. The encrypted IV is therefore 2 bytes longer than the clean IV. .. _OpenPGP: http://tools.ietf.org/html/rfc4880 :undocumented: __init__ cd|j|_d|_|j||jfd|jz|jdzd|}t dd|}t ||jkr&|||ddz|_nat ||jdzkr%||_||dd}n!td|j|jdzfz|x|_ |_ |j||jf|j|j d|jdzd||_ dS)NF)IV segment_sizez4Length of IV must be %d or %d bytes for MODE_OPENPGP) block_size_done_first_blocknewMODE_CFBrlenencrypt _encrypted_IVdecrypt ValueErrorivr _cipher)selffactorykeyr cipher_params IV_ciphers }/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/Cipher/_mode_openpgp.py__init__zOpenPgpMode.__init__=s",!& GK()#T_4%)_q%8 )) ( )) tR ( ( r77do % %!*!2!22233>> c.encrypt(a) + c.encrypt(b) is equivalent to: >>> c.encrypt(a+b) This function does not add any padding to the plaintext. :Parameters: plaintext : bytes/bytearray/memoryview The piece of data to encrypt. :Return: the encrypted data, as a byte string. It is as long as *plaintext* with one exception: when encrypting the first message chunk, the encypted IV is prepended to the returned ciphertext. T)rrrr)r plaintextress rrzOpenPgpMode.encryptgs>>l""9--% *$s*C%)D " r c6|j|S)aDecrypt data with the key and the parameters set at initialization. A cipher object is stateful: once you have decrypted a message you cannot decrypt (or encrypt) another message with the same object. The data to decrypt can be broken up in two or more pieces and `decrypt` can be called multiple times. That is, the statement: >>> c.decrypt(a) + c.decrypt(b) is equivalent to: >>> c.decrypt(a+b) This function does not remove any padding from the plaintext. :Parameters: ciphertext : bytes/bytearray/memoryview The piece of data to decrypt. :Return: the decrypted data (byte string). )rr)r ciphertexts rrzOpenPgpMode.decrypts6|##J///r N)__name__ __module__ __qualname____doc__rrrr rrr(sM((-(-(-T###J00000r c r|dd}|dd}d||fkrt|j}||tdn|} |d}n1#t$r$}tdt |zd}~wwxYwt ||||S)a#Create a new block cipher, configured in OpenPGP mode. :Parameters: factory : module The module. :Keywords: key : bytes/bytearray/memoryview The secret key to use in the symmetric cipher. IV : bytes/bytearray/memoryview The initialization vector to use for encryption or decryption. For encryption, the IV must be as long as the cipher block size. For decryption, it must be 2 bytes longer (it is actually the *encrypted* IV which was prefixed to the ciphertext). r Nr)NNz*You must either use 'iv' or 'IV', not bothrzMissing component: )poprr TypeErrorKeyErrorstrr)rkwargsrr res r_create_openpgp_cipherr2s( D$  B D$  BBx g0 1 1 ~ >HII I 8jj 888-A67778 wR 0 00s A66 B$BB$N) r)__all__Crypto.Util.py3compatr Crypto.Randomrobjectrr2r*r rr7s> /------******00000&000D$1$1$1$1$1r