Server IP : 192.158.238.246 / Your IP : 3.143.209.210 Web Server : LiteSpeed System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64 User : jenniferflocom ( 1321) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /opt/alt/python37/lib64/python3.7/site-packages/Crypto/PublicKey/__pycache__/ |
Upload File : |
B t~�^�t � @ sD d Z dZddddddgZdd lZejd d krDejd dkrDddlT ddlT dd lmZm Z m Z ddlmZm Z mZ ddlmZ ddlmZmZmZ dd lZdd lZddlmZ ddlmZ yddlmZ W n ek r� d ZY nX G dd� dej�ZG dd� de�Zeed�e� �� g��� Ze� Z e j!Z!e j"Z"e j#Z#e j$Z$d S )a� RSA public-key cryptography algorithm (signature and encryption). RSA_ is the most widespread and used public key algorithm. Its security is based on the difficulty of factoring large integers. The algorithm has withstood attacks for 30 years, and it is therefore considered reasonably secure for new designs. The algorithm can be used for both confidentiality (encryption) and authentication (digital signature). It is worth noting that signing and decryption are significantly slower than verification and encryption. The cryptograhic strength is primarily linked to the length of the modulus *n*. In 2012, a sufficient length is deemed to be 2048 bits. For more information, see the most recent ECRYPT_ report. Both RSA ciphertext and RSA signature are as big as the modulus *n* (256 bytes if *n* is 2048 bit long). This module provides facilities for generating fresh, new RSA keys, constructing them from known components, exporting them, and importing them. >>> from Crypto.PublicKey import RSA >>> >>> key = RSA.generate(2048) >>> f = open('mykey.pem','w') >>> f.write(RSA.exportKey('PEM')) >>> f.close() ... >>> f = open('mykey.pem','r') >>> key = RSA.importKey(f.read()) Even though you may choose to directly use the methods of an RSA key object to perform the primitive cryptographic operations (e.g. `_RSAobj.encrypt`), it is recommended to use one of the standardized schemes instead (like `Crypto.Cipher.PKCS1_v1_5` or `Crypto.Signature.PKCS1_v1_5`). .. _RSA: http://en.wikipedia.org/wiki/RSA_%28algorithm%29 .. _ECRYPT: http://www.ecrypt.eu.org/documents/D.SPA.17.pdf :sort: generate,construct,importKey,error z$Id$�generate� construct�error� importKey�RSAImplementation�_RSAobj� N� � )�*)�getRandomRange� bytes_to_long� long_to_bytes)�_RSA� _slowmath�pubkey)�Random)� DerObject�DerSequence�DerNull)�inverse)� _fastmathc @ s� e Zd ZdZddddddgZd7d d �Zdd� Zd d� Zdd� Zdd� Z dd� Z dd� Zdd� Zdd� Z dd� Zd8dd�Zdd � Zd!d"� Zd#d$� Zd%d&� Zd'd(� Zd)d*� Zd+d,� Zd-d.� Zd/d0� Zd1d2� Zd9d5d6�ZdS ):r zlClass defining an actual RSA key. :undocumented: __getstate__, __setstate__, __repr__, __getattr__ �n�e�d�p�q�uNc C s( || _ || _|d krt�� j}|| _d S )N)�implementation�keyr �new�read� _randfunc)�selfr r �randfunc� r$ �G/opt/alt/python37/lib64/python3.7/site-packages/Crypto/PublicKey/RSA.py�__init__q s z_RSAobj.__init__c C s. || j krt| j|�S td| jj|f ��d S )Nz%s object has no %r attribute)�keydata�getattrr �AttributeError� __class__�__name__)r"