관리-도구
편집 파일: RSA.cpython-311.pyc
� O�Dgu � �� � g d �Z ddlZddlZddlmZ ddlmZmZmZ ddl m Z mZ ddlm Z ddlmZmZmZ ddlmZmZmZ G d � d e� � Zdd�Zdd�Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z dd�Z!e!Z"dZ#dS ))�generate� construct� import_key�RsaKey�oid� N)�Random)�tobytes�bord�tostr)�DerSequence�DerNull)�Integer)�test_probable_prime�generate_probable_prime� COMPOSITE)�_expand_subject_public_key_info�_create_subject_public_key_info� _extract_subject_public_key_infoc � � e Zd ZdZd� Zed� � � Zed� � � Zed� � � Zed� � � Z ed� � � Z ed� � � Zed � � � Zed � � � Z ed� � � Zed� � � Zd � Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z d%d�ZeZeZd� Z d� Z!d � Z"d!� Z#d"� Z$d#� Z%d$� Z&dS )&r a� Class defining an actual RSA key. Do not instantiate directly. Use :func:`generate`, :func:`construct` or :func:`import_key` instead. :ivar n: RSA modulus :vartype n: integer :ivar e: RSA public exponent :vartype e: integer :ivar d: RSA private exponent :vartype d: integer :ivar p: First factor of the RSA modulus :vartype p: integer :ivar q: Second factor of the RSA modulus :vartype q: integer :ivar invp: Chinese remainder component (:math:`p^{-1} \text{mod } q`) :vartype invp: integer :ivar invq: Chinese remainder component (:math:`q^{-1} \text{mod } p`) :vartype invq: integer :ivar u: Same as ``invp`` :vartype u: integer :undocumented: exportKey, publickey c � � t |� � � � � }t d� � }|t d� � z }|||fvrt d� � �|� � � D ]\ }}t | d|z |� � �||k r7| j | j dz z | _ | j | j dz z | _ d| _ dS dS )a. Build an RSA key. :Keywords: n : integer The modulus. e : integer The public exponent. d : integer The private exponent. Only required for private keys. p : integer The first factor of the modulus. Only required for private keys. q : integer The second factor of the modulus. Only required for private keys. u : integer The CRT coefficient (inverse of p modulo q). Only required for private keys. ��n�e)�p�q�d�uzSome RSA components are missing�_� N)�set�keys� ValueError�items�setattr�_d�_p�_dp�_q�_dq�_invq)�self�kwargs� input_set� public_set�private_set� component�values �v/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/PublicKey/RSA.py�__init__zRsaKey.__init__S s� � �&