관리-도구
편집 파일: PKCS1_OAEP.cpython-311.pyc
� �!�_��� � � d dl mZ d dlZd dlmZmZ d dlZd dlmZm Z m Z d dlmZ d dlm Z G d� d� � Zdd �ZdS )� )�MGF1N)�bord�_copy_bytes)�ceil_div� bytes_to_long� long_to_bytes)�strxor)�Randomc �0 � e Zd ZdZd� Zd� Zd� Zd� Zd� ZdS )�PKCS1OAEP_CipherzXCipher object for PKCS#1 v1.5 OAEP. Do not create directly: use :func:`new` instead.c � � � |� _ |r|� _ nt j j � _ |r|� _ n � fd�� _ t dd|� � � _ |� _ dS )a Initialize 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.5.2/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/Cipher/PKCS1_OAEP.py�<lambda>z+PKCS1OAEP_Cipher.__init__.<locals>.<lambda>G s �� �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���!����r c �4 � | j � � � S )zVLegacy function to check if you can call :meth:`encrypt`. .. deprecated:: 3.0)r �can_encrypt�r s r r$ zPKCS1OAEP_Cipher.can_encryptL � � � �y�$�$�&�&�&r c �4 � | j � � � S )zVLegacy function to check if you can call :meth:`decrypt`. .. deprecated:: 3.0)r �can_decryptr% s r r( zPKCS1OAEP_Cipher.can_decryptR r&